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::default::Default;
mod language;
pub mod language;
use language::{ProgrammingLanguageInterface, EvalOptions, LLVMCodeString};
mod webapp;
mod llvm_wrap;
pub mod llvm_wrap;
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 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 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>;

View File

@ -3,7 +3,7 @@ pub mod parser;
pub mod eval;
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;

View File

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

View File

@ -29,6 +29,7 @@ mod robo_lang;
extern crate schala_lib;
use schala_lib::{PLIGenerator, schala_main};
use schala_lib::language::ProgrammingLanguageInterface;
#[link_args="-ltinfo"]
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(robo_lang::Robo::new()); x }),
];
schala_main(generators);
}

View File

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

View File

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