编译原本科试卷A.doc

  1. 1、本文档共11页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
编译原本科试卷A

姓名 学号 姓名 学号 学院 班级 座位号 ( 密 封 线 内 不 答 题 ) ……………………………………………………密………………………………………………封………………………………………线……………………………………线……………………………………… _____________ ________ … 华南理工大学期末考试 《 编译原理 》试卷A 注意事项:1. 考前请将密封线内填写清楚; 2. 所有答案请直接答在试卷上; 3.考试形式:闭卷; 4. 本试卷共 大题,满分100分, 考试时间120分钟。 题 号 一 二 三 四 五 总分 得 分 评卷人 Note: Whether English or Chinese doesn’t impact your score. Fill in the blanks (18%) a. Normally, A complier consists of a number of phases. They are Scanner Grammar parser, ____Semantic analyzer_____, ___Source Code Optimizer___, Code Generator, and __target code optimizer _________________. b. The logical units the scanner generates are called Tokens. For a modern programming language, there are five types of token. They are __Identifier__, _______Reserved Words________, _____Number_____________, ____________________, ________________. c. Based on the following C source code fragment int gets(char *s) int gets(char *s) { if (s == NULL) { printf(“illegal point parameter \n”); return -1; } return 0; } Please answer: a) “int” is a ___________________ b) “printf” is a _________________ c) “s” is a (an) _________________ d) “= =” is a ____________________ e) “0” is a _____________________ d. A grammar G usually includes four components, they are _______________, __________________, _______________, and _____________________. (Terms Translation, 12%) Please give a brief explanation to the following terms in compiler science domain Compiler —— Source code —— Scanner —— Tokens —— Terminal symbol —— Ambiguous Grammar —— (Scanning; 20%) (a) (10%) Construct an NFA that recognizes the same language as defined by the following regular expression: (a*ba*b)*ba* (b) (10%) Using the subset construction, convert the NFA into a DFA. a b A={0,1,2,5} B C B={2} B D C={3,6, 7,8} E F D={3} D F E={3,7, 8} E F F={1,2,4,5} B C 4. (LL parsing; 25%) Consider the followi

您可能关注的文档

文档评论(0)

ybcm963 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档