Split yunq compliation to library and use it in build process.

This commit is contained in:
Drew Galbraith 2024-07-28 18:08:34 -07:00
parent 370ba9ae40
commit 1e073d5060
7 changed files with 89 additions and 28 deletions

View file

@ -1,7 +1,3 @@
mod codegen;
mod lexer;
mod parser;
use std::error::Error;
use std::fs;
@ -22,13 +18,8 @@ struct Args {
fn main() -> Result<(), Box<dyn Error>> {
let args = Args::parse();
let input = fs::read_to_string(args.input_path)?;
let tokens = lexer::lex_input(&input)?;
let mut ast_parser = parser::Parser::new(&tokens);
ast_parser.parse_ast()?;
ast_parser.type_check()?;
let code = codegen::generate_code(ast_parser.ast());
let code = yunqc::codegen(&input)?;
fs::write(args.output_path, code)?;