Hoa\Compiler Locate Nodes in Source


How would I retrieve the location (as line and column) of an erroneous token during semantic analysis?


int x = 4;
int x = -2;

When the compiler reaches the second line, I want it to produce an error like:

Duplicate variable 'x' in line 2 column 5



So far, this information is not held by the TreeNode. This is a good opportunity for a contribution! In anyway, I suggest you to open an issue on the Github repository: https://github.com/hoaproject/Compiler.