CS 536 Homework 3 solution

$19.99

Original Work ?

Download Details:

  • Name: h3.pdf
  • Type: pdf
  • Size: 92.91 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (1 vote)

Question 1:
Write an unambiguous CFG for this language of regular expressions so that parse trees correctly reflect the
precedence and associativity of the given operators.
Note: you are to express precedence and associativity by introducing additional nonterminals and the use of leftor right-recursion. Do not assume that you have the kind of mechanism that JavaCUP has to support declarations
of precedence and associativity.
Use lower-case names for nonterminals and use the following terminals:
LTR // any letter
EPS // epsilon
OR // |
STAR // *
PLUS // +
LPAR // left paren
RPAR // right paren
Question 2:
Draw a parse tree for the string:
x+(y*|a+d)f+|Ξ΅
Use LTR(a) in the parse tree to mean “the LTR token for the letter a” (and similarly for the other letters in the
string).