formal grammars. hw1