From e0f9b2262d225300b42080cbe6c4c2e97d67a8d9 Mon Sep 17 00:00:00 2001 From: Matthew Plant Date: Tue, 24 Dec 2024 21:05:09 -0500 Subject: [PATCH] Remove backup file --- src/ast/mod.rs~ | 226 ------------------------------------------------ 1 file changed, 226 deletions(-) delete mode 100644 src/ast/mod.rs~ diff --git a/src/ast/mod.rs~ b/src/ast/mod.rs~ deleted file mode 100644 index 3ba1f32..0000000 --- a/src/ast/mod.rs~ +++ /dev/null @@ -1,226 +0,0 @@ -use crate::{ - continuation::Continuation, env::Env, error::RuntimeError, proc::ValuesOrPreparedCall, expand::Transformer, gc::{Gc, Trace}, num::Number, syntax::{Identifier, Mark, Span, Syntax}, util::ArcSlice, value::Value -}; -use std::sync::Arc; - -pub enum AstNode { - Definition(Definition), - Expression(Expression), -} - -impl AstNode { - async fn eval(&self, cont: &Option>) -> Result>, RuntimeError> { - match self { - Self::Definition(def) => todo!(), - Self::Expression(expr) => expr.eval(cont).await, - } - } -} - -#[derive(Debug, Clone, Trace)] -pub enum Definition { - DefineVar(DefineVar), - DefineFunc(DefineFunc), -} - -#[derive(Debug, Clone, Trace)] -pub struct DefineVar { - pub name: Identifier, - pub val: Arc, -} - -#[derive(Debug, Clone, Trace)] -pub struct DefineFunc { - pub name: Identifier, - pub args: Formals, - pub body: Body, -} - -#[derive(Debug, Clone, Trace)] -pub struct DefineSyntax { - pub name: Identifier, - pub expr: Arc -} - -#[derive(Debug, Clone, Trace)] -pub enum Expression { - Literal(Literal), - Quote(Quote), - SyntaxQuote(SyntaxQuote), - Call(Call), - Lambda(Lambda), - Set(Set), - MacroExpansionPoint(MacroExpansionPoint), -} - -impl Expression { - async fn eval(&self, cont: &Option>) -> Result>, RuntimeError> { - match self { - _ => todo!(), - } - } - - async fn tail_eval(&self, cont: &Option>) -> Result { - todo!() - } -} - -#[derive(Debug, Clone, PartialEq, Trace)] -pub enum Literal { - Number(Number), - Boolean(bool), - Character(char), - String(String), - ByteVector(Vec), -} - -#[derive(Debug, Clone, Trace)] -pub struct Quote { - pub val: Value, -} - -#[derive(Debug, Clone, Trace)] -pub struct SyntaxQuote { - pub syn: Syntax, - pub env: Env, -} - -#[derive(Debug, Clone, Trace)] -pub struct Call { - pub args: ArcSlice>, - pub location: Span, - pub proc_name: String, -} - -#[derive(Debug, Clone, Trace)] -pub struct Lambda { - pub args: Formals, - pub body: Body, -} - -#[derive(Debug, Clone, Trace)] -pub struct Let { - pub bindings: Arc<[(Identifier, Arc)]>, - pub body: Body, -} - -impl Let { - pub fn new(bindings: Vec<(Identifier, Arc)>, body: Body) -> Self { - Self { - bindings: Arc::from(bindings), - body, - } - } -} - -#[derive(Debug, Clone, Trace)] -pub struct Set { - pub var: Identifier, - pub val: Arc, -} - -#[derive(Debug, Clone, Trace)] -pub struct If { - pub cond: Arc, - pub success: Arc, - pub failure: Option>, -} - -#[derive(Debug, Clone, Trace)] -pub enum Formals { - FixedArgs(Vec), - VarArgs { - fixed: Vec, - remaining: Identifier, - }, -} - -impl Formals { - pub fn to_args_and_remaining(&self) -> (Vec, Option) { - match self { - Self::VarArgs { fixed, remaining } => (fixed.clone(), Some(remaining.clone())), - Self::FixedArgs(args) => (args.clone(), None), - } - } -} - -#[derive(Debug, Clone, Trace)] -pub struct Body { - pub defs: ArcSlice>, - pub exprs: ArcSlice>, -} - -impl Body { - pub fn new(defs: Vec>, exprs: Vec>) -> Self { - Self { - defs: ArcSlice::from(defs), - exprs: ArcSlice::from(exprs), - } - } -} - - -#[derive(Clone, Trace)] -pub struct And { - pub args: ArcSlice>, -} - -impl And { - pub fn new(args: Vec>) -> Self { - Self { - args: ArcSlice::from(args), - } - } -} - -#[derive(Clone, Trace)] -pub struct Or { - pub args: ArcSlice>, -} - -impl Or { - pub fn new(args: Vec>) -> Self { - Self { - args: ArcSlice::from(args), - } - } -} - -#[derive(Clone, Trace)] -pub struct Vector { - pub vals: Vec, -} - -#[derive(Clone, Trace)] -pub struct SyntaxCase { - pub arg: Arc, - pub transformer: Transformer, -} - -#[derive(Clone, Trace)] -pub struct Var { - pub ident: Identifier, -} - -impl Var { - pub fn new(ident: Identifier) -> Self { - Self { ident } - } -} - -#[derive(Debug, Clone, Trace)] -pub struct MacroExpansionPoint { - pub mark: Mark, - pub macro_env: Env, - pub expr: Arc, -} - -impl MacroExpansionPoint { - pub fn new(mark: Mark, macro_env: Env, expr: Arc) -> Self { - Self { - mark, - macro_env, - expr, - } - } -}