I have a lex program listed below, it recognizes (lexical analysis)specific tokens and outputs them to the screen when input from the keyboard. I want to use yacc for syntactical analysis of the code below, but i don't quite get this part.....what would the output look like? Is my code below sufficient? I've read many articles online about yacc....just need someone to give a simple explanation. Thanks in advance...
/* Regular Definitions */
RelationalOp_1 "<"
RelationalOp_2 "<="
RelationalOp_3 "=<"
RelationalOp_4 "=="
RelationalOp_5 "!="
RelationalOp_6 ">"
RelationalOp_7 ">="
RelationalOp_8 "=>"
%%
{RelationalOp_1} {printf("(RelationalOp_1, %s)\n", yytext);}
{RelationalOp_2} {printf("(RelationalOp_2, %s)\n", yytext);}
{RelationalOp_3} {printf("(RelationalOp_3, %s)\n", yytext);}
{RelationalOp_4} {printf("(RelationalOp_4, %s)\n", yytext);}
{RelationalOp_5} {printf("(RelationalOp_5, %s)\n", yytext);}
{RelationalOp_6} {printf("(RelationalOp_6, %s)\n", yytext);}
{RelationalOp_7} {printf("(RelationalOp_7, %s)\n", yytext);}
{RelationalOp_8} {printf("(RelationalOp_8, %s)\n", yytext);}
. printf("Invalid input: %s\n",yytext);
%%
main()
{
yylex();
}
yywrap()
{
}