Question: 1 . ) Add a left - associative # operator, at lower precedence than any of the others. This is an imaginary new perator that
Add a leftassociative # operator, at lower precedence than any of the others.
This is an imaginary new perator that adds the second number
Then add a rightassociative operator, at higher precedence than any
of the others except and This operator is also imaginary, but it is
the equivelent of the I.e powf
Note: to do use powf. You will need to include:
#include
Note: These operators must come last in your l file. I.e:
#return yytext;
Build of off this code :
#include
#include
extern int yylex;
void yyerrorchar msg;
union
float f;
token NUM
type E T F
S : E printff
$;
;
E : E T $$ $ $; printff f
$ $;
E T $$ $ $; printff f
$ $;
T $$ $; printff
$;
;
T : T F $$ $ $; printff f
$ $;
T F $$ $ $; printff f
$ $;
F $$ $; printff
$;
;
F : E $$ $; printff
$;
F $$ $; printff
$;
NUM $$ $; printff
$;
;
void yyerrorchar msg
fprintfstderrs
msg;
exit;
int main
return yyparse;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
