aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/ast/mod.rs
diff options
context:
space:
mode:
authorTolmachev Igor <me@igorek.dev>2026-05-09 20:47:04 +0300
committerTolmachev Igor <me@igorek.dev>2026-05-09 20:47:04 +0300
commit160b64427d79290a59ac48c9babca064232d8dfd (patch)
tree0c2cc79f0a266761866ff325abdd4f2f0c7e7301 /compiler/src/ast/mod.rs
parent6be28381d6081dfb3a1dc9d1ec15062b67ba1ef9 (diff)
downloadcrisp-dev.tar.gz
crisp-dev.zip
Make project structure more consistentdev
Diffstat (limited to 'compiler/src/ast/mod.rs')
-rw-r--r--compiler/src/ast/mod.rs34
1 files changed, 2 insertions, 32 deletions
diff --git a/compiler/src/ast/mod.rs b/compiler/src/ast/mod.rs
index 8e35baf..2a0be03 100644
--- a/compiler/src/ast/mod.rs
+++ b/compiler/src/ast/mod.rs
@@ -1,40 +1,10 @@
1mod error; 1mod error;
2mod models;
2mod parser; 3mod parser;
3 4
4use std::rc::Rc;
5
6use crate::span::Spanned;
7pub use error::Error; 5pub use error::Error;
6pub use models::{Ast, Atom, Expr};
8pub use parser::Parser; 7pub use parser::Parser;
9 8
10#[cfg(test)] 9#[cfg(test)]
11mod tests; 10mod tests;
12
13#[derive(Clone, Debug, PartialEq)]
14pub enum Atom {
15 Float(f64),
16 Integer(i64),
17 String(Rc<str>),
18 Symbol(Rc<str>),
19 Bool(bool),
20 Nil,
21}
22
23#[derive(Clone, Debug, PartialEq)]
24pub enum Expr {
25 Atom(Atom),
26 List(Vec<Spanned<Expr>>),
27}
28
29#[derive(Clone, Debug, PartialEq)]
30pub struct Program(Vec<Spanned<Expr>>);
31
32impl Program {
33 pub fn inner(&self) -> &[Spanned<Expr>] {
34 &self.0
35 }
36
37 pub fn into_inner(self) -> Vec<Spanned<Expr>> {
38 self.0
39 }
40}