Even more deletions

This commit is contained in:
greg 2018-05-16 01:08:06 -07:00
parent f48a25779c
commit 36cd7e080d
2 changed files with 7 additions and 15 deletions

View File

@ -1,8 +1,8 @@
use std::rc::Rc;
use std::collections::HashMap;
use typechecking::{Type, TypeResult, TConst};
use self::Type::*; use self::TConst::*;
use typechecking::{Type, TypeResult, TConstOld};
use self::Type::*; use self::TConstOld::*;
#[derive(Debug, PartialEq, Clone)]
pub struct BinOp {

View File

@ -9,7 +9,6 @@ use itertools::Itertools;
use parsing;
pub struct TypeContext {
//type_var_count: u64,
bindings: HashMap<Rc<String>, Type>,
pub symbol_table: SymbolTable
}
@ -42,21 +41,12 @@ pub enum SymbolSpec {
#[derive(Debug, PartialEq, Clone)]
pub enum Type {
Const(TConst),
Var(TVar),
Const(TConstOld),
Func(Box<Type>, Box<Type>),
//UVar(String),
//EVar(u64),
Sum(Vec<Type>),
Void
}
#[derive(Debug, PartialEq, Clone)]
pub struct TVar(String);
#[derive(Debug, PartialEq, Clone)]
pub enum TConst {
Unit,
pub enum TConstOld {
Nat,
Int,
Float,
@ -77,16 +67,18 @@ impl parsing::TypeName {
fn to_type(&self) -> TypeResult<Type> {
use self::parsing::TypeSingletonName;
use self::parsing::TypeName::*;
use self::Type::*; use self::TConst::*;
use self::Type::*; use self::TConstOld::*;
Ok(match self {
Tuple(_) => return Err(format!("Tuples not yet implemented")),
Singleton(name) => match name {
TypeSingletonName { name, .. } => match &name[..] {
/*
"Nat" => Const(Nat),
"Int" => Const(Int),
"Float" => Const(Float),
"Bool" => Const(Bool),
"String" => Const(StringT),
*/
n => Const(Custom(n.to_string()))
}
}