help-bison
[Top][All Lists]
Advanced

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

Re: Why only one "expected"?


From: Duncan Murdoch
Subject: Re: Why only one "expected"?
Date: Tue, 29 May 2007 13:15:15 -0400
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)

On 5/29/2007 10:05 AM, Duncan Murdoch wrote:
We're using a GNU Bison 2.3 parser, with verbose error messages. However, we only see messages with a single "expected" token. For example, if a user forgets to give a function name in a function call and types "(1,1)" they'll get the error

syntax error, unexpected ',', expecting ')'

when in fact there are lots of legal tokens at that spot: any arithmetic operator would be fine, such as "(1+1)", "(1-1)", etc.

Sorry about the noise. I see what's happening now. One of the rules we have is

expr : '(' expr_or_assign ')'

and the first "1" is matching the expr_or_assign rule, so ')' really is the only possibility at that point.

Duncan Murdoch




reply via email to

[Prev in Thread] Current Thread [Next in Thread]