From 78a250bcba6ff1e85e03b6ad383be0f84cf55dae Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 20 Mar 2018 23:29:56 -0700 Subject: [PATCH] Move maaru into separate crate --- Cargo.toml | 1 + maaru/Cargo.toml | 11 +++++++++++ {src/maaru_lang => maaru/src}/compilation.rs | 2 +- {src/maaru_lang => maaru/src}/eval.rs | 6 +++--- src/maaru_lang/mod.rs => maaru/src/lib.rs | 12 ++++++++---- {src/maaru_lang => maaru/src}/parser.rs | 4 ++-- {src/maaru_lang => maaru/src}/tokenizer.rs | 2 +- src/main.rs | 3 ++- 8 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 maaru/Cargo.toml rename {src/maaru_lang => maaru/src}/compilation.rs (99%) rename {src/maaru_lang => maaru/src}/eval.rs (99%) rename src/maaru_lang/mod.rs => maaru/src/lib.rs (95%) rename {src/maaru_lang => maaru/src}/parser.rs (99%) rename {src/maaru_lang => maaru/src}/tokenizer.rs (99%) diff --git a/Cargo.toml b/Cargo.toml index 43b81bd..43164c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ maplit = "*" colored = "1.5" schala-repl = { path = "schala-repl" } +maaru-lang = { path = "maaru" } [build-dependencies] includedir_codegen = "0.2.0" diff --git a/maaru/Cargo.toml b/maaru/Cargo.toml new file mode 100644 index 0000000..88e2322 --- /dev/null +++ b/maaru/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "maaru-lang" +version = "0.1.0" +authors = ["greg "] + +[dependencies] +itertools = "0.5.8" +take_mut = "0.1.3" +llvm-sys = "*" + +schala-repl = { path = "../schala-repl" } diff --git a/src/maaru_lang/compilation.rs b/maaru/src/compilation.rs similarity index 99% rename from src/maaru_lang/compilation.rs rename to maaru/src/compilation.rs index 6af6dc1..cabee7e 100644 --- a/src/maaru_lang/compilation.rs +++ b/maaru/src/compilation.rs @@ -5,7 +5,7 @@ use std::collections::HashMap; use self::llvm_sys::prelude::*; use self::llvm_sys::{LLVMIntPredicate}; -use maaru_lang::parser::{AST, Statement, Function, Prototype, Expression, BinOp}; +use parser::{AST, Statement, Function, Prototype, Expression, BinOp}; use schala_repl::LLVMCodeString; use schala_repl::llvm_wrap as LLVMWrap; diff --git a/src/maaru_lang/eval.rs b/maaru/src/eval.rs similarity index 99% rename from src/maaru_lang/eval.rs rename to maaru/src/eval.rs index db17e98..1bd71dc 100644 --- a/src/maaru_lang/eval.rs +++ b/maaru/src/eval.rs @@ -2,13 +2,13 @@ extern crate take_mut; use std::collections::HashMap; use std::collections::VecDeque; -use maaru_lang::parser::{AST, Statement, Expression, Function, Callable, BinOp}; +use parser::{AST, Statement, Expression, Function, Callable, BinOp}; use std::rc::Rc; use std::io::{Write, Stdout, BufWriter}; use std::convert::From; -use maaru_lang::parser::Expression::*; -use maaru_lang::parser::Statement::*; +use parser::Expression::*; +use parser::Statement::*; type Reduction = (T, Option); diff --git a/src/maaru_lang/mod.rs b/maaru/src/lib.rs similarity index 95% rename from src/maaru_lang/mod.rs rename to maaru/src/lib.rs index a0ecdb9..75192fb 100644 --- a/src/maaru_lang/mod.rs +++ b/maaru/src/lib.rs @@ -1,7 +1,11 @@ -pub mod tokenizer; -pub mod parser; -pub mod eval; -pub mod compilation; +#![feature(box_patterns)] + +extern crate schala_repl; + +mod tokenizer; +mod parser; +mod eval; +mod compilation; use schala_repl::{ProgrammingLanguageInterface, EvalOptions, LanguageOutput, TraceArtifact}; diff --git a/src/maaru_lang/parser.rs b/maaru/src/parser.rs similarity index 99% rename from src/maaru_lang/parser.rs rename to maaru/src/parser.rs index 74f5987..ff5cbd8 100644 --- a/src/maaru_lang/parser.rs +++ b/maaru/src/parser.rs @@ -1,5 +1,5 @@ -use maaru_lang::tokenizer::{Token, Kw, OpTok}; -use maaru_lang::tokenizer::Token::*; +use tokenizer::{Token, Kw, OpTok}; +use tokenizer::Token::*; use std::fmt; use std::collections::VecDeque; diff --git a/src/maaru_lang/tokenizer.rs b/maaru/src/tokenizer.rs similarity index 99% rename from src/maaru_lang/tokenizer.rs rename to maaru/src/tokenizer.rs index 1031add..a56e078 100644 --- a/src/maaru_lang/tokenizer.rs +++ b/maaru/src/tokenizer.rs @@ -5,7 +5,7 @@ use std::str::Chars; use self::itertools::Itertools; use std::rc::Rc; -use maaru_lang::TokenError; +use TokenError; #[derive(Debug, Clone, PartialEq)] pub enum Token { diff --git a/src/main.rs b/src/main.rs index 44499e8..f26bac1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,8 +6,9 @@ extern crate lazy_static; #[macro_use] extern crate maplit; +extern crate maaru_lang; + mod schala_lang; -mod maaru_lang; mod robo_lang; mod rukka_lang;