help-bison
[Top][All Lists]
Advanced

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

Empty rule spoiling error reporting


From: hz kto
Subject: Empty rule spoiling error reporting
Date: Wed, 04 Aug 2004 03:56:18 +0400

Hi,

My grammar contains a lot of optional rules like this

opt_something1: /*empty/
        |<some grammar>
        |<some grammar>
        |<some grammar> ...

And then

rule1 : token3 {...}
        | token2 {...}    
        | opt_something1 token1 {...}


When in certain context parser does not see token1,2,3 nor anything non-empty 
from opt_something1, it matches an empty rule and then, when it starts 
searching for tokens that could follow next, it only finds token1 since it 
already in the state corresponding to opt_something1. 

Is it possible to make a check inside error reporting routine for whether the 
last thing matched was an "empty" rule?
Then I could just pop one state of the stack and start error reporting as 
normally. (I can't really remove optional rules that match empty strings, it 
would make the grammar many times bigger)

Thanks in advance




reply via email to

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