help-bison
[Top][All Lists]
Advanced

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

Rule not matched ?


From: olivier laporte
Subject: Rule not matched ?
Date: Wed, 11 May 2011 10:23:31 +0200

Hi all,
I'm again asking for your help as I'm facing something the makes me crazy.

I have a working parser which start with a rule called 'design_file'. But I
wanted to be able to start either with the rule 'design_file' or
'..top_level..' so I followed the information
here<http://www.gnu.org/software/bison/manual/html_node/Multiple-start_002dsymbols.html#Multiple-start_002dsymbols>.


I've added this rule and I'm now using it as start rule :

switch
        : START_FULL {fprintf(stderr, "Received full token\n");} design_file
        | START_TOP_LEVEL ..top_level..
        ;

I've modified my lexer to make it return START_FULL token the first time it
is called.

As output I obtain this :

Received full token

"syntax error, unexpected LIBRARY, expecting START_FULL or START_TOP_LEVEL"

So I received the token START_FULL as expected and the token LIBRARY (which
is correct, it is the first thing in the file) but why and how could the
parser can still be waiting for START_FULL or START_TOP_LEVEL. The rule is
rather clear : after receiving START_FULL expect rule 'design_file'. And
rule 'design_file' is working (if I removed the modification and start again
with this rule it works.)

Moreover, the output file say this :

état 0

    0 $accept: . switch "End of file"
    2 switch: . START_FULL address@hidden design_file
    3       | . START_TOP_LEVEL ..top_level..

    START_FULL        shift and go to state 1
    START_TOP_LEVEL   shift and go to state 2

    switch  go to state 3

I still doesn't understand very well the information in there, but this is
the only place where you can find something like :

START_FULL shift and go to state 1

So I suppose that nowhere else, the token START_FULL is expected.

Thanks for all the help you might give me.

Olivier LAPORTE.


reply via email to

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