Some people turn their homes into packrat middens. 有些人把自己的住处变成了老鼠堆。
Packrat parsing solves the problem of this kind of parser, i.e.exponential parse time. Packrat解析解决了诸如指数级解析时间的问题。
The solution of Packrat parsing is to use memoization, i.e.storing intermediate parsing results, instead of calculating these results over and over. Packrat解析的解决方法是使用记忆化,例如将解析的中间结果保存下来,而不是一遍一遍的重新计算。
This allows for the runtime behavior to be linear, but has the downside of relatively large memory requirements, potentially multiple times the size of the input source. 这决定了Packrat解析的时间复杂度是线性的,但是缺点是需要很大的内存,通常是源代码大小的几倍。