diff --git a/use-based-refs/interpreter/src/lib.rs b/use-based-refs/interpreter/src/lib.rs index 18a4b4485ef969231f7dfa4af6f431dbd24028e9..dca1bd82e673b032dcc7ccb0fc9aea0ece5bfed6 100644 --- a/use-based-refs/interpreter/src/lib.rs +++ b/use-based-refs/interpreter/src/lib.rs @@ -6,6 +6,16 @@ mod parser; pub use eval::eval; +/// A Node of the λ_UR AST, simplified from the UrParser. +// TODO: Switch to this vor eval +pub enum Node { + Num(u32), + Unit, + Seq(Vec<Node>), + Let{ident: String, expr: Box<Expr>}, + Lookup(String), +} + // TODO: Put this elsewhere? #[derive(Debug, PartialEq, Eq, Clone)] pub enum Value { diff --git a/use-based-refs/interpreter/src/parser.rs b/use-based-refs/interpreter/src/parser.rs index aa2f62f042ab356eed0fba110282d7f21553217e..a0422c8a33385f35f8c9815c129f9c700d2dd897 100644 --- a/use-based-refs/interpreter/src/parser.rs +++ b/use-based-refs/interpreter/src/parser.rs @@ -12,3 +12,11 @@ pub fn tokenize(input: &str) -> Result<Pair<'_, Rule>, String> { Err(e) => Err(format!("{e}")), } } + + +// TODO: Fill +pub fn ast(input: &str) -> Node { + match tokenize(input).as_rule() { + + } +}