Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
LPeg version 0.12 Parser in pure LuaJIT
branch: master

LPegLJ v.12.2

LPeg Parser in pure LuaJIT
(straight Lua + FFI translation of LPeg C code)
based on LPeg v.12 - PEG pattern matching for Lua & PUC-Rio written by Roberto Ierusalimschy

left recursion support is based on Sérgio Medeiros algorithm


local lpeglj = require"lpeglj"  
local pattern = lpeglj.P("a") 
-- then:
lpeglj.match(pattern, "a") 
-- or, equivalently:  


  • full syntactical and functional backward compatibility with LPeg v.12
  • works only with LuaJIT 2.x

Differences from LPeg v.12:

  • LPegLJ supports direct and indirect left recursion based on Sérgio Medeiros algorithm (
  • patterns can be saved and loaded
  • supports memoization (restricted) - useful for complex grammars
  • can be used in stream mode (infinite parsing)
Something went wrong with that request. Please try again.