Finally have things printing to the screen
Nothing fancy yet. This commit adds a bunch of stuff (oops): * compiling code * VM with instructions * remove eval.rs and just eval in the Machine struct itself * squash most warnings now that we're using stuff here And probably more. But that's all for now folks Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -117,7 +117,7 @@ impl<'t> Parser<'t> {
|
||||
|
||||
pub fn next_atom(&mut self) -> Result<SpAtom> {
|
||||
use Token::*;
|
||||
let token = self.expect_any_token(&[Word, Float, Int, Str])?;
|
||||
let token = self.expect_any_token(&[Assign, Word, Float, Int, Str, Bang])?;
|
||||
Ok(self.token_to_atom(token))
|
||||
}
|
||||
|
||||
@@ -126,10 +126,12 @@ impl<'t> Parser<'t> {
|
||||
let (span, token) = token.into_split();
|
||||
let text = span.text_at(self.lexer.text());
|
||||
let atom = match token {
|
||||
Token::Assign => Atom::Assign(text[1..].to_string()),
|
||||
Token::Word => Atom::Word(text.to_string()),
|
||||
Token::Float => Atom::Float(text.parse().unwrap()),
|
||||
Token::Int => Atom::Int(text.parse().unwrap()),
|
||||
Token::Str => Atom::Str(unescape_string(text)),
|
||||
Token::Bang => Atom::Apply,
|
||||
_ => panic!("invalid token specified for token_to_atom, it should be an atom"),
|
||||
};
|
||||
SpAtom::new(span, atom)
|
||||
|
||||
Reference in New Issue
Block a user