Pergunta

I'm having trouble putting all my source code together at compilation time. I don't know what I'm doing wrong, I've been encounter small problems here and there and I've resolved most of them (all silly oversights) but now I'm facing yet another issue, maybe someone here can take a look and tell me what I'm doing wrong:

I'm writing a a small C language parser program using the lex (flex) and yacc command line utilities. I'm SSHing into a SUN Oracle t4-2 main frame running Unix (Solaris 10). I begin with 2 files I wrote: grammar.y and grammar.l

Here is a screen shot of my actions: enter image description here

running yacc -d grammar.y produces files: y.tab.h and y.tab.c

running flex grammar.l produces file: lex.yy.c

Then I attempt to compile using gcc *.c -o test

Then I get the error shown in the screen shot.

Please someone smarter than me tell me what I am doing wrong...

Any help will be much appreciated

Foi útil?

Solução

The error message is telling you that you have referenced two functions, yyerror() and computSymbolIndex(), which you have not defined.

For the first one, you will need to provide a definition for that function. It is not provided by yacc, but it won't be hard to write. (All it needs to do here is probably just print the error and exit(1).)

For the second one, you will need to fix your typo.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top