You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will be very useful for writing compilers, since line markers is the standard way to convey information where a line is from after a file has been preprocessed, and they can be used as "offsets" for proper error reporting.
The text was updated successfully, but these errors were encountered:
The c grammar does not implement preprocessor directives, including #line. We don't implement a preprocessor.
But, let's assume that you generated the post-processed input via cpp or gcc -E. This would contain #line directives. For a concrete example, let's take the
source file hw.c-pre.txt and the post-processed generated file hw.c-post.txt
I assume that you'd want a lexer that creates a new token type that contains the additional information that computes the line/column back to the original source. However, in the example I provide, some #line directives don't follow the ISO spec. (The current draft is https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf. We don't have a grammar for the newest spec.)
It's possible to do something, but I don't have time at the moment to understand the #line directives that aren't ISO 9899 compliant, and to implement this.
This will be very useful for writing compilers, since line markers is the standard way to convey information where a line is from after a file has been preprocessed, and they can be used as "offsets" for proper error reporting.
The text was updated successfully, but these errors were encountered: