From 6f43c3b81da261d4405277ef6b6d6747a1a5e02c Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 23 Mar 2018 18:43:43 -0700 Subject: [PATCH] move schala into separate crate --- Cargo.toml | 1 + schala-lang/Cargo.toml | 12 ++++++++++++ {src/schala_lang => schala-lang/src}/builtin.rs | 2 +- {src/schala_lang => schala-lang/src}/eval.rs | 4 ++-- src/schala_lang/mod.rs => schala-lang/src/lib.rs | 9 +++++++++ {src/schala_lang => schala-lang/src}/parsing.rs | 8 ++++---- {src/schala_lang => schala-lang/src}/tokenizing.rs | 0 {src/schala_lang => schala-lang/src}/type_check.rs | 2 +- {src/schala_lang => schala-lang/src}/typechecking.rs | 2 +- src/main.rs | 7 +++---- 10 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 schala-lang/Cargo.toml rename {src/schala_lang => schala-lang/src}/builtin.rs (97%) rename {src/schala_lang => schala-lang/src}/eval.rs (98%) rename src/schala_lang/mod.rs => schala-lang/src/lib.rs (92%) rename {src/schala_lang => schala-lang/src}/parsing.rs (99%) rename {src/schala_lang => schala-lang/src}/tokenizing.rs (100%) rename {src/schala_lang => schala-lang/src}/type_check.rs (98%) rename {src/schala_lang => schala-lang/src}/typechecking.rs (99%) diff --git a/Cargo.toml b/Cargo.toml index 902a1cb..026c0b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ schala-repl = { path = "schala-repl" } maaru-lang = { path = "maaru" } rukka-lang = { path = "rukka" } robo-lang = { path = "robo" } +schala-lang = { path = "schala-lang" } [build-dependencies] includedir_codegen = "0.2.0" diff --git a/schala-lang/Cargo.toml b/schala-lang/Cargo.toml new file mode 100644 index 0000000..622a126 --- /dev/null +++ b/schala-lang/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "schala-lang" +version = "0.1.0" +authors = ["greg "] + +[dependencies] +itertools = "0.5.8" +take_mut = "0.1.3" +maplit = "*" +lazy_static = "0.2.8" + +schala-repl = { path = "../schala-repl" } diff --git a/src/schala_lang/builtin.rs b/schala-lang/src/builtin.rs similarity index 97% rename from src/schala_lang/builtin.rs rename to schala-lang/src/builtin.rs index 52b15b0..e78eb7f 100644 --- a/src/schala_lang/builtin.rs +++ b/schala-lang/src/builtin.rs @@ -1,7 +1,7 @@ use std::rc::Rc; use std::collections::HashMap; -use schala_lang::typechecking::{Type, TypeResult, TConst}; +use typechecking::{Type, TypeResult, TConst}; use self::Type::*; use self::TConst::*; #[derive(Debug, PartialEq, Clone)] diff --git a/src/schala_lang/eval.rs b/schala-lang/src/eval.rs similarity index 98% rename from src/schala_lang/eval.rs rename to schala-lang/src/eval.rs index ec1061b..44bcca0 100644 --- a/src/schala_lang/eval.rs +++ b/schala-lang/src/eval.rs @@ -4,8 +4,8 @@ use std::fmt::Write; use itertools::Itertools; -use schala_lang::parsing::{AST, Statement, Declaration, Expression, Variant, ExpressionType}; -use schala_lang::builtin::{BinOp, PrefixOp}; +use parsing::{AST, Statement, Declaration, Expression, Variant, ExpressionType}; +use builtin::{BinOp, PrefixOp}; pub struct State<'a> { parent_frame: Option<&'a State<'a>>, diff --git a/src/schala_lang/mod.rs b/schala-lang/src/lib.rs similarity index 92% rename from src/schala_lang/mod.rs rename to schala-lang/src/lib.rs index 238250f..c28e93a 100644 --- a/src/schala_lang/mod.rs +++ b/schala-lang/src/lib.rs @@ -1,3 +1,12 @@ +#![feature(advanced_slice_patterns, slice_patterns, box_patterns, box_syntax)] +extern crate itertools; +#[macro_use] +extern crate lazy_static; +#[macro_use] +extern crate maplit; + +extern crate schala_repl; + use itertools::Itertools; use schala_repl::{ProgrammingLanguageInterface, EvalOptions, TraceArtifact, UnfinishedComputation, FinishedComputation}; diff --git a/src/schala_lang/parsing.rs b/schala-lang/src/parsing.rs similarity index 99% rename from src/schala_lang/parsing.rs rename to schala-lang/src/parsing.rs index 6c28a1c..f5f08e9 100644 --- a/src/schala_lang/parsing.rs +++ b/schala-lang/src/parsing.rs @@ -2,11 +2,11 @@ use std::rc::Rc; use std::iter::Peekable; use std::vec::IntoIter; -use schala_lang::tokenizing::*; -use schala_lang::tokenizing::Kw::*; -use schala_lang::tokenizing::TokenType::*; +use tokenizing::*; +use tokenizing::Kw::*; +use tokenizing::TokenType::*; -use schala_lang::builtin::{BinOp, PrefixOp}; +use builtin::{BinOp, PrefixOp}; /* Schala EBNF Grammar */ /* Terminal productions are in 'single quotes' or UPPERCASE if they are a class diff --git a/src/schala_lang/tokenizing.rs b/schala-lang/src/tokenizing.rs similarity index 100% rename from src/schala_lang/tokenizing.rs rename to schala-lang/src/tokenizing.rs diff --git a/src/schala_lang/type_check.rs b/schala-lang/src/type_check.rs similarity index 98% rename from src/schala_lang/type_check.rs rename to schala-lang/src/type_check.rs index 9f09d83..34a1f73 100644 --- a/src/schala_lang/type_check.rs +++ b/schala-lang/src/type_check.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use std::rc::Rc; -use schala_lang::parsing::{AST, Statement, Declaration, Signature, Expression, ExpressionType, Operation, Variant, TypeName, TypeSingletonName}; +use parsing::{AST, Statement, Declaration, Signature, Expression, ExpressionType, Operation, Variant, TypeName, TypeSingletonName}; // from Niko's talk /* fn type_check(expression, expected_ty) -> Ty { diff --git a/src/schala_lang/typechecking.rs b/schala-lang/src/typechecking.rs similarity index 99% rename from src/schala_lang/typechecking.rs rename to schala-lang/src/typechecking.rs index 4b72884..dfedcaa 100644 --- a/src/schala_lang/typechecking.rs +++ b/schala-lang/src/typechecking.rs @@ -6,7 +6,7 @@ use std::fmt::Write; use itertools::Itertools; -use schala_lang::parsing; +use parsing; pub struct TypeContext { type_var_count: u64, diff --git a/src/main.rs b/src/main.rs index b83bee4..49f2e4d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,13 +6,12 @@ extern crate lazy_static; #[macro_use] extern crate maplit; +extern crate schala_repl; + extern crate maaru_lang; extern crate rukka_lang; extern crate robo_lang; - -mod schala_lang; - -extern crate schala_repl; +extern crate schala_lang; use schala_repl::{PLIGenerator, schala_main}; extern { }