Due: Thursday, October 19 by 11 pm. Please
use Gradescope (gradescope.com
,
also linked from the CSE 401/M501 resources web page) to submit
your homework online. Gradescope's web site has several
instructional videos and help pages to outline the process,
and this guide has
specific information about scanning and uploading pdf files
containing assignments.
a
Sb
S | b
Sa
S | ε
abab
.abab
.(
L )
| x
,
S | S (x, (x, x))
.(x, (x, x))
.(x, x, x)
. That is, show the contents of the stack and remaining input
at each step and indicate whether each step is a shift, reduce, or accept action
as we did with several shift-reduce parser examples in class.,
S
with a right-recursive
one L::=S,
L. What general effect does this have on the depth of the
stack during
a shift-reduce parse? (You might work through the parse of (x, x, x)
again to see what changes.)
time arrow banana flies like a an the fruitand the semicolon. Be sure to include all the senses (noun, verb, etc.) of each word. Then show that this grammar is ambiguous by exhibiting more than one parse tree for the sentence "time flies like an arrow; fruit flies like a banana". Your solution should use the English words in some essential way to show the ambiguity, not just something involving punctuation. (Hint: do not go overboard. This is not an exercise in computational linguistics or Natural Language Processing. If you've done "sentence diagrams" in grade school, that's the right level of complexity for the grammar here. If you are not familiar with sentence diagrams, wikipedia has an article that shows what we've got in mind - look at the later half of the article for example trees. Don't try to reproduce diagrams with exactly the same details, but that's the general idea. The idea is to have a bit of fun with grammars and explore ambiguities in the English language.)
like
Aquick
| strong
bunny
| ox