Development Notes - notcome/indescript GitHub Wiki
This page records questions I am facing.
Test Parser in a More Serious way
Currently the parser is tested with a hand-written unit test. It has the following problem:
- Unit test has not covered all codes, not to mention all cases.
- I have not tested invalid inputs.
- No consideration of error messages.
One potential improvement is to rewrite part of this parser into a bidirectional parser-pretty printer. How to implement this bijective “function” (maybe not a function, since it is more likely composed of Parser [Token] Program
and (->) Program [Token]
) remains a big question. Maybe I should try to use a free monad to encode a CFG-like grammar and write different interpreters for each task.
Besides, note that parser should never waste too much time of mine.
A multi-pass compiler:
- Lexing.
- Convert to CFG with semicolon/brace insertion.
- Adjust expressions with operators.
- Dependency analysis, grouping for further typing.
- Typing and generating a core language.
- I don’t know.
Type Checker
Features to add:
- (Multiparameter) type class.
- Associated types using (limited?) type families.
- Arbitrary rank type inference.
How to handle higher-kinder types?