Hello,

I've inherited some code that does source-to-source translation, with
five different passes (each with a different .peg) that take a single
long string as input and emits a string as output.  I've been
requested to add source line information to the results, some way or
another.  Currently the code strips out all comments from the source
and never adds/handles any.

My question: what would be best practice here for retaining source
line information?  I've thrown around some ideas like supporting
comments throughout the grammars, breaking up the single string format
and adding line data per string, unifying the grammars so it's a
single pass, but nothing proposed has been entirely satisfactory.  My
previous experience is entirely flex-bison with a single grammar going
to an IR.

Thanks in advance.

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to