当前位置:网站首页>Feynman learning method (symbol table)
Feynman learning method (symbol table)
2022-07-29 02:12:00 【Tell yourself to work hard every day】
Symbol table is a data structure that collects identifier information during compilation , Generally, there are arrays 、 Linked list 、 Hashtable 、 Binary search tree, etc . The same identifiers will be organized together , Form constant table 、 Variable name table 、 Function name table and so on . The compilation phase will continue to generate symbol tables , Constantly use the symbol table to parse , This is also the main overhead of the compilation process .
There are three main functions of the symbol table :
① Lexical analysis stage : The compiler will recognize the identifiers one by one according to the spaces , Then in the same scope , Classify according to symbol attributes , Record it in the symbol table , Each identifier is associated with its data type 、 Scope 、 name 、 The address and other information in memory are bound together . It mainly collects the attributes of symbols .
② Syntax parsing stage : Through the collected symbol table , Build the syntax tree , Mainly to check the legitimacy of the context . For example, in the same scope , When variables with the same name are collected , Will report a mistake , The cause of the error is the repeated definition of variables . Again for instance , Within a new scope , A new symbol table will be generated to collect information , Then suppose there is another internal scope , A new symbol table will be generated for collection , And the symbol table corresponding to this internal scope will have a pointer , Point to the symbol table corresponding to the external scope of the previous layer , When you need to resolve this identifier , If it cannot be found in the symbol table of the current scope , You need to follow the pointer to the symbol table corresponding to the scope of the previous layer , If you can't find it all the way to the symbol table of the outermost scope , You're going to report a mistake , The error message is to use undeclared variables . The main function is to test the legitimacy of the context .
③ The code is preprocessed 、 compile 、 After the compilation , Generated is the target file , stay linux Next is .O file , This file carries many symbol tables , Then you need to go through the linker , Put these .O collect files , link , Generate the final executable binary . Then this process requires a symbol table , Determine the relative address of the identifier in the final binary file and the memory layout area .
边栏推荐
- (arxiv-2018) 重新审视基于视频的 Person ReID 的时间建模
- What is a proxy server? [2022 guide]
- Leetcode 242. valid anagram
- druid. io index_ Realtime real-time query
- (cvpr-2019) selective kernel network
- 数学建模——带相变材料的低温防护服御寒仿真模拟
- Leetcode/0 and 1 consecutive subarrays with the same number
- ciscn 2022 华中赛区 misc
- Leetcode exercise - Sword finger offer 45. arrange the array into the smallest number
- Qt 内存管理小技巧
猜你喜欢

数学建模——红酒品质分类

RGBD点云降采样

MotionLayout--在可视化编辑器中实现动画

JS dom2 and dom3

【云原生与5G】微服务加持5G核心网

Mysql存储json格式数据

Use POI to export excel file, image URL to export file, image and excel file to export compressed package

第十四天:续第十三天标签相关知识
![[the road of Exile - Chapter 4]](/img/76/e1e249ddb2f963abb5d2b617a5f178.png)
[the road of Exile - Chapter 4]

Blind separation of speech signals based on ICA and DL
随机推荐
In 2022, the official data of programming language ranking came, which was an eye opener
Lua log implementation -- print table
Mathematical modeling -- red wine quality classification
什么是作用域和作用域链
The growth path of embedded engineers
QT source code analysis -- QObject (4)
Monadic linear function perceptron: Rosenblatt perceptron
Click the button to slide to the specified position
How to find the right agent type? Multi angle analysis for you!
数学建模——仓内拣货优化问题
Mathematical modeling - location of police stations
leetcode/和大于等于target的连续最短子数组
H5 background music is played automatically by touch
druid. The performance of IO + tranquility real-time tasks is summarized with the help of 2020 double 11
Click back to the top JS
Comprehensive explanation of "search engine crawl"
【MySQL】sql给表起别名
Promise solves asynchrony
[the road of Exile - Chapter 6]
点击按钮,下滑到指定的位置