From 0f7f5cb416069a3e97d542a25697beb711d01867 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 3 Sep 2019 01:42:28 -0700 Subject: [PATCH] Add new stage scope-resolution --- schala-lang/language/src/lib.rs | 1 + schala-lang/language/src/schala.rs | 13 ++++++++++--- schala-lang/language/src/scope_resolution.rs | 6 ++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 schala-lang/language/src/scope_resolution.rs diff --git a/schala-lang/language/src/lib.rs b/schala-lang/language/src/lib.rs index 34b39ff..554d99e 100644 --- a/schala-lang/language/src/lib.rs +++ b/schala-lang/language/src/lib.rs @@ -33,6 +33,7 @@ mod ast; mod parsing; #[macro_use] mod symbol_table; +mod scope_resolution; mod builtin; mod reduced_ast; mod eval; diff --git a/schala-lang/language/src/schala.rs b/schala-lang/language/src/schala.rs index d8a8478..6dc3747 100644 --- a/schala-lang/language/src/schala.rs +++ b/schala-lang/language/src/schala.rs @@ -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 { + let () = crate::scope_resolution::resolve_scopes(&mut input)?; + Ok(input) +} + fn typechecking(input: ast::AST, handle: &mut Schala, comp: Option<&mut PassDebugArtifact>) -> Result { 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 { diff --git a/schala-lang/language/src/scope_resolution.rs b/schala-lang/language/src/scope_resolution.rs new file mode 100644 index 0000000..df0ed49 --- /dev/null +++ b/schala-lang/language/src/scope_resolution.rs @@ -0,0 +1,6 @@ +use crate::ast::*; + +pub fn resolve_scopes(ast: &mut AST) -> Result<(), String> { + println!("Resolving scopes - nothing so far!"); + Ok(()) +}