Walking ast

This commit is contained in:
2026-04-15 11:47:36 +02:00
parent cb03653e88
commit 0d63528d10
3 changed files with 63 additions and 10 deletions
+6 -2
View File
@@ -2,6 +2,8 @@ use std::fs;
use std::path::PathBuf;
use std::process;
use semantic::scope::walk_ast;
fn main() {
let args: Vec<String> = std::env::args().collect();
@@ -53,10 +55,12 @@ pub fn cmd_build() {
fn cmd_check(path: &str) {
let source = read_ms_file(path);
match parser::parse(&source) {
Ok(ast) => {
Ok(mut ast) => {
println!("parse: ok");
println!("{:#?}", semantic::scope::Scope::from_top(&ast))
walk_ast(semantic::scope::Scope::from_top(&ast), &mut ast);
println!("{:#?}", ast)
}
Err(e) => {
eprintln!("parse error:\n{}", e);