i want to parse a command line using a yacc but i want to call it from a c file. how it is possible ?
+2
A:
The code generated by YACC creates a function called yyparse()
. Simply call it.
See for example: http://dinosaur.compilertools.net/yacc/index.html (section 8).
edgar.holleis
2010-04-23 10:12:57
i included y.tab.c and called yyparse() but it didn't work. It said undefined reference to yylex.So i also included lex.yy.c but now it is saying conflicting types of YYSTYPE and yylval .what can i do now?
2010-05-10 16:00:46
What do you mean by "include"? You should never #include a c-file into another, always #include the .h. Then the source file will pass the compile-step. You should then combine the resulting object files during the linking-step. If you are unsure about #include, compile and link you should probably first learn about the build system before messing with lex and yacc.
edgar.holleis
2010-05-11 12:38:10