diff options
| author | Arnaud Bailly <arnaud.bailly@iohk.io> | 2024-09-24 09:33:37 +0200 |
|---|---|---|
| committer | Arnaud Bailly <arnaud.bailly@iohk.io> | 2024-09-24 09:33:37 +0200 |
| commit | 72190fe9bbe8b72294d4649d9c3b68f101f2aad2 (patch) | |
| tree | 3d1bde2047a8bbde4a8e595c275b46e41c37a688 /rust/src/ast.rs | |
| parent | c87e50d9b4859ad16034437e812a84cbe59db6a7 (diff) | |
| download | lambda-nantes-72190fe9bbe8b72294d4649d9c3b68f101f2aad2.tar.gz | |
Split module into ast and parser
Diffstat (limited to 'rust/src/ast.rs')
| -rw-r--r-- | rust/src/ast.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/rust/src/ast.rs b/rust/src/ast.rs new file mode 100644 index 0000000..b179704 --- /dev/null +++ b/rust/src/ast.rs @@ -0,0 +1,18 @@ +use std::fmt::{self, Display}; + +#[derive(Debug, PartialEq)] +pub enum Value { + Num(i32), + Bool(bool), + Sym(String), +} + +impl Display for Value { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Value::Num(i) => write!(f, "{}", i), + Value::Bool(b) => write!(f, "{}", b), + Value::Sym(s) => write!(f, "{}", s), + } + } +} |
