lollipop
lollipop copied to clipboard
Type checker
You need to add type inference and type checking to your language!
Here is a project worth looking at: https://github.com/mgrabmueller/AlgorithmW
An update on this: currently type checking is kinda working for the core language. Checking type correctness on evaluation in loli is also added, but @lol2kpe is currently working on adding the types for the functions in sugar to the start environment (the information hidden between the lines here is that nothing evaluates before that's done :dancers:).
Something that confuses us is how to reach the type declaration of a method, to compare that to the inferred type of the resulting expression. I think we agree on that expanding the AST to be type annotated requires heavy lifting, maybe it's easier (albeit a bit dirty) to just stuff the type annotations somewhere reachable from TI.hs.
I believe on the last meeting we discussed having cProgram give some kind of record type containing a list of function declarations, a list of data type declarations and a map from names to type signatures (although the last could just as easily be integrated into the function declarations).