From d5b0224a398810a2e34713d72c6710f4f54df420 Mon Sep 17 00:00:00 2001 From: David Li Date: Fri, 3 Nov 2017 23:37:17 -0400 Subject: Switch to lalrpop for parsing/lexing --- src/taiga.lalrpop | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/taiga.lalrpop (limited to 'src/taiga.lalrpop') 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 = { + Num => Box::new(ast::Expression::Number(<>)), +}; + +Num: u64 = r"[0-9]+" => u64::from_str(<>).unwrap(); -- cgit v1.2.3