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};
|
use parser::{ParseResult, AST, ASTNode, Prototype, Function, Expression};
|
||||||
|
|
||||||
|
pub fn compile_ast(ast: AST) {
|
||||||
|
println!("Compiling!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
pub struct Context {
|
pub struct Context {
|
||||||
context: core::Context,
|
context: core::Context,
|
||||||
builder: core::Builder,
|
builder: core::Builder,
|
||||||
@ -117,5 +123,4 @@ impl IRBuilder for Expression {
|
|||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
16
src/main.rs
16
src/main.rs
@ -17,6 +17,8 @@ mod parser;
|
|||||||
use eval::{Evaluator};
|
use eval::{Evaluator};
|
||||||
mod eval;
|
mod eval;
|
||||||
|
|
||||||
|
use compilation::{compile_ast};
|
||||||
|
mod compilation;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Vec<String> = std::env::args().collect();
|
let args: Vec<String> = std::env::args().collect();
|
||||||
@ -42,10 +44,16 @@ fn run_noninteractive(filename: &String) {
|
|||||||
Err(err) => { println!("Parse error: {:?}", err); return; }
|
Err(err) => { println!("Parse error: {:?}", err); return; }
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut evaluator = Evaluator::new();
|
let compile = true;
|
||||||
let results = evaluator.run(ast);
|
|
||||||
for result in results.iter() {
|
if compile {
|
||||||
println!("{}", result);
|
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