Debug ast rewrite
This commit is contained in:
parent
d7e3f695b7
commit
e6f0710e41
@ -72,6 +72,12 @@ impl Expression {
|
||||
&BinExp(ref binop, ref lhs, ref rhs) => binop.reduce(lhs, rhs),
|
||||
&PrefixExp(ref op, ref arg) => op.reduce(arg),
|
||||
&Value(ref name) => Expr::Val(name.clone()),
|
||||
/*
|
||||
&Call { ref f, ref arguments } => Expr::Call {
|
||||
f: Box<Expression>,
|
||||
arguments: Vec<Expression>,
|
||||
},
|
||||
*/
|
||||
e => Expr::UnimplementedSigilValue,
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ fn typechecking(handle: &mut Schala, input: parsing::AST, comp: Option<&mut Unfi
|
||||
type TempASTReduction = (ast_reducing::ReducedAST, parsing::AST);
|
||||
fn ast_reducing(handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result<TempASTReduction, String> {
|
||||
let output = input.reduce();
|
||||
comp.map(|comp| comp.add_artifact(TraceArtifact::new("ast_reducing", format!("{:?}", output))));
|
||||
Ok((output, input))
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,7 @@ impl TraceArtifact {
|
||||
pub fn new(stage: &str, debug: String) -> TraceArtifact {
|
||||
let color = match stage {
|
||||
"parse_trace" | "ast" => "red",
|
||||
"ast_reducing" => "red",
|
||||
"tokens" => "green",
|
||||
"type_check" => "magenta",
|
||||
_ => "blue",
|
||||
|
Loading…
Reference in New Issue
Block a user