A parser program for the following grammar
问题 Write a parser (both Yacc and Lex files) that uses the following productions and actions: S -> cSS {print “x”} S -> a {print “y”} S -> b {print “z”} Indicate the string that it will print when the input is cacba . I am getting this error: when I give input to it, it says valid input and also says syntax error. My Scanner Code is this %{ #include "prac.h" %} %% [c] {return C; } [a] {return A; } [b] {return B; } [ \t] ; \n { return 0; } . { return yytext[0]; } %% int yywrap(void) { return 1; }