联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2019-09-27 10:02

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).


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp