词法分析,语法分析

最近看到公司的产品有词法分析,语法分析,很有意思,阅读,学习,记录下。

1. 词法分析 

lexical analysis is the process of converting a sequence of characters into a sequence of tokens。

比如:Time()<="080000",要让计算器知道Time()是什么意思,计算机认不认识,究其源头是已被定义的,可能是你可能是我也可能是其它人。这里预先定义一些原子Time()我们才明白“080000”是什么意思。

 

2. 语法分析

syntactic analysis , is the process of analyzing a sequence of tokens to determine their grammatical structure with respect to a given (more or less) formal grammar . And it checks for correct syntax and builds a data structure (often some kind of parse tree , abstract syntax tree or other hierarchical structure) implicit in the input tokens.

比如:Time()<="080000",要让计算器知道这一句Time()<="080000"是什么意思,源头依旧是我们定义的,时间小于 8 点 0 分 0 秒

 

3. 个人理解

是一个从小到大、从大到小的过程。像编译器中,我们定义char c,计算器知道要去划一个字节的空间。c = 'A‘; 把划分的一字节空间写入41H。

 

posted @ 2019-03-12 10:02  ashen~  阅读(433)  评论(0编辑  收藏  举报