Typechecking infrastructure
This commit is contained in:
parent
836bed1207
commit
15f9dbe7a6
@ -43,6 +43,7 @@ mod eval;
|
||||
pub struct Schala {
|
||||
state: eval::State<'static>,
|
||||
symbol_table: Rc<RefCell<symbol_table::SymbolTable>>,
|
||||
type_context: typechecking::TypeContext,
|
||||
active_parser: Option<parsing::Parser>,
|
||||
}
|
||||
|
||||
@ -62,6 +63,7 @@ impl Schala {
|
||||
Schala {
|
||||
symbol_table: symbols.clone(),
|
||||
state: eval::State::new(symbols),
|
||||
type_context: typechecking::TypeContext::new(),
|
||||
active_parser: None,
|
||||
}
|
||||
}
|
||||
@ -126,8 +128,9 @@ fn symbol_table(handle: &mut Schala, input: ast::AST, comp: Option<&mut Unfinish
|
||||
}
|
||||
}
|
||||
|
||||
fn typechecking(_handle: &mut Schala, input: ast::AST, _comp: Option<&mut UnfinishedComputation>) -> Result<ast::AST, String> {
|
||||
Ok(input)
|
||||
fn typechecking(handle: &mut Schala, input: ast::AST, _comp: Option<&mut UnfinishedComputation>) -> Result<ast::AST, String> {
|
||||
|
||||
handle.type_context.typecheck(&input).map(|_| input)
|
||||
}
|
||||
|
||||
fn ast_reducing(handle: &mut Schala, input: ast::AST, comp: Option<&mut UnfinishedComputation>) -> Result<reduced_ast::ReducedAST, String> {
|
||||
|
@ -1,3 +1,19 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use ast::AST;
|
||||
|
||||
pub type TypeName = Rc<String>;
|
||||
|
||||
pub struct TypeContext {
|
||||
|
||||
}
|
||||
|
||||
impl TypeContext {
|
||||
pub fn new() -> TypeContext {
|
||||
TypeContext { }
|
||||
}
|
||||
|
||||
pub fn typecheck(&mut self, _ast: &AST) -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user