Clear up some unused code to reduce compile noise

And add some notes to the README
This commit is contained in:
greg 2018-08-19 15:03:41 -07:00
parent 75a7a4499d
commit 492ef4ae19
4 changed files with 14 additions and 8 deletions

View File

@ -58,6 +58,8 @@ of learning how to write a programming language.
### Type-checking
https://skillsmatter.com/skillscasts/10868-inside-the-rust-compiler
https://www.youtube.com/watch?v=il3gD7XMdmA
http://dev.stephendiehl.com/fun/006_hindley_milner.html
### Evaluation
*Understanding Computation*, Tom Stuart, O'Reilly 2013

View File

@ -39,10 +39,12 @@ impl BinOp {
pub fn sigil(&self) -> &Rc<String> {
&self.sigil
}
/*
pub fn get_type(&self) -> Result<Type, String> {
let s = self.sigil.as_str();
BINOPS.get(s).map(|x| x.0.clone()).ok_or(format!("Binop {} not found", s))
}
*/
pub fn min_precedence() -> i32 {
i32::min_value()
}
@ -67,10 +69,12 @@ impl PrefixOp {
pub fn is_prefix(op: &str) -> bool {
PREFIX_OPS.get(op).is_some()
}
/*
pub fn get_type(&self) -> Result<Type, String> {
let s = self.sigil.as_str();
PREFIX_OPS.get(s).map(|x| x.0.clone()).ok_or(format!("Prefix op {} not found", s))
}
*/
}
lazy_static! {
static ref PREFIX_OPS: HashMap<&'static str, (Type, ())> =

View File

@ -196,22 +196,22 @@ fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody,
Guard::Pat(ref p) => match p {
Pattern::Ignored => (None, vec![]),
Pattern::Literal(lit) => match lit {
PatternLiteral::NumPattern(expr) => unimplemented!(),
PatternLiteral::StringPattern(s) => unimplemented!(),
PatternLiteral::BoolPattern(b) => unimplemented!(),
PatternLiteral::VarPattern(var) => unimplemented!(),
PatternLiteral::NumPattern(_expr) => unimplemented!(),
PatternLiteral::StringPattern(_s) => unimplemented!(),
PatternLiteral::BoolPattern(_b) => unimplemented!(),
PatternLiteral::VarPattern(_var) => unimplemented!(),
},
Pattern::TuplePattern(_) => {
unimplemented!()
},
Pattern::TupleStruct(name, subpatterns) => {
Pattern::TupleStruct(_name, _subpatterns) => {
unimplemented!()
},
Pattern::Record(name, pairs) => {
Pattern::Record(_name, _pairs) => {
unimplemented!()
},
},
Guard::HalfExpr(HalfExpr { ref op, ref expr }) => {
Guard::HalfExpr(HalfExpr { op: _, expr: _ }) => {
(Some(0), vec![])
}

View File

@ -28,7 +28,7 @@ enum TConst {
Unit,
Nat,
StringT,
Custom(String)
//Custom(String)
}
#[derive(Debug, PartialEq, Clone)]