Homework 6

Ben Finch
Dr. Goodrich
CS 236
9/30/2026

  1. Grammar for matching () and []:
T={(,),[,]}N={A}P={A=>AA|(A)|[A]|ϵ}Starting state is A The following grammar is ambiguous. Demonstrate the ambiguity by creating two parse trees for some string that you create. Note that is the start symbol. 
/wwswswswwwwwwww3ww3w333w3w3ww3w3w33w3w3''''
::= b
::= b e
::= 
::= s The following grammar for a fictitious operator '$' is ambiguous. Demonstrate the ambiguity by creating two parse trees for the expression 2 $ 3 $ 0. Note that is the start symbol. ::= 0|1|2|3
::=
::= $
  1. Fix the grammar in Problem #3 so that it is not ambiguous. Is your fixed grammar left associative or right associative?