Skip to content

Commit

Permalink
[update] update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
asxez committed Mar 8, 2024
1 parent 9cf60e3 commit e80e118
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ UTF-8编码规则:
## TDOP(TopDownOperatorPrecedence) - 自上而下算符优先
- rbp: right bind power
- lbp: left bind power
- nud: null denotation
- led: left denotation
- nud: null denotation 不吸引左边的操作数
- led: left denotation 吸引左边的操作数

用nud方法的符号:因为常量等非操作符是不关心操作数的,也就不关心左边的操作数,因此变量、字面量等和前置运算符用nud方法。

用led方法的符号:中置运算符和后置运算符都关心左边的操作数,因此用led方法。

expression函数是TDOP的核心,它的参数是一个右绑定权值。原理是从左到右分析表达式,并以运算符为中心的左右操作数的两两处理,判断夹在两个运算符之间的操作数属于哪个运算符。

Expand Down

0 comments on commit e80e118

Please sign in to comment.