LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Trouble Building Bison Parser (https://www.linuxquestions.org/questions/programming-9/trouble-building-bison-parser-120579/)

exitsfunnel 11-27-2003 07:18 PM

Trouble Building Bison Parser
 
Hello,

I've written a simple lexer/parser pair using
flex/bison and I'm having trouble getting it to build.
The lex file is named test.l and the parse file is
named test.y. I issue the following two commands:

(1) flex test.l
(2) bison test.y

which produce lex.yy.c and test.tab.c respectively. I
then try to build my parser with:

(3) gcc -o test lex.yy.c test.tab.c -ll

but sadly the linker complains thusly:

/tmp/cc8IXvts.o: In function 'yyparse':
/tmp/cc8IXvts.o(.text+0x5a(): undefined reference to
'yerror'

It seems I should be linking against some other
library but I can't figure out which one. I've poked
around the internet looking for a solution to no
avail. I found several reports of people bumping up
against this issue but no solutions. If anyone can
point me in the right direction I'd be very grateful.
Thanks in advance.

-exits

ToniT 12-09-2003 06:14 PM

Do you mean 'undefined reference to yyerror'? You have to generate one by yourself.
See 'info bison' -> Parser C-Language Interface ->Error Reporting.


All times are GMT -5. The time now is 02:05 PM.