PDA

View Full Version : lex yacc 2main conflict



synhedionn
November 12th, 2009, 01:32 PM
Hi,
I need to say

l.l
main()
{"printf("Enter the string to analyse");
scanf("%s",st);
yylex()}



and
l.y
NUMBER op NUMBER { $$ =$1+$3; /*for instance*/}
main()
{yyparse()}


But the 2 main() will conflict

How to do?

johnl
November 12th, 2009, 07:31 PM
yyparse() will call yylex() for you. You don't need to call them both.

synhedionn
November 12th, 2009, 07:37 PM
ok,but how do I tell to lexerize after my "printf("Enter the string to analyse");
scanf("%s",st);" ?