Framework for compilation
This commit is contained in:
parent
cd69ebaa9d
commit
6c44d295db
@ -10,6 +10,12 @@ use self::iron_llvm::{LLVMRef, LLVMRefCtor};
|
||||
|
||||
use parser::{ParseResult, AST, ASTNode, Prototype, Function, Expression};
|
||||
|
||||
pub fn compile_ast(ast: AST) {
|
||||
println!("Compiling!");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
pub struct Context {
|
||||
context: core::Context,
|
||||
builder: core::Builder,
|
||||
@ -117,5 +123,4 @@ impl IRBuilder for Expression {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
16
src/main.rs
16
src/main.rs
@ -17,6 +17,8 @@ mod parser;
|
||||
use eval::{Evaluator};
|
||||
mod eval;
|
||||
|
||||
use compilation::{compile_ast};
|
||||
mod compilation;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
@ -42,10 +44,16 @@ fn run_noninteractive(filename: &String) {
|
||||
Err(err) => { println!("Parse error: {:?}", err); return; }
|
||||
};
|
||||
|
||||
let mut evaluator = Evaluator::new();
|
||||
let results = evaluator.run(ast);
|
||||
for result in results.iter() {
|
||||
println!("{}", result);
|
||||
let compile = true;
|
||||
|
||||
if compile {
|
||||
compile_ast(ast);
|
||||
} else {
|
||||
let mut evaluator = Evaluator::new();
|
||||
let results = evaluator.run(ast);
|
||||
for result in results.iter() {
|
||||
println!("{}", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user