Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Lua
  3. LPegLJ

LPegLJ

NOASSERTIONLua

A pure LuaJIT implementation of LPeg v1.0, a PEG pattern matching library for Lua, with added left recursion support.

GitHubGitHub
115 stars10 forks0 contributors

What is LPegLJ?

LPegLJ is a pure LuaJIT implementation of LPeg v1.0, a library for Parsing Expression Grammar (PEG) pattern matching in Lua. It provides a complete parser toolkit that allows developers to define complex grammars and parse text efficiently while maintaining full compatibility with the original LPeg API. The project extends LPeg with additional features like left recursion support and stream parsing capabilities.

Target Audience

LuaJIT developers who need advanced text parsing capabilities, particularly those building compilers, interpreters, data processors, or domain-specific languages that require sophisticated grammar definitions.

Value Proposition

Developers choose LPegLJ because it offers the proven LPeg API with enhanced features like left recursion support and stream parsing, all implemented efficiently in pure LuaJIT without external dependencies. It provides better performance and additional capabilities compared to standard LPeg while maintaining complete compatibility.

Overview

LPeg version 1.0 Parser in pure LuaJIT

Use Cases

Best For

  • Implementing complex grammars with left recursion requirements
  • Building parsers for domain-specific languages in LuaJIT
  • Processing continuous data streams with infinite parsing
  • Debugging parsing grammars with VM action tracing
  • Creating persistent grammar definitions that can be saved and loaded
  • Optimizing performance of complex parsers with memoization

Not Ideal For

  • Projects using standard Lua or non-JIT environments
  • Simple text processing tasks where basic string functions or regex suffice
  • Teams requiring the latest LPeg features or updates beyond version 1.0

Pros & Cons

Pros

Full LPeg Compatibility

Maintains complete syntactical and functional backward compatibility with LPeg v1.0, allowing seamless migration of existing grammars without modification.

Advanced Grammar Support

Adds direct and indirect left recursion based on Sérgio Medeiros' algorithm, enabling more expressive and natural grammar definitions for complex parsers.

Persistent Pattern Storage

Patterns can be serialized and loaded, as mentioned in the README, facilitating persistent grammar definitions and reuse across sessions.

Stream Parsing Capability

Supports infinite parsing in stream mode, making it ideal for processing continuous data streams like logs or network protocols without memory overload.

Cons

LuaJIT Exclusive

Only works with LuaJIT 2.x, as stated in the README, which restricts its use in standard Lua or other Lua implementations, limiting portability.

Based on Outdated Version

Reimplements LPeg v1.0, so it may lack newer features, bug fixes, or performance improvements from subsequent releases of the original library.

Steep Learning Curve

Requires understanding of PEG concepts and LuaJIT specifics, with the README providing minimal tutorials, making it less accessible for beginners.

Frequently Asked Questions

Quick Stats

Stars115
Forks10
Contributors0
Open Issues3
Last commit4 years ago
CreatedSince 2013

Tags

#luajit#ffi#memoization#pattern-matching#text-processing#left-recursion#stream-parsing#parser-generator#lua#parsing-expression-grammar

Built With

L
LuaJIT
F
FFI
L
Lua

Included in

Lua4.5k
Auto-fetched 18 hours ago

Related Projects

json.luajson.lua

A lightweight JSON library for Lua

Stars2,175
Forks376
Last commit2 years ago
lua-cjsonlua-cjson

Lua CJSON is a fast JSON encoding/parsing module for Lua

Stars993
Forks506
Last commit2 years ago
lua-cmsgpacklua-cmsgpack

A self contained Lua MessagePack C implementation.

Stars380
Forks122
Last commit4 years ago
lua-pblua-pb

Lua Protocol Buffers

Stars293
Forks91
Last commit8 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub