Question: how to modified the two codes to display these cases? two incomplete codes: display these cases: *calco.y *calco.l %t #include void yyerror (char*); int yylex(void);

how to modified the two codes to display these cases?

two incomplete codes:

how to modified the two codes to display these cases? two incomplete

codes: display these cases: *calco.y *calco.l %t #include void yyerror (char*); int

display these cases:

yylex(void); int lexeme_error0; %token NUMBER %token PLUS MINUS program: program stmtlist n

*calco.y *calco.l %t #include void yyerror (char*); int yylex(void); int lexeme_error0; %token NUMBER %token PLUS MINUS program: program stmtlist n printf(" is a sentence "); printf(" is a sentence "); ) if (lexeme_error) 5 | error 'n' printf(" contains invalid lexemes, thus is not a sentence " lexeme_error 0; else printf(" is not a sentence "); yyclearin; /* discard lookahead */ yyerrok; stmtlist: stmtlist stmt'I stmt '' stmt: NUMBER I I*more rules..*/ void yyerror (char *s) //fprintf(stderr, "%s ", s); int main (void) yyparse); return 0; *calco.y *calco.l /* definitions, e.g., patterns, include libraries #include "y.tab.h.. #include void yyerror(char *); extern int lexeme_error; /*set of pattern-action rules RegularExpression Actionj (this comment must be indented)* / [0-9]+ {printf(" ",yytext); return NUMBER; C-1 printf( "); return MINUS; printf("); return PLUS; return *yytext;} int yywrap (void) return 1; [02/10/19] seed@VM:~/. ../assignmentl$ ls assign1.1 assign1.y build [02/10/19]seed@VM:-/. . ./assignmentl$ cat build bison -y -d *.y flex *. - .tab.c lex.yy . gcc y.tab.o lex.yy.o -o myparser [02/10/19]seed@VM:-/. . ./assignmentl$ build assignl.y: Warning: 21 shift/reduce conflicts [-Wconflicts-sr [02/10/19]seed@VM:~/ . . ./assignmentl$ myparser CPS352 Spring 2019 parser developed by Phu Phung using flex and bison Enter your code in the console below to check the syntax. Type exit' to quit! >a-1 ; b 2; print a +b; "a-1; b 2; print a +b." is a valid sentence X--4*2 y-a+1; print z; "x--4 2; ya+1; print z;" is a valid sentence "X!-4 contains invalid lexemes, thus is not a valid sentence "x-4 is not a valid sentence. "x" is not a valid sentence exit Exit [02/10/19] seed@VM:-.../assignmentis *calco.y *calco.l %t #include void yyerror (char*); int yylex(void); int lexeme_error0; %token NUMBER %token PLUS MINUS program: program stmtlist n printf(" is a sentence "); printf(" is a sentence "); ) if (lexeme_error) 5 | error 'n' printf(" contains invalid lexemes, thus is not a sentence " lexeme_error 0; else printf(" is not a sentence "); yyclearin; /* discard lookahead */ yyerrok; stmtlist: stmtlist stmt'I stmt '' stmt: NUMBER I I*more rules..*/ void yyerror (char *s) //fprintf(stderr, "%s ", s); int main (void) yyparse); return 0; *calco.y *calco.l /* definitions, e.g., patterns, include libraries #include "y.tab.h.. #include void yyerror(char *); extern int lexeme_error; /*set of pattern-action rules RegularExpression Actionj (this comment must be indented)* / [0-9]+ {printf(" ",yytext); return NUMBER; C-1 printf( "); return MINUS; printf("); return PLUS; return *yytext;} int yywrap (void) return 1; [02/10/19] seed@VM:~/. ../assignmentl$ ls assign1.1 assign1.y build [02/10/19]seed@VM:-/. . ./assignmentl$ cat build bison -y -d *.y flex *. - .tab.c lex.yy . gcc y.tab.o lex.yy.o -o myparser [02/10/19]seed@VM:-/. . ./assignmentl$ build assignl.y: Warning: 21 shift/reduce conflicts [-Wconflicts-sr [02/10/19]seed@VM:~/ . . ./assignmentl$ myparser CPS352 Spring 2019 parser developed by Phu Phung using flex and bison Enter your code in the console below to check the syntax. Type exit' to quit! >a-1 ; b 2; print a +b; "a-1; b 2; print a +b." is a valid sentence X--4*2 y-a+1; print z; "x--4 2; ya+1; print z;" is a valid sentence "X!-4 contains invalid lexemes, thus is not a valid sentence "x-4 is not a valid sentence. "x" is not a valid sentence exit Exit [02/10/19] seed@VM:-.../assignmentis

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!