• Advertisement

Archived

This topic is now archived and is closed to further replies.

This topic is 5034 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I was looking thru the Cg Compiler code -- Quite interesting if you have never really given compilers much thought -- and I saw this statment #line 36 "parser.y" { some code } I think it was that. Can anybody shed some light on it. I''ve googled, but to no avail Thanks,

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/prepr_9.asp">The #line Directive</a>

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The #line directive is typically used by program generators to cause error messages to refer to the original source file instead of to the generated program.

Share this post


Link to post
Share on other sites
It''s commonly used in things like automated parser or lexer generators. For example, the parser.y file probably refers to a yacc-compatible grammer description that was fed to yacc or one of its relatives, so if errors turn up in the generated code the line directive refers to the line in the .y file. This is useful since most compile time errors are due to errors in the original source file (the grammar description), and not the generated code.

Share this post


Link to post
Share on other sites

  • Advertisement