Add a lot of new stuff to the compile mod

* compile::sym is now compile::name
* add basic block structure
* add visitor pattern
* some other minor things (e.g. syn::ast::prelude)

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-05-19 15:26:38 -04:00
parent c0833086b6
commit 8dc89f7153
9 changed files with 316 additions and 31 deletions

View File

@@ -40,6 +40,17 @@ fn main() -> Result<()> {
let opt = Options::from_args();
let text = fs::read_to_string(&opt.input)?;
let mut parser = Parser::try_from(text.as_str())?;
println!("{:#?}", parser.next_body()?);
let ast = parser.next_body()?;
//println!("{:#?}", ast);
let mut ctx = compile::Ctx::new(text.as_str());
ctx.name_stack_mut().push_default();
{
let mut collect_names = compile::name::CollectNames::new(&mut ctx);
collect_names.collect(&ast);
}
let names = ctx.name_stack_mut().pop().unwrap();
println!("{:#?}", names);
Ok(())
}