编译过程概述 2.词法分析 任务 输入源程序;扫描、分解字符串,识别出一 个个单词(定义符、标识符、运算符、界符 常数) 所做转换 源程序字符串 单词符号 依据 主要理论基础 构词规则 自动机理论
2.词法分析 任务 所做转换 依据 构词规则 主要理论基础 自动机理论 源程序字符串 单词符号 输入源程序;扫描、分解字符串,识别出一 个个单词(定义符、标识符、运算符、界符、 常数)
有关术语 词法分析(lexical analysis or scanning) --The stream of characters making up a source program is read from left to right and grouped into tokens,which are sequences of characters that have a collective meaning. 单词-token 保留字-reserved word 标识符--identifier(user-defined name
有关术语 ❖ 词法分析(lexical analysis or scanning) --The stream of characters making up a source program is read from left to right and grouped into tokens,which are sequences of characters that have a collective meaning. ❖ 单词---token ❖ 保留字---reserved word ❖ 标识符 ---identifier(user-defined name)