tags:

views:

41

answers:

1

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
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?
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