- Expert C++
- Vardan Grigoryan Shunguang Wu
- 158字
- 2021-06-24 16:33:54
Tokenization
The analysis phase of the compiler aims to split the source code into small units called tokens. A token may be a word or just a single symbol, such as = (the equals sign). A token is the smallest unit of the source code that carries meaningful value for the compiler. For example, the expression int a = 42; will be divided into the tokens int, a, =, 42, and ;. The expression isn't just split by spaces, because the following expression is being split into the same tokens (though it is advisable not to forget the spaces between operands):
int a=42;
The splitting of the source code into tokens is done using sophisticated methods using regular expressions. It is known as lexical analysis, or tokenization (dividing into tokens). For compilers, using a tokenized input presents a better way to construct internal data structures used to analyze the syntax of the code. Let's see how.
- 工程軟件開發(fā)技術(shù)基礎(chǔ)
- 架構(gòu)不再難(全5冊)
- Vue.js 2 and Bootstrap 4 Web Development
- Arduino開發(fā)實戰(zhàn)指南:LabVIEW卷
- Vue.js快跑:構(gòu)建觸手可及的高性能Web應(yīng)用
- Learning Bayesian Models with R
- H5頁面設(shè)計:Mugeda版(微課版)
- 鴻蒙OS應(yīng)用編程實戰(zhàn)
- C語言程序設(shè)計實訓(xùn)教程與水平考試指導(dǎo)
- Vue.js 3應(yīng)用開發(fā)與核心源碼解析
- Web前端開發(fā)最佳實踐
- Getting Started with Windows Server Security
- 第五空間戰(zhàn)略:大國間的網(wǎng)絡(luò)博弈
- Swift語言實戰(zhàn)晉級(第2版)
- 從零開始:Qt可視化程序設(shè)計基礎(chǔ)教程