Question: Consider the following context free grammar for boolean expressions: --> AND | OR | ( ) | --> p | q | r a) Use
Consider the following context free grammar for boolean expressions:
(
--> p | q | r
a) Use the expression "p AND q OR r" to show that this grammar is ambiguous
b) Now write an unambiguous grammar for expressions in which (1) parenthesized expressions take precedence over any other expression, (2) the operation OR takes precedence over AND, and (3) AND is left associative and OR is right associative.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
