diff options
author | David Li <li.davidm96@gmail.com> | 2017-11-03 23:37:17 -0400 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2017-11-03 23:37:37 -0400 |
commit | d5b0224a398810a2e34713d72c6710f4f54df420 (patch) | |
tree | f56bf6cd72292bfab30f2bcd75e41c921fe089fd /src/taiga.lalrpop | |
parent | 169870428a9074d2429e6ec3dac64e84bb0392e3 (diff) |
Switch to lalrpop for parsing/lexing
Diffstat (limited to 'src/taiga.lalrpop')
-rw-r--r-- | src/taiga.lalrpop | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/taiga.lalrpop b/src/taiga.lalrpop new file mode 100644 index 0000000..b60d68f --- /dev/null +++ b/src/taiga.lalrpop @@ -0,0 +1,14 @@ +use std::str::FromStr; +use ast; + +grammar; + +pub Program: ast::Program = { + Expression => ast::Program(<>), +}; + +Expression: Box<ast::Expression> = { + Num => Box::new(ast::Expression::Number(<>)), +}; + +Num: u64 = r"[0-9]+" => u64::from_str(<>).unwrap(); |