3 ms·
Interesting, I wasn't aware of the #line directive, thanks! Yes, you would need to keep track of the source locations for each node in the AST. There is a nice
by andybest 8y ago
Interesting, I wasn't aware of the #line directive, thanks!
Yes, you would need to keep track of the source locations for each node in the AST. There is a nice example in the LLVM Kaleidoscope tutorial here: https://llvm.org/docs/tutorial/LangImpl09.html https://llvm.org/docs/tutorial/LangImpl09.html
- gnulinux 8y agoBison and lex use #line to make generated C/C++ code (lexer, parser) debuggable, or at least their GNU implementation does, I don't know about other implementations.