I don’t write code to implement scanners. I use PEG (I used to used regular expressions).
I don’t write code to implement parsers. I use PEG1.
I don’t write code to do syntax-checking. I use a parser.
I don’t write code to implement semantics checking. I use the underlying toolbox language to do most of the work for me (e.g. hash tables, etc.2).
I don’t write code to implement code optimization. I transpile to some base language and let the corresponding compiler do the work for me.
Table of Contents
I like the Ohm language (based on PEG). I regularly use Ohm-JS and Ohm-Editor. ↩
Semantic analysis (type checking) consists, at a base level, of storing some information and retrieving that information. More complicated type checking consists of inferring type information, which, itself, decomposes into two broad categories - (1) what to infer, and, (2) how to infer it. Akin to the use of
end if-like constructs in parsing, there are some simple - low-hanging-fruit - type checks that can be performed fairly easily with information stored in tables. ↩
Transpilation is source-to-source compilation. Compile one source language to another textual language. ↩