Hacker News new | ask | show | jobs
by pederb72 5581 days ago
PEG for Lua is pretty easy to use and experiment with: http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html
1 comments

notably: lpeg uses backtracking over packrat parsing
Packrat parsing has fairly horrible memory usage. LPEG is amazingly frugal in terms of code size, run time, and memory usage.

It's worth noting that the PEG ordered choice operator leads to much more restricted backtracking than occurs in most regex implementations, so LPEG has much more predictable performance. And unlike a DFA matched you still get straightforward capture handling.