diff options
Diffstat (limited to 'src/type/mod.rs')
-rw-r--r-- | src/type/mod.rs | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/type/mod.rs b/src/type/mod.rs index 623edc9..12d1132 100644 --- a/src/type/mod.rs +++ b/src/type/mod.rs @@ -1,34 +1,43 @@ -use crate::sexp::{SExp, SExp::*}; +pub mod util; +pub mod display; +pub mod check; + + +use crate::sexp::SExp; + + +#[derive(Debug,PartialEq)] pub enum Type { + Integer, + Arrow(Box<Type>, Box<Type>), + + List(Vec<Type>), + + UndefinedType, // only for errors + } + +#[derive(Debug,PartialEq)] pub enum TypeError { + UndefinedVariable(String), + InvalidOperator { operator: SExp, expected: Type, found: Type, }, + InvalidArgList { arglist: SExp, expected: Type, found: Type, }, - OtherError -} -impl SExp { - /// ```rust - /// use melisp::{ - /// r#type::{*, Type::*, TypeError::*}, - /// sexp::{SExp::*, SLeaf::*, util::*}, - /// }; - /// ``` - pub fn type_check(&self) -> Result<Type, TypeError> { - todo!() - } + OtherError } |