Add new stage scope-resolution

This commit is contained in:
greg 2019-09-03 01:42:28 -07:00
parent b4da57f5c5
commit 0f7f5cb416
3 changed files with 17 additions and 3 deletions

View File

@ -33,6 +33,7 @@ mod ast;
mod parsing;
#[macro_use]
mod symbol_table;
mod scope_resolution;
mod builtin;
mod reduced_ast;
mod eval;

View File

@ -144,6 +144,11 @@ fn symbol_table(input: ast::AST, handle: &mut Schala, comp: Option<&mut PassDebu
Ok(input)
}
fn scope_resolution(mut input: ast::AST, handle: &mut Schala, com: Option<&mut PassDebugArtifact>) -> Result<ast::AST, String> {
let () = crate::scope_resolution::resolve_scopes(&mut input)?;
Ok(input)
}
fn typechecking(input: ast::AST, handle: &mut Schala, comp: Option<&mut PassDebugArtifact>) -> Result<ast::AST, String> {
let result = handle.type_context.typecheck(&input);
@ -218,6 +223,7 @@ fn stage_names() -> Vec<&'static str> {
"tokenizing",
"parsing",
"symbol-table",
"scope-resolution",
"typechecking",
"ast-reduction",
"ast-walking-evaluation"
@ -285,9 +291,10 @@ impl ProgrammingLanguageInterface for Schala {
.and_then(|source| output_wrapper(0, tokenizing, source, &mut tok))
.and_then(|tokens| output_wrapper(1, parsing, tokens, &mut tok))
.and_then(|ast| output_wrapper(2, symbol_table, ast, &mut tok))
.and_then(|ast| output_wrapper(3, typechecking, ast, &mut tok))
.and_then(|ast| output_wrapper(4, ast_reducing, ast, &mut tok))
.and_then(|reduced_ast| output_wrapper(5, eval, reduced_ast, &mut tok));
.and_then(|ast| output_wrapper(3, scope_resolution, ast, &mut tok))
.and_then(|ast| output_wrapper(4, typechecking, ast, &mut tok))
.and_then(|ast| output_wrapper(5, ast_reducing, ast, &mut tok))
.and_then(|reduced_ast| output_wrapper(6, eval, reduced_ast, &mut tok));
let total_duration = sw.elapsed();
let global_output_stats = GlobalOutputStats {

View File

@ -0,0 +1,6 @@
use crate::ast::*;
pub fn resolve_scopes(ast: &mut AST) -> Result<(), String> {
println!("Resolving scopes - nothing so far!");
Ok(())
}