Servostar / gemstone

programming language compiler
GNU General Public License v2.0
3 stars 0 forks source link

Add debug information to AST nodes #88

Closed Servostar closed 1 month ago

Servostar commented 1 month ago

Problem

Adding debug information about associated token(s) is necessary for printing pretty error/warning/info messages after parsing is done. Currently pretty messages are printed in yyerror (the lexer is still running at this point) which assumes that the global state of yylloc and others is set correctly. This cannot be relied on when inspecting the AST after parsing (the lexer is done and won't update global variables).

Proposal

Since any AST node can represent more than a single token (such as declarations) a node should store the bounds of an entire group of token (which can consist of a single token).

Add debug information to each AST node about:

Servostar commented 1 month ago

Closed with new diagnostic system