summaryrefslogtreecommitdiff
path: root/rust/src/ast.rs
diff options
context:
space:
mode:
authorArnaud Bailly <arnaud.bailly@iohk.io>2024-09-25 13:30:24 +0200
committerArnaud Bailly <arnaud.bailly@iohk.io>2024-09-25 13:30:24 +0200
commit90dfe422f9c7058bebde0abf7eb3c7675c8fbf66 (patch)
treefd55e6f04cf89da5f924154124eaf8c0a763f832 /rust/src/ast.rs
parent7263237a7e2a3dcfb19978e3ebae022a8f2cb0b8 (diff)
downloadlambda-nantes-90dfe422f9c7058bebde0abf7eb3c7675c8fbf66.tar.gz
Introduce let-expressions
Diffstat (limited to 'rust/src/ast.rs')
-rw-r--r--rust/src/ast.rs2
1 files changed, 2 insertions, 0 deletions
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<Value>, Box<Value>),
Lam(String, Box<Value>),
Def(String, Box<Value>),
+ Let(String, Box<Value>, Box<Value>),
}
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),
}
}
}