From 90dfe422f9c7058bebde0abf7eb3c7675c8fbf66 Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Wed, 25 Sep 2024 13:30:24 +0200 Subject: Introduce let-expressions --- rust/src/ast.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'rust/src/ast.rs') diff --git a/rust/src/ast.rs b/rust/src/ast.rs index 8729fa2..2221856 100644 --- a/rust/src/ast.rs +++ b/rust/src/ast.rs @@ -8,6 +8,7 @@ pub enum Value { App(Box, Box), Lam(String, Box), Def(String, Box), + Let(String, Box, Box), } impl Display for Value { @@ -19,6 +20,7 @@ impl Display for Value { Value::App(l, r) => write!(f, "({} {})", l, r), Value::Lam(var, body) => write!(f, "(lam {} {})", var, body), Value::Def(var, value) => write!(f, "(def {} {})", var, value), + Value::Let(var, value, body) => write!(f, "(let ({} {}) {})", var, value, body), } } } -- cgit v1.2.3