跳至正文
Wener Notes

Parser Glossary

约 2 分钟阅读
标签:Glossary
Abbr.Wordcn
BNFBackus–Naur form巴科斯范式 - 1959 John Backus
EBNFextended BNF扩展巴科斯范式 - ISO-14977
DFADeterministic finite automaton确定有限状态自动机
NFANondeterministic finite automaton非确定有限状态自动机
CFGContext free grammar上下文无关语法
TDPLTop-Down Parsing Language
Left-to-right, Leftmost derivationtop-down - 1970s
LLRLL-regular
LRLeft-to-right, Rightmost derivation in reversebottom-up - 1965 Donald Knuth
DCFGDeterministic Context Free Grammar
PEGParsing expression grammar解析表达文法 - 2004 Bryan Ford
ANTLRANother Tool for Language Recognition
LALRLook-Ahead LR parser简化版的 LR
SLR
Canonical LR(1)
Minimal LR(1)
GLRGeneralized LR parser广义 LR 解析器
RPNReverse Polish notation
ASTAbstract Syntax Tree抽象语法树
CSTConcrete Syntax Tree具体语法树
CSGContext-sensitive grammar上下文相关语法
encn
grammar语法
syntax语法
semantics语义
expression表达式
term
graph TD;
    CFG-->DCFG
    DCFG-->LL --> LL_k
    LL --> LL_inf
    LL_k --> JavaCC
    LL_inf --> Antlr4

    LL_inf["LL(*)"]
    LL_k["LL(k)"]

右递归

  • A -> αA | β
  • 不会导致无限递归,更容易处理。
  • 可能会导致更深的递归调用栈,但现代的 Parser 能优化这种情况。

左递归

Packrat

  • 动态规划
  • 在解析过程中缓存(memoization)中间结果
  • 适合处理具有无限前瞻能力的语法。
  • 优点
    • 能够处理左递归和右递归。
    • 解析速度快,适合实时解析。
  • 缺点
    • 需要额外的内存空间。

关联信息

反向链接、本文链接的其他页面和外部资料。

参考资料

GitHub1 条
Wikipedia4 条
其他外链1 条
最近更新commit 757e3ce编辑