From dd7736e32d915084d6d99e3663c4c688152ec327 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 3 Oct 2017 21:28:17 -0700 Subject: [PATCH] Add some resources --- README.md | 4 ++++ src/schala_lang/eval.rs | 13 +++++++++++++ 2 files changed, 17 insertions(+) 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)