diff --git a/parser/src/lib.rs b/parser/src/lib.rs index d30e056..81cfb67 100644 --- a/parser/src/lib.rs +++ b/parser/src/lib.rs @@ -167,8 +167,6 @@ impl Statement { let kind_pair = inner.next().unwrap(); // let/const/var let name_pair = inner.next().unwrap(); // identifier - println!("{:#?}", inner); - let init = inner.next().map(Expression::from_pair); let kind = match kind_pair.as_str() { diff --git a/src/main.rs b/src/main.rs index dec07c7..a9e6d3a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -72,15 +72,15 @@ fn cmd_check(path: &str) { fn cmd_parse(path: &str) { let source = read_ms_file(path); match parser::parse(&source) { - Ok(output) => { - fs::write( - "output.json", - serde_json::to_string_pretty(&output).unwrap(), - ) - .unwrap_or_else(|e| { - eprintln!("error: could not write output.json: {}", e); - process::exit(1); - }); + Ok(mut ast) => { + walk_ast(semantic::scope::Scope::from_top(&ast), &mut ast); + + fs::write("output.json", serde_json::to_string_pretty(&ast).unwrap()).unwrap_or_else( + |e| { + eprintln!("error: could not write output.json: {}", e); + process::exit(1); + }, + ); } Err(e) => { eprintln!("parse error:\n{}", e); diff --git a/test/src/main.ms b/test/src/main.ms index 5b271de..d53a617 100644 --- a/test/src/main.ms +++ b/test/src/main.ms @@ -1,9 +1,5 @@ -struct Test { - x: int -} +function test(): int { } function add() { let output = test(); } - -function test(): int { } \ No newline at end of file