Refactor into libs part II

woo it compiles
This commit is contained in:
greg 2017-10-30 22:18:02 -07:00
parent 4c7174e4c4
commit c4dbdf1fe7
7 changed files with 11 additions and 12 deletions

View File

@ -23,16 +23,16 @@ use std::io::{Read, Write};
use std::process::exit; use std::process::exit;
use std::default::Default; use std::default::Default;
mod language; pub mod language;
use language::{ProgrammingLanguageInterface, EvalOptions, LLVMCodeString}; use language::{ProgrammingLanguageInterface, EvalOptions, LLVMCodeString};
mod webapp; mod webapp;
mod llvm_wrap; pub mod llvm_wrap;
include!(concat!(env!("OUT_DIR"), "/static.rs")); include!(concat!(env!("OUT_DIR"), "/static.rs"));
type PLIGenerator = Box<Fn() -> Box<ProgrammingLanguageInterface> + Send + Sync>; pub type PLIGenerator = Box<Fn() -> Box<ProgrammingLanguageInterface> + Send + Sync>;
fn schala_main(generators: Vec<PLIGenerator>) { pub fn schala_main(generators: Vec<PLIGenerator>) {
let languages: Vec<Box<ProgrammingLanguageInterface>> = generators.iter().map(|x| x()).collect(); let languages: Vec<Box<ProgrammingLanguageInterface>> = generators.iter().map(|x| x()).collect();
let option_matches = program_options().parse(std::env::args()).unwrap_or_else(|e| { let option_matches = program_options().parse(std::env::args()).unwrap_or_else(|e| {

View File

@ -6,9 +6,9 @@ use self::llvm_sys::prelude::*;
use self::llvm_sys::{LLVMIntPredicate}; use self::llvm_sys::{LLVMIntPredicate};
use maaru_lang::parser::{AST, Statement, Function, Prototype, Expression, BinOp}; use maaru_lang::parser::{AST, Statement, Function, Prototype, Expression, BinOp};
use language::LLVMCodeString; use schala_lib::language::LLVMCodeString;
use llvm_wrap as LLVMWrap; use schala_lib::llvm_wrap as LLVMWrap;
type VariableMap = HashMap<String, LLVMValueRef>; type VariableMap = HashMap<String, LLVMValueRef>;

View File

@ -3,7 +3,7 @@ pub mod parser;
pub mod eval; pub mod eval;
pub mod compilation; pub mod compilation;
use language::{ProgrammingLanguageInterface, EvalOptions, ReplOutput, TraceArtifact, LLVMCodeString}; use schala_lib::language::{ProgrammingLanguageInterface, EvalOptions, ReplOutput, TraceArtifact, LLVMCodeString};
pub use self::eval::Evaluator as MaaruEvaluator; pub use self::eval::Evaluator as MaaruEvaluator;

View File

@ -5,7 +5,7 @@ use std::str::Chars;
use self::itertools::Itertools; use self::itertools::Itertools;
use std::rc::Rc; use std::rc::Rc;
use language::TokenError; use schala_lib::language::TokenError;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Token { pub enum Token {

View File

@ -29,6 +29,7 @@ mod robo_lang;
extern crate schala_lib; extern crate schala_lib;
use schala_lib::{PLIGenerator, schala_main}; use schala_lib::{PLIGenerator, schala_main};
use schala_lib::language::ProgrammingLanguageInterface;
#[link_args="-ltinfo"] #[link_args="-ltinfo"]
extern { } extern { }
@ -39,8 +40,6 @@ fn main() {
Box::new(|| { let x: Box<ProgrammingLanguageInterface> = Box::new(maaru_lang::Maaru::new()); x }), Box::new(|| { let x: Box<ProgrammingLanguageInterface> = Box::new(maaru_lang::Maaru::new()); x }),
Box::new(|| { let x: Box<ProgrammingLanguageInterface> = Box::new(robo_lang::Robo::new()); x }), Box::new(|| { let x: Box<ProgrammingLanguageInterface> = Box::new(robo_lang::Robo::new()); x }),
]; ];
schala_main(generators); schala_main(generators);
} }

View File

@ -1,6 +1,6 @@
use itertools::Itertools; use itertools::Itertools;
use language::{ProgrammingLanguageInterface, EvalOptions, ReplOutput, TokenError}; use schala_lib::language::{ProgrammingLanguageInterface, EvalOptions, ReplOutput, TokenError};
pub struct Robo { pub struct Robo {
} }

View File

@ -1,5 +1,5 @@
use itertools::Itertools; use itertools::Itertools;
use language::{ProgrammingLanguageInterface, EvalOptions, TraceArtifact, ReplOutput}; use schala_lib::language::{ProgrammingLanguageInterface, EvalOptions, TraceArtifact, ReplOutput};
mod parsing; mod parsing;
mod type_check; mod type_check;