Skip to main content
gamedev.net
🔒 Locked

#line

Started by rpg_code_master May 10, 2004 at 7:40 AM 3 replies 700+ views
Original Post
rpg_code_master
rpg_code_master
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,
Craazer
Craazer
I cant figure any use for that, can you?
SiCrane
SiCrane
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.