COMP 2049 代做代写 c++,java 编程
COMP 2049 Languages and Computation Coursework: Floating-Point Numbers and Simple Arithmetic Expressions
1 Floating-Point Numbers
Design a right-linear grammar G1 that generates the language of binary floating-point literals according to the following rules:
• Each number may be signed or unsigned.
– unsigned as in 1.01, signed as in +1.01 or -1.10
• The numerical part (also called the value field) must be non-empty and may optionally include a decimal point ’.’, in which case it must be followed by some other digits. For instance:
– In the number +110.11, the value filed is 110.11.
– 1 and .01, -.001, 001 are all acceptable, but 1., +, - and λ are not.
• There may be an optional exponent field, in which case, it must contain the letter ’e’, followed by a signed or unsigned integer.
– For instance, 101e+1 or -1.1e10 are acceptable, but 1.01e, 1.01e-1.1 and e11 are not. Furthermore, there must be at least one digit between the decimal point ’.’ and the letter ’e’. Hence,
strings such as 11.e01 are not acceptable.
Task 1. Implement the grammar G1 in JFLAP, and test it on some input strings of your choice.
A screenshot of the result of parsing of some sample input strings for grammar G1 in JFLAP is provided in Figure 1.
Figure 1: Some sample input and the corresponding results
Remark 1.1 In all of the tasks of this coursework, the default parsing method should be the “brute force parsing”. Hence, to test your grammars in JFLAP on several input strings, choose the tab “Input” and then the item “Multiple Brute Force Parse”.
1
2 Arithmetic Expressions
For the second task, you are required to design a context-free grammar (CFG) G2 that generates the language of arithmetic expressions over natural numbers in binary format. Each arithmetic expression is constructed from the following:
• Binary unsigned integer literals, with leading zeros accepted;
• Arithmetic operators +, -, *, and /;
• Properly nested parentheses.
For instance, an expression such as (11+0101)/001 must be accepted, whereas ((11-01) must be rejected because the parentheses do not match.
Task 2. Implement the grammar G2 in JFLAP and test it on some input expressions of your choice.
Check all the production rules of the grammar G2 to see if there are any λ-productions or unit- productions. If there are any such productions, you may notice that for more complicated input strings, it takes a long time for JFLAP to parse the string. In fact, at times it may enter into a non-terminating loop.
Task 3. Use JFLAP to remove the λ-productions and unit-productions of the grammar G2 to obtain the gram- mar G3. Then, try to parse the same strings as before and notice that it takes a shorter time to parse them, and the parser does not enter into non-terminating loops.
In JFLAP, to remove λ-productions and unit-productions, you may first choose the tab “Convert”, and then the item “Transform Grammar”. A screenshot of the result of parsing of some sample input strings for grammar G3 in JFLAP is provided in Figure 2. To compare the efficiency of G2 and G3, you may use the sample input “1+1-(1/1*1)”.
Figure 2: Some sample input and the corresponding results
3 Submission
You must submit one zip file which contains three JFLAP files, named according to the following templates: 1. A JFLAP file for grammar G1 of Task 1 named:
ID_Surname_FirstName_01.jff 2. A JFLAP file for grammar G2 of Task 2 named:
ID_Surname_FirstName_02.jff 3. A JFLAP file for grammar G3 of Task 3 named:
4. The zip file named:
ID_Surname_FirstName_03.jff ID_Surname_FirstName.zip
2
Remark 3.1 In case the grammar G2 of Task 2 that you have designed already has no λ-productions and no unit-productions, then you may submit the same grammar as G3. Nonetheless, even in this case, you must submit three files with the naming conventions as specified above.
• Release date: Tuesday, April 2nd, 2024
• Deadline: Friday, April 19th, 2024, 17:00 • Weight: 15% of the module mark
• How to submit: Via Moodle
4 Marking Scheme
Correctness: (80%) Correct answers for the three tasks contribute to 80% of the total mark, as follows: • Task 1: 40%
• Task 2: 20%
• Task 3: 20%
Format: (20%)
1. While the grammar G3 of Task 3 is generated by JFLAP, the grammars for Tasks 1 and 2 must be written by you. For grammars G1 and G2, all productions with the same left-hand-side variable must appear in one block one after another. (15%)
2. The zip file and three JFLAP files must be named according to the templates given above. (5%).
Late Submissions: The standard University penalty for late submission is applied, i.e., 5% absolute
standard University scale per day, until the mark reaches zero.
Use of Other Technologies: If you use technologies other than those specified in the assignment brief, e.g., chatGPT, 50% absolute deduction.
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- 碧桂园服务净利降两成,关联交易收入仅占2.9%,发力增值服务充电桩日进超10万
- 倍冲刺 WhatsApp拉群工具 引领你的销售数字勇攀高峰
- 出海必备!Instagram引流推广软件,Ins协议群发工具震撼上线
- 智能潮流导航WhatsApp工具助你轻松穿越商业风云站在最前沿
- 比亚迪首艘汽车滚装运输船首航,拥有 7000 个标准车位
- 火星人集成灶构建智能厨电美学新标准,打造未来厨房新风尚
- instagram2024年最强群发营销软件来袭!ins自动推广引流利器
- “智算融合 共创未来”——开普云AI战略暨新产品发布会召开
- 解决广告费用问题 WhatsApp拉群工具助您实现精打细算广告成本
- Instagram引流营销软件,Ins群发工具,让你的营销事半功倍!
- 数字市场风云:专家心法,LINE营销工具为何引发好奇,业务成功势不可挡
- 自免赛道捷报!国产抗IL-17单抗III期临床数据荣登BJD
- 科技咒语 WhatsApp拉群工具如何在我的业务中施展魔法 创造惊奇效果
- 新华三助力中国邮政私有云平台建设
- 新人爆粉工具!Instagram脚本群发营销工具,Ins自动采集打粉神器!
- 电报群发提高转化软件,Telegram自动化营销工具,TG群发拉群系统
- Ins拉群群发软件,Instagram引流助手,让你的营销无往不利!
- 西部数据通过ASPICE CL3评估认证,满足汽车行业不断变化的需求
- WhatsApp拉群工具出现我的工作仿佛迎来了翻天覆地的变化
- 代写ENG3015、R编程设计代做
- 数字化转型 增材制造企业的未来发展之路
- 创新仙方 科技魔法师的奇迹心得 WhatsApp拉群营销工具点亮商业星空
- TT语音公司六次上榜中国互联网综合实力百强企业
- 威尔特(广州)流体设备有限公司企业文化分析
- 宗庆后40条经典语录,给企业家的宝贵财富!
- instagram爆粉神器,智能采集用户,助你实现社交引流!
- 外贸小白晋级手册 WhatsApp拉群工具是我事业腾飞的不二之选
- 捷泰天域获2023年度中国智能零售行业评选“影响力IT企业”
- CE-Channel: Choose Us for Easy Access to Global Partnerships, Opening the Doors to Overseas Markets
- 未知商机的科技搞笑:踏上未知商机的科技跨境电商 WhatsApp 群发云控搞笑征程,准备好迎接笑料百出的时刻吗
推荐
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技