From 1d5e5aa7358a187ec3007178439bcdc8b68d9d8f Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 19 Aug 2018 22:00:20 -0700 Subject: [PATCH] Some type renaming in builtins Builtins will remain entirely separate from the actual type representation, whatever that ends up being --- schala-lang/src/builtin.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/schala-lang/src/builtin.rs b/schala-lang/src/builtin.rs index 61f0400..5e7c8cd 100644 --- a/schala-lang/src/builtin.rs +++ b/schala-lang/src/builtin.rs @@ -3,18 +3,18 @@ use std::collections::HashMap; use std::fmt; use tokenizing::TokenType; -use self::Type::*; use self::TConstOld::*; +use self::BuiltinTypeSpecifier::*; +use self::BuiltinTConst::*; -//TODO get rid of these types and replace them with the right MonoType or whatever ones later #[derive(Debug, PartialEq, Clone)] -pub enum Type { - Const(TConstOld), - Func(Box, Box), +pub enum BuiltinTypeSpecifier { + Const(BuiltinTConst), + Func(Box, Box), } #[derive(Debug, PartialEq, Clone)] -pub enum TConstOld { +pub enum BuiltinTConst { Nat, Int, Float, @@ -22,7 +22,7 @@ pub enum TConstOld { Bool, } -impl fmt::Display for Type { +impl fmt::Display for BuiltinTypeSpecifier { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self) } @@ -104,7 +104,7 @@ impl PrefixOp { */ } lazy_static! { - static ref PREFIX_OPS: HashMap<&'static str, (Type, ())> = + static ref PREFIX_OPS: HashMap<&'static str, (BuiltinTypeSpecifier, ())> = hashmap! { "+" => (Func(bx!(Const(Int)), bx!(Const(Int))), ()), "-" => (Func(bx!(Const(Int)), bx!(Const(Int))), ()), @@ -115,7 +115,7 @@ lazy_static! { /* the second tuple member is a placeholder for when I want to make evaluation rules tied to the * binop definition */ lazy_static! { - static ref BINOPS: HashMap<&'static str, (Type, (), i32)> = + static ref BINOPS: HashMap<&'static str, (BuiltinTypeSpecifier, (), i32)> = hashmap! { "+" => (Func(bx!(Const(Nat)), bx!(Func(bx!(Const(Nat)), bx!(Const(Nat))))), (), 10), "-" => (Func(bx!(Const(Nat)), bx!(Func(bx!(Const(Nat)), bx!(Const(Nat))))), (), 10),