编译原理编译原理编译原理 (6).ppt

上传人:刘静 文档编号:84314212 上传时间:2023-04-04 格式:PPT 页数:9 大小:61.41KB
返回 下载 相关 举报
编译原理编译原理编译原理 (6).ppt_第1页
第1页 / 共9页
编译原理编译原理编译原理 (6).ppt_第2页
第2页 / 共9页
点击查看更多>>
资源描述

《编译原理编译原理编译原理 (6).ppt》由会员分享,可在线阅读,更多相关《编译原理编译原理编译原理 (6).ppt(9页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、Chapter 1 Introduction Bootstrapping and PortingThere is a strong interaction between the algorithms used by the phases of a compiler and the data structures that support these phases.Algorithms need to be implemented in efficient manner.The choice of data structures is importantCompilerS2Major Data

2、 Structures in CompilerCompilerS3Temporary FilesIntermediate CodeThe Literal TableThe Symbol TableThe Syntax TreeTokensData StructuresWhen a scanner collects characters into a token,it represents the token symbolically as a value of an enumerated data type representing a set of tokens of the source

3、languageSometimes,it is necessary to preserve the character string itself or other information derived from itThe name associated with an identifier tokenThe value of a number tokenIn most languages the scanner needs to generate one token at a time(single symbol lookahead)A single global variable ca

4、n be used to hold the token information.CompilerS4TokensThe syntax tree is constructed as a standard pointer-based structure that is dynamically allocated as parsing proceeds.The tree can be kept as a single variable pointing to the root node.Each node is a record.Its fields represent the informatio

5、n collected by the parser and the semantic analyzer.Sometimes these fields are dynamically allocatedCompilerS5The Syntax TreeThis data structure keeps information associated with identifiers,functions,variables,constants,and data types.The symbol table interacts with almost every phase of the compil

6、er.The insertion,deletion access operations need to be efficient.A standard data type for this purpose is the hash table.CompilerS6The Symbol TableStores constants and strings used in the program.Quick insertion and lookup are essential.Need not allow deletions.CompilerS7The Literal TableDepending o

7、n the kind of intermediate code,it may be kept as An array of text stringsA temporary text fileLinked list of structuresCompilerS8Intermediate CodeComputers did not possess enough memory for an entire program to be kept in memory during compilation.This was solved by using temporary files to hold the products of intermediate steps.Memory constrains are now much smaller problem.Occasionally,compilers generate intermediate files during some of the steps.CompilerS9Temporary Files

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 大学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com