当前位置:网站首页>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 .
边栏推荐
- h5背景音乐通过触摸自动播放
- 【ONE·Data || 链式二叉树】
- leetcode/和为k的连续子数组个数
- Qt源码分析--QObject(4)
- druid. io kill -9 index_ Realtime traceability task
- The basic concept of transaction and the implementation principle of MySQL transaction
- Mobile communication -- simulation model of error control system based on convolutional code
- 表单校验 隐藏的输入框 显示才校验
- [electronic components] zener diode
- 数学建模——公交调度优化
猜你喜欢

druid. IO custom real-time task scheduling policy

基于C51控制蜂鸣器

【ONE·Data || 链式二叉树】

Solution of Lenovo notebook camera unable to open

LM13丨形态量化-动量周期分析
[electronic components] zener diode

Try to understand the essence of low code platform design from another angle
![[the road of Exile - Chapter 4]](/img/76/e1e249ddb2f963abb5d2b617a5f178.png)
[the road of Exile - Chapter 4]

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

Mathematical modeling - location of police stations
随机推荐
JS dom2 and dom3
Why can't Bi software do correlation analysis
Mathematical modeling -- Optimization of picking in warehouse
基于 ICA 与 DL 的语音信号盲分离
Know that Chuangyu is listed in many fields of ccsip 2022 panorama
「活动推荐」冲冲冲!2022 国际开源节有新内容
物联网开发--MQTT消息服务器EMQX
数学建模——公交调度优化
The basic concept of transaction and the implementation principle of MySQL transaction
Lm13 morphological quantification momentum period analysis
Leetcode/0 and 1 consecutive subarrays with the same number
2022.7.28-----leetcode.1331
[the road of Exile - Chapter 8]
QT memory management tips
【ONE·Data || 链式二叉树】
How companies make business decisions -- with the help of data-driven marketing
(cvpr-2019) selective kernel network
[electronic components] zener diode
druid. The performance of IO + tranquility real-time tasks is summarized with the help of 2020 double 11
数学建模——永冻土层上关于路基热传导问题