Well, I've searched my problem for quite a long time and I got nothing. Questions I seen below could not help my situation:
Lex/Flex - Scanning for the EOF character
Flex/Bison EOF propagation from stdin vs a file
END OF FILE token with flex and bison (only works without it)
Situation description:
I use Bison and Flex to parse a custome language, say this language's name is MYLAN;
in MYLAN syntax, I wrote
%start system_decl
andsystem_decl:module_decls{...};
in bison file .ypp, no token denoting "system begin" or "system end" as you can see, the system is simply a comibnation of modules. A file written in MYLAN may look like this:module ... end module ... end module ... end
the parser worked fine for all the syntax described in .ypp, but when it reached the end of file (it should be
EOF
but I'm not sure since I tried<<EOF>>
but the problem still exists), it could not stop, it keeped wating for a token:[MYLANParser] $ ./MYLANParser example.mylan ... Stack now 0 3 Entering state 6 Reducing stack by rule 50 (line 458): $1 = nterm module_decls () $2 = nterm module_decl () $$ = nterm module_decls () Stack now 0 Entering state 3 Reading a token:
It just stuck here and the parser will not stop, anyone can help? Many thanks in advance!