《Crafting Interpreters》中jlox(Part I中用java实现的Lox语言)用了recursive descent parsing去实现parser。为了偷懒,下面用RD代指recursive descent parsing这个方法。 设计简易计算器 假如我们现在要实现一个支持加减乘除的计算器,那parser应该怎么设计? 并不是所有的输入都是支持的,比如输入“1 +/ 2” 不同运算符...
However, recursive descent parsing is a rather slow method compared to LL(k) or LR(k) algorithms. Still, parsing with funcparserlib is at least twice faster than PyParsing, a very popular library for Python.The source code of funcparserlib is only 1.2K lines of code, with lots of ...