Flex and Bison: Facing error with simple grammer

29 Views Asked by At

I'm facing syntax error as below always.

Error : syntax error line: 1 at word *

Bison/Flex code is as below.

%keyword ENTITY      "Entity"
%keyword IS      "Is"

%%

Program                    : Begin
                                   {Reduce(Program); }

Begin                      :  ENTITY identifier_0 IS
                                   {Reduce(Begin); }

sstring                 : SIMPLESTRING {PutSymbol(sstring,$1);}
                        | STRINGSEGMENT DOT sstring
                        {

                        }

identifier              : sstring   {PutSymbol(identifier,$1);}
                        | SIMPLEID {PutSymbol(identifier,$1);}
                        /*| error {$1=NewErrorNode;ReduceError(identifier);}*/

identifier_0      : {Empty();}
         | sstring   {PutSymbol(identifier_0,$1);}
                        | SIMPLEID {PutSymbol(identifier_0,$1);}

%%

Sample input.

 Entity top Is
0

There are 0 best solutions below