Clear up some unused code to reduce compile noise
And add some notes to the README
This commit is contained in:
parent
75a7a4499d
commit
492ef4ae19
@ -58,6 +58,8 @@ of learning how to write a programming language.
|
|||||||
|
|
||||||
### Type-checking
|
### Type-checking
|
||||||
https://skillsmatter.com/skillscasts/10868-inside-the-rust-compiler
|
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
|
### Evaluation
|
||||||
*Understanding Computation*, Tom Stuart, O'Reilly 2013
|
*Understanding Computation*, Tom Stuart, O'Reilly 2013
|
||||||
|
@ -39,10 +39,12 @@ impl BinOp {
|
|||||||
pub fn sigil(&self) -> &Rc<String> {
|
pub fn sigil(&self) -> &Rc<String> {
|
||||||
&self.sigil
|
&self.sigil
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
pub fn get_type(&self) -> Result<Type, String> {
|
pub fn get_type(&self) -> Result<Type, String> {
|
||||||
let s = self.sigil.as_str();
|
let s = self.sigil.as_str();
|
||||||
BINOPS.get(s).map(|x| x.0.clone()).ok_or(format!("Binop {} not found", s))
|
BINOPS.get(s).map(|x| x.0.clone()).ok_or(format!("Binop {} not found", s))
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
pub fn min_precedence() -> i32 {
|
pub fn min_precedence() -> i32 {
|
||||||
i32::min_value()
|
i32::min_value()
|
||||||
}
|
}
|
||||||
@ -67,10 +69,12 @@ impl PrefixOp {
|
|||||||
pub fn is_prefix(op: &str) -> bool {
|
pub fn is_prefix(op: &str) -> bool {
|
||||||
PREFIX_OPS.get(op).is_some()
|
PREFIX_OPS.get(op).is_some()
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
pub fn get_type(&self) -> Result<Type, String> {
|
pub fn get_type(&self) -> Result<Type, String> {
|
||||||
let s = self.sigil.as_str();
|
let s = self.sigil.as_str();
|
||||||
PREFIX_OPS.get(s).map(|x| x.0.clone()).ok_or(format!("Prefix op {} not found", s))
|
PREFIX_OPS.get(s).map(|x| x.0.clone()).ok_or(format!("Prefix op {} not found", s))
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref PREFIX_OPS: HashMap<&'static str, (Type, ())> =
|
static ref PREFIX_OPS: HashMap<&'static str, (Type, ())> =
|
||||||
|
@ -196,22 +196,22 @@ fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody,
|
|||||||
Guard::Pat(ref p) => match p {
|
Guard::Pat(ref p) => match p {
|
||||||
Pattern::Ignored => (None, vec![]),
|
Pattern::Ignored => (None, vec![]),
|
||||||
Pattern::Literal(lit) => match lit {
|
Pattern::Literal(lit) => match lit {
|
||||||
PatternLiteral::NumPattern(expr) => unimplemented!(),
|
PatternLiteral::NumPattern(_expr) => unimplemented!(),
|
||||||
PatternLiteral::StringPattern(s) => unimplemented!(),
|
PatternLiteral::StringPattern(_s) => unimplemented!(),
|
||||||
PatternLiteral::BoolPattern(b) => unimplemented!(),
|
PatternLiteral::BoolPattern(_b) => unimplemented!(),
|
||||||
PatternLiteral::VarPattern(var) => unimplemented!(),
|
PatternLiteral::VarPattern(_var) => unimplemented!(),
|
||||||
},
|
},
|
||||||
Pattern::TuplePattern(_) => {
|
Pattern::TuplePattern(_) => {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
},
|
},
|
||||||
Pattern::TupleStruct(name, subpatterns) => {
|
Pattern::TupleStruct(_name, _subpatterns) => {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
},
|
},
|
||||||
Pattern::Record(name, pairs) => {
|
Pattern::Record(_name, _pairs) => {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Guard::HalfExpr(HalfExpr { ref op, ref expr }) => {
|
Guard::HalfExpr(HalfExpr { op: _, expr: _ }) => {
|
||||||
|
|
||||||
(Some(0), vec![])
|
(Some(0), vec![])
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ enum TConst {
|
|||||||
Unit,
|
Unit,
|
||||||
Nat,
|
Nat,
|
||||||
StringT,
|
StringT,
|
||||||
Custom(String)
|
//Custom(String)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
|
Loading…
Reference in New Issue
Block a user