diff options
author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2025-07-26 10:52:03 +0300 |
---|---|---|
committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2025-07-26 10:52:03 +0300 |
commit | bf4632c461508de5202db98d25cd7ec06787c8dd (patch) | |
tree | dab8ddb1b0dcb7a20b9ab2e7067e26344776db4c /src/sexp/mod.rs | |
parent | c810925fce7d5de1845e09538b6943f54f266cb0 (diff) | |
download | myslip-bf4632c461508de5202db98d25cd7ec06787c8dd.tar.gz myslip-bf4632c461508de5202db98d25cd7ec06787c8dd.zip |
Created necessary data structures and utilities for integers and their operations; added tests for them
Diffstat (limited to 'src/sexp/mod.rs')
-rw-r--r-- | src/sexp/mod.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/sexp/mod.rs b/src/sexp/mod.rs new file mode 100644 index 0000000..c920e41 --- /dev/null +++ b/src/sexp/mod.rs @@ -0,0 +1,27 @@ + +pub mod step; +pub mod util; + +/// A leaf node for S-Expressions. +/// +/// May represent built-in operators, +/// variables (to be added), functions +/// (to be added) or values. +#[derive(Debug)] +#[derive(PartialEq)] +pub enum SLeaf { + Add, + Sub, + Mul, + Div, + Int(i32), +} + +/// An S-Expression; the defining structure of the language. +#[derive(Debug)] +#[derive(PartialEq)] +pub enum SExp { + SCons(Box<SExp>, Box<SExp>), + Atom(SLeaf), +} + |