diff --git a/README.md b/README.md index 4ef8f06..68e668b 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,12 @@ much like Haskell Here's a partial list of resources I've made use of in the process of learning how to write a programming language. +### Type-checking +https://skillsmatter.com/skillscasts/10868-inside-the-rust-compiler + ### Evaluation *Understanding Computation*, Tom Stuart, O'Reilly 2013 + *Basics of Compiler Design*, Torben Mogensen ### Parsing diff --git a/src/schala_lang/eval.rs b/src/schala_lang/eval.rs index f9fc283..c0c0167 100644 --- a/src/schala_lang/eval.rs +++ b/src/schala_lang/eval.rs @@ -108,6 +108,19 @@ impl ReplState { } } + +// from Niko's talk +/* fn type_check(expression, expected_ty) -> Ty { + let ty = bare_type_check(expression, expected_type); + if ty icompatible with expected_ty { + try_coerce(expression, ty, expected_ty) + } else { + ty + } + } + + fn bare_type_check(exprssion, expected_type) -> Ty { ... } + */ pub enum TypeCheck { OK, Error(String)