parser - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
In the design of ENIGMA's compiler, the parser is the collection of sources responsible for translating EDL into C++. For efficiency reasons, the parser is divided into four segments that are unidirectionally dependent.
C Parser | Reads C headers to determine available functions, types, and macros. This parser has no dependencies. |
Type resolver | A stack-based parser meant to determine the type of a given expression based on the results of the C parser. |
Syntax checker | A lexless pass that reads over code to find simple syntax errors. It cannot determine errors in types due to ENIGMA's lax typing system, but by using results from the C parser, it can determine which statements are declarations and which functions are passed the correct number of parameters. |
Formatter | A parser/lexer designed to add missing marks of punctuation, including parentheses around control statements, missing semicolons, missing colons (after case labels and in ternary operators), and in some cases, spacing. |