From 160b64427d79290a59ac48c9babca064232d8dfd Mon Sep 17 00:00:00 2001 From: Tolmachev Igor Date: Sat, 9 May 2026 20:47:04 +0300 Subject: Make project structure more consistent --- compiler/src/ast/models.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 compiler/src/ast/models.rs (limited to 'compiler/src/ast/models.rs') diff --git a/compiler/src/ast/models.rs b/compiler/src/ast/models.rs new file mode 100644 index 0000000..db9728d --- /dev/null +++ b/compiler/src/ast/models.rs @@ -0,0 +1,36 @@ +use std::rc::Rc; + +use crate::span::Spanned; + +#[derive(Clone, Debug, PartialEq)] +pub enum Atom { + Float(f64), + Integer(i64), + String(Rc), + Symbol(Rc), + Bool(bool), + Nil, +} + +#[derive(Clone, Debug, PartialEq)] +pub enum Expr { + Atom(Atom), + List(Vec>), +} + +#[derive(Clone, Debug, PartialEq)] +pub struct Ast(Vec>); + +impl Ast { + pub fn new(ast: Vec>) -> Self { + Self(ast) + } + + pub fn inner(&self) -> &[Spanned] { + &self.0 + } + + pub fn into_inner(self) -> Vec> { + self.0 + } +} -- cgit v1.3