|
|
Module 2 Exercises
-
Derive the string a + a * a using the various expression grammars
in this module. (There are four).
Solution
-
For the string of exercise one, and the four grammars, show (a) a right
derivation, and (b) a left derivation.
-
Study the first two exercises and devise an algorithm which will derive
a given string automatically, looking at the next input symbol only. (You
will be "inventing" top-down parsing.)
-
Find an another interpretation for the ambiguous sentence Time
flies like an arrow.
Solution
-
Show that the grammar:
is ambiguous. Write a grammar that will generate the same set of strings,
but that is unambiguous.
Solution
-
Consider the following grammar:
-
Describe the set of strings it generates.
-
Is it ambiguous?
-
Is it recursive?
|