COMP3173 Syntax Analysis

COMP3173 Assignment 2 Syntax Analysis

Given the set of tokens (pay attention to the underline “_”) and the following CFG grammar

and answer the following questions. Show the detail of each step.

1. Use the grammar to do left-most and right-most derivation on the input “” and draw the parse tree.(12 pt)

2. Eliminate the left recursions. (6 pt)

3. Base on the grammar without left recursions from Q2, left factorize the grammar. (6 pt)

4. Base on the grammar from Q3, find the set and the set. (10 pt)

5. Base on the grammar from Q3, construct the parsing table. (8 pt)

6. Base on the original grammar, construct the DFA from the set of items. (18 pt)

7. Convert the DFA from Q6 to an parsing table. (15 pt)

8. Use the parsing table to parse “”. Show the configuration and the output for each step. (10 pt)

Given the grammar

1. 

2. 

9. Show that the grammar is ambiguous. (6 pt)

10. Find a sentence in the language such that the sentence is ambiguous but left-most derivation and right-most derivation can produce a same parse tree. You need to prove your answer. (9 pt)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值