配套资料 计算机编译原理编译原理本科试卷A.docx
《配套资料 计算机编译原理编译原理本科试卷A.docx》由会员分享,可在线阅读,更多相关《配套资料 计算机编译原理编译原理本科试卷A.docx(10页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、华南理工大学期末考试编译原理试卷A考前须知:1.考前请将密封线内填写清楚;2.所有答案请直接答在试卷上;3.考试形式:闭卷;4.本试卷共大题,总分值100分,考试时间120分钟。题号A四五总分得分评卷人Note: Whether English or Chinese doesn t impact your score.Fill in the blanks (18%)a. Normally, A compiler consists of a number of phases. They are Scanner Grammar parser, Semantic analyzer, Sourer C
2、ode Optimizer. , Code Generator, and target code optimizerThe logical units the scanner generates are called Tokens. For a modern programming language, there are five types of token. They are Identifier , ReservedWords,Number,b. Based on the following C source code fragmentint gets(char *s)(if(s = N
3、ULL)(printfCillegal point parameter n); return -1;return 0;)Please answer:a) int is a aprintf? is ab) “s” is a (an)“= = is ac) U is aA grammar G usually includes four components, they are, and.1. (Terms Translation, 12%)Please give a brief explanation to the following terms in compiler science domai
4、na) Compilerb) Source codec) Scannerd) Tokens e) Terminal symbol f) Ambiguous Grammar2. (Scanning; 20%)(10%) Construct an NFA that recognizes the same language as defined by the following regular expression:(a*ba*b)*ba*(a) (10%) Using the subset construction, convert the NFA into a DFA.abA=01,2,5BCB
5、=2BDC=3,6, 7,8)EFD=3DFE=3,7, 8EFF=1,2,4,5(LL parsing; 25%) Consider the following grammar G(S):S-number | ListList - (Seq)Seq - Seq, S | SWhere number and are terminal symbols, and the others symbols are non-terminal.(a) (7%) Please write the left-most derivation for sentence (4, (34)”8%Please conve
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 配套资料 计算机编译原理编译原理本科试卷A 配套 资料 计算机 编译 原理 本科 试卷
限制150内