Add new stage scope-resolution
This commit is contained in:
parent
b4da57f5c5
commit
0f7f5cb416
@ -33,6 +33,7 @@ mod ast;
|
|||||||
mod parsing;
|
mod parsing;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod symbol_table;
|
mod symbol_table;
|
||||||
|
mod scope_resolution;
|
||||||
mod builtin;
|
mod builtin;
|
||||||
mod reduced_ast;
|
mod reduced_ast;
|
||||||
mod eval;
|
mod eval;
|
||||||
|
@ -144,6 +144,11 @@ fn symbol_table(input: ast::AST, handle: &mut Schala, comp: Option<&mut PassDebu
|
|||||||
Ok(input)
|
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> {
|
fn typechecking(input: ast::AST, handle: &mut Schala, comp: Option<&mut PassDebugArtifact>) -> Result<ast::AST, String> {
|
||||||
let result = handle.type_context.typecheck(&input);
|
let result = handle.type_context.typecheck(&input);
|
||||||
|
|
||||||
@ -218,6 +223,7 @@ fn stage_names() -> Vec<&'static str> {
|
|||||||
"tokenizing",
|
"tokenizing",
|
||||||
"parsing",
|
"parsing",
|
||||||
"symbol-table",
|
"symbol-table",
|
||||||
|
"scope-resolution",
|
||||||
"typechecking",
|
"typechecking",
|
||||||
"ast-reduction",
|
"ast-reduction",
|
||||||
"ast-walking-evaluation"
|
"ast-walking-evaluation"
|
||||||
@ -285,9 +291,10 @@ impl ProgrammingLanguageInterface for Schala {
|
|||||||
.and_then(|source| output_wrapper(0, tokenizing, source, &mut tok))
|
.and_then(|source| output_wrapper(0, tokenizing, source, &mut tok))
|
||||||
.and_then(|tokens| output_wrapper(1, parsing, tokens, &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(2, symbol_table, ast, &mut tok))
|
||||||
.and_then(|ast| output_wrapper(3, typechecking, ast, &mut tok))
|
.and_then(|ast| output_wrapper(3, scope_resolution, ast, &mut tok))
|
||||||
.and_then(|ast| output_wrapper(4, ast_reducing, ast, &mut tok))
|
.and_then(|ast| output_wrapper(4, typechecking, ast, &mut tok))
|
||||||
.and_then(|reduced_ast| output_wrapper(5, eval, reduced_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 total_duration = sw.elapsed();
|
||||||
let global_output_stats = GlobalOutputStats {
|
let global_output_stats = GlobalOutputStats {
|
||||||
|
6
schala-lang/language/src/scope_resolution.rs
Normal file
6
schala-lang/language/src/scope_resolution.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
use crate::ast::*;
|
||||||
|
|
||||||
|
pub fn resolve_scopes(ast: &mut AST) -> Result<(), String> {
|
||||||
|
println!("Resolving scopes - nothing so far!");
|
||||||
|
Ok(())
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user