The following ambiguous grammar describes boolean expressions:
B → true
B → false
B → B ∨ B
B → B ∧ B
B → ¬ B
B → (B)
a) Given that negation (¬) binds tighter than conjunction (∧) which binds tighter
than disjunction (∨) and that conjunction and disjunction are both rightassociative, rewrite the grammar to be unambiguous.
b) Write a grammar that accepts the subset of boolean expressions that are equivalent to true (i.e., tautologies). Hint: Modify the answer from question a) and add
an additional nonterminal F for false boolean expressions.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here