东南大学编译原理试卷
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
S o ut he a s t Uni v e r si ty E xa mi na ti o n P a per (i n-t e r m) Course Name Principles of Compiling Examination Term Score
Related Major Computer &
Software
Examination Form Close test Test Duration120 Mins
There are 5 problems in this paper. Y ou can write the answers in
English or Chinese on the attached paper sheets.
1.Please construct context-free grammars with ε-free productions
for the following languages (20%).
(1){i|i∈N(Natural number), and i is a palindrome, and (i mod 5)=0}
(2){ω| ω∈(a,b,c,d)* and the numbers of a’s ,b’s and c’s occurred in
ω are even, and ωstarts with a or c , ends with d }
2.Please construct a DFA with minimum states for the following
regular expression. (20%)
(((a|b)*a)*(a|b))*(a|b)
3.Please eliminate the left recursions (if there are)and extract
maximum common left factors (if there are) from the following
context free grammar, and then decide the resulted grammar is
whether a LL(1) grammar by constructing the related LL(1)
parsing table.(20%) Please obey the rules of examination. If you violate the rules, your answer sheets will be invalid
共 2 页第 1 页
S→iEtS|iEtSeS|a
E→E and F|F
F→ F or G|G
G→b
4.Please construct a LR(1) parsing table for the following
ambiguous grammar with the additional conditions that all θi (i=1,2) has the properties of right associative law, andθ2has lower precedence than θ1.(20%)
E→E θ1 E| E θ2 E |(E)|i
5.Please show that if a grammar G is a LL(1) grammar, then G
must be a LR(1) grammar (20%):
共 2 页第 2 页