联系方式

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

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

日期:2024-02-27 09:07

1. (25pt) The identifiers in a programming language consist of one or more lower case letters, a, b,..., z, which must appear in non-decreasing alphabetical order. For example, correct identifiers include: accent, begin, x, zzz. Examples of incorrect identifiers are: bad, id.

2. (25pt) Consider the following grammar, G:

1. S ?! ABC 2. A ?! aA 3. A ?! "4. B ?! bB 5. B ?! bA 6. C ?! Cc 7. C ?! "

(c) (10pt) Modify G to become LL(1). Explain why the new, equivalent, grammar is LL(1). You don’t need to rebuild the first(), follow(), and predict() tables. Include su?cient explanation as to why the conflicts have been resolved.CS3342 – Midterm Exam – Wednesday, Mar. 1, 3:30 - 5:30pm 7

1. S ?! ABC 2. A ?! aA 3. A ?! "4. B ?! bB 5. B ?! bA 6. C ?! Cc 7. C ?! "

(c) (5pt) In general, in the definition of an SLR(1) grammar, shift/reduce and reduce/reduce conflict are forbidden. What about shift/shift conflicts?CS3342 – Midterm Exam – Wednesday, Mar. 1, 3:30 - 5:30pm 9

O ?! -

(b) (10pt) The same problem except that now you have to minimize the number of parentheses.

<span dir="LTR" yes';font-family:'arial="" unicode="" ms';mso-fareast-font-family:microsoftyahei;="" font-size:11.0000pt;"="">Alternative (c) (3pt) If you built a grammar for (a) but not for (b), then use the grammar you designed at (a). In this case, for a correct answer, you receive 3pt instead of 5pt. (If you solve the original (c), then you don’t have to do this.)


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

python代写
微信客服:codinghelp