编译原理chapter 6 -1.ppt

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

Chapter 6 Symbol Table Instructor Jianhui Yue Software College @ SCU compilerscu@21 Major Data Structure The symbol table is a major inherited attribute in a compiler and, after the syntax tree, forms the major data structure. In practical compilers, the symbol table is often involved even with scanner. The principal symbol table operations Insert: stores information provided by name declarations when processing these declarations Lookup: retrieves the information associated to a name when that name is used in the associated code. Delete: removes the information provided by a declaration when this declaration no longer applies. Dictionary Data Structure The symbol table is a typical dictionary data structure. The efficiency of the three basic operations vary according to the organization of the data structure. Typical implementations of dictionary structures Linear lists Various search trees (binary search trees, AVL, B trees) Hash tables The hash table often provides the best choice for implementing the symbol table. All three operations can be performed in almost constant time. Hush Table A hash table is an array of entries, called buckets, indexed by an integer range. A hush function turns the search key into an integer hash value in the index range, and the item corresponding to the search key is stored in the bucket at this index. Care must be taken so that the hush function distributes the key indices as uniformly as possible over the index range, since the hash collisions cause a performance degradation in the lookup and delete operations. Hush function must operate in a constant or almost constant time. Collision Resolution Open addressing Each bucket is capable of holding only one item. Collisions are resolved by inserting new items in successive buckets. The contents of the hash table are limited by the size of the array used for the table. It is difficult to implement a delete operation. Separate chaining Each bucket is a linear (linked) list. Col

文档评论(0)

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

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

1亿VIP精品文档

相关文档