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!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@ -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,12 +44,18 @@ fn run_noninteractive(filename: &String) {
|
|||||||
Err(err) => { println!("Parse error: {:?}", err); return; }
|
Err(err) => { println!("Parse error: {:?}", err); return; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let compile = true;
|
||||||
|
|
||||||
|
if compile {
|
||||||
|
compile_ast(ast);
|
||||||
|
} else {
|
||||||
let mut evaluator = Evaluator::new();
|
let mut evaluator = Evaluator::new();
|
||||||
let results = evaluator.run(ast);
|
let results = evaluator.run(ast);
|
||||||
for result in results.iter() {
|
for result in results.iter() {
|
||||||
println!("{}", result);
|
println!("{}", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn run_repl() {
|
fn run_repl() {
|
||||||
println!("Schala v 0.02");
|
println!("Schala v 0.02");
|
||||||
|
Loading…
Reference in New Issue
Block a user