diff options
Diffstat (limited to 'src/type/mod.rs')
-rw-r--r-- | src/type/mod.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/type/mod.rs b/src/type/mod.rs new file mode 100644 index 0000000..623edc9 --- /dev/null +++ b/src/type/mod.rs @@ -0,0 +1,34 @@ + +use crate::sexp::{SExp, SExp::*}; + +pub enum Type { + Integer, + Arrow(Box<Type>, Box<Type>), +} + +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!() + } +} |