Answers to Self-Study Questions
Test Yourself #1
Test Yourself #2
Question 1:
This grammar enforces precedences, but not associativities:
bexp → bexp OR bexp | bterm
bterm → bterm AND bterm | bfactor
bfactor → NOT bfactor | bfinal
bfinal → LPAREN bexp RPAREN | TRUE | FALSE
This grammar enforces precedences and associativities:
bexp → bexp OR bterm | bterm
bterm → bterm AND bfactor | bfactor
bfactor → NOT bfactor | bfinal
bfinal → LPAREN bexp RPAREN | TRUE | FALSE
Question 2: