当前位置:网站首页>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 .
边栏推荐
- 表单校验 隐藏的输入框 显示才校验
- Mobile communication -- simulation model of error control system based on convolutional code
- FPGA实现10M多功能信号发生器
- Mathematical modeling -- the laying of water pipes
- druid. io index_ Realtime real-time query
- 物联网开发--MQTT消息服务器EMQX
- leetcode/和为k的连续子数组个数
- Mathematical modeling -- red wine quality classification
- Ciscn 2022 central China Misc
- Flexible layout single selection
猜你喜欢

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

druid. io kill -9 index_ Realtime traceability task

MySQL high performance optimization notes (including 578 pages of notes PDF document), collected

Navigation--实现Fragment之间数据传递和数据共享

Try to understand the essence of low code platform design from another angle
![[the road of Exile - Chapter 2]](/img/98/0a0558dc385141dbb4f97bc0e68b70.png)
[the road of Exile - Chapter 2]

Implementation of 10m multifunctional signal generator with FPGA
![[the road of Exile - Chapter 7]](/img/3c/8b4b7c40367b8b68d0361d9ca4013a.png)
[the road of Exile - Chapter 7]

Introduction to shared data center agent

In 2022, the official data of programming language ranking came, which was an eye opener
随机推荐
Mathematical modeling -- Optimization of picking in warehouse
Number of consecutive subarrays with leetcode/ and K
QT memory management tips
[circuit design] peak voltage and surge current
Understand the clock tree in STM32 in simple terms
JetPack--Navigation实现页面跳转
Force deduction brush question (2): sum of three numbers
leetcode/乘积小于K 的连续子数组的个数
数学建模——永冻土层上关于路基热传导问题
[the road of Exile - Chapter 8]
Comprehensive analysis of news capture doorway
Mysql存储json格式数据
数学建模——红酒品质分类
leetcode 242. Valid Anagram(有效的字母异位词)
[云原生]微服务架构是什么
第十四天:续第十三天标签相关知识
IDEA 连接 数据库
数学建模——公交调度优化
弹性布局 单选
Leetcode/ and continuous shortest subarray greater than or equal to target