Add lexer, parser, ast, and basic command line interaction
* Add lexer and parser using lrpar crate * AST is added and constructed via lexer and parser * Command line program `not` will read a file and parse it Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -12,6 +12,7 @@ Body -> Result<Vec<Stmt>>:
|
||||
Body 'EOL' Stmt {
|
||||
flatten($1, $3)
|
||||
}
|
||||
| Body 'EOL' { $1 }
|
||||
| Stmt { Ok(vec![$1?]) }
|
||||
| { Ok(Vec::new()) }
|
||||
;
|
||||
@@ -48,6 +49,9 @@ AccessExpr -> Result<Expr>:
|
||||
AtomExpr AccessExprTail {
|
||||
Ok(AccessExpr::new_expr($1?, $2?))
|
||||
}
|
||||
| AtomExpr {
|
||||
Ok(AccessExpr::new_expr($1?, Default::default()))
|
||||
}
|
||||
;
|
||||
|
||||
AccessExprTail -> Result<Vec<Access>>:
|
||||
|
||||
Reference in New Issue
Block a user