We know compiler saves line numbers in symbol table during lexical analysis. I had been wondering if it is possible to save line numbers in any other phases of analysis of source code? If possible then when and how?
Asked
Active
Viewed 148 times
1 Answers
0
You can obviously copy saved line numbers from some lexical component to some other component, provided you keep the line number in the lexical object; that copy could be made in any compiler phase.
However, the lexical phase is really the only point in the compilation where the source code itself is being analyzed textually, so it is the phase in which you will know what line number in the source code you have reached.

rici
- 234,347
- 28
- 237
- 341