[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: First time user comments



> Peter Fraser <[email protected]> [2005-01-21 00:54]:
>> Could the "syntax error" message, give the position in the line that
the
>> error occurred, or at least the token that caused it.
>no - that is not how parsers work. syntax error actually says it didn't
>match any production from the grammar. if we don't know what production
>it should have matches, how should we tell which part didn't?
>that is just not how parsers work, sorry.
Parsers I know, I am assuming that pf is using Bison. Productions fail
because 
they are given a token that they cannot shift. Each token has a location
in a file,
the token can be printed (by modifying yyerror), or with a bit more work
yylex can keep tract of the character number within the line of the
token.