summaryrefslogtreecommitdiff
path: root/src/taiga.lalrpop
diff options
context:
space:
mode:
authorDavid Li <li.davidm96@gmail.com>2017-11-03 23:37:17 -0400
committerDavid Li <li.davidm96@gmail.com>2017-11-03 23:37:37 -0400
commitd5b0224a398810a2e34713d72c6710f4f54df420 (patch)
treef56bf6cd72292bfab30f2bcd75e41c921fe089fd /src/taiga.lalrpop
parent169870428a9074d2429e6ec3dac64e84bb0392e3 (diff)
Switch to lalrpop for parsing/lexing
Diffstat (limited to 'src/taiga.lalrpop')
-rw-r--r--src/taiga.lalrpop14
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();