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:

  1. Unit test has not covered all codes, not to mention all cases.
  2. I have not tested invalid inputs.
  3. 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:

  1. Lexing.
  2. Convert to CFG with semicolon/brace insertion.
  3. Adjust expressions with operators.
  4. Dependency analysis, grouping for further typing.
  5. Typing and generating a core language.
  6. I don’t know.

Type Checker

Features to add:

  1. (Multiparameter) type class.
  2. Associated types using (limited?) type families.
  3. Arbitrary rank type inference.

How to handle higher-kinder types?