首页 > > 详细

讲解diagram留学生、辅导c/c++,Python程序语言、讲解Java,Python 辅导留学生 Statistics统计、回归、迭代|代

1.(15 points) For the regular expression ((0|1)*2) | (0011) construct a deterministic finite state transition diagram.

2. (15 points) Construct regular expressions or definitions for the decimal literal which has the following restrictions:

A decimal literal must include a whole number and a fraction. Thus .34 must be written as 0.34 and 4. must be written as 4.0.

Unnecessary leading and trailing zeros should be avoided. That is 0.0 123.01 123003.0 are all legal but 00.0, 0.00, 002334, 1.23.00 are not.

3.(20 points) Give grammar: E E * E | E + E | (E) | id

3.1 Write down two possible leftmost derivations for input string id + id * id. Draw the corresponding parse tree for each of the two leftmost derivations.
3.2 Can you rewrite the grammar and explain how your rewritten grammar eliminates ambiguity?

4.(25 points) Are the following grammars LL(1) or not? Explain the reason (using First and Follow set concepts).

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!