diff options
| author | Tolmachev Igor <me@igorek.dev> | 2026-05-09 00:34:22 +0300 |
|---|---|---|
| committer | Tolmachev Igor <me@igorek.dev> | 2026-05-09 01:25:25 +0300 |
| commit | f6983686a66c3b8941af471d78642b307eb26f8e (patch) | |
| tree | 80fd754fcc820e9b47b9d9cdafbdf86065ebf3ed /compiler/src/ast/mod.rs | |
| parent | 17475ea76a2a6e81bc25a995eca0f19c727a683a (diff) | |
| download | crisp-f6983686a66c3b8941af471d78642b307eb26f8e.tar.gz crisp-f6983686a66c3b8941af471d78642b307eb26f8e.zip | |
Add AST parser skeleton
Diffstat (limited to 'compiler/src/ast/mod.rs')
| -rw-r--r-- | compiler/src/ast/mod.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/compiler/src/ast/mod.rs b/compiler/src/ast/mod.rs new file mode 100644 index 0000000..4587ea7 --- /dev/null +++ b/compiler/src/ast/mod.rs | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | mod error; | ||
| 2 | mod parser; | ||
| 3 | |||
| 4 | use std::rc::Rc; | ||
| 5 | |||
| 6 | use crate::span::Spanned; | ||
| 7 | pub use error::Error; | ||
| 8 | pub use parser::Parser; | ||
| 9 | |||
| 10 | #[derive(Clone, Debug)] | ||
| 11 | pub enum Atom { | ||
| 12 | Float(f64), | ||
| 13 | Integer(i64), | ||
| 14 | String(Rc<str>), | ||
| 15 | Symbol(Rc<str>), | ||
| 16 | Bool(bool), | ||
| 17 | Nil, | ||
| 18 | } | ||
| 19 | |||
| 20 | #[derive(Clone, Debug)] | ||
| 21 | pub enum Expr { | ||
| 22 | Atom(Atom), | ||
| 23 | List(Vec<Spanned<Expr>>), | ||
| 24 | } | ||
| 25 | |||
| 26 | #[derive(Clone, Debug)] | ||
| 27 | pub struct Program(pub Vec<Spanned<Expr>>); | ||
