https://github.com/sacek/LPegLJ
LPeg version 1.0 Parser in pure LuaJIT
https://github.com/sacek/LPegLJ
Last synced: 8 months ago
JSON representation
LPeg version 1.0 Parser in pure LuaJIT
- Host: GitHub
- URL: https://github.com/sacek/LPegLJ
- Owner: sacek
- License: other
- Created: 2013-06-14T14:25:01.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-05-09T09:55:51.000Z (almost 4 years ago)
- Last Synced: 2024-11-25T02:33:17.456Z (over 1 year ago)
- Language: Lua
- Homepage:
- Size: 241 KB
- Stars: 109
- Watchers: 13
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-lua - LPegLJ - A pure LuaJIT implementation of LPeg v1.0. (Resources / Parsing and Serialization)
README
LPegLJ v1.0
=============
LPeg Parser in pure LuaJIT
(straight Lua + FFI translation of LPeg C code)
based on LPeg v1.0 - PEG pattern matching for Lua
Lua.org & PUC-Rio written by Roberto Ierusalimschy
http://www.inf.puc-rio.br/~roberto/lpeg/
left recursion support is based on Sérgio Medeiros algorithm
http://arxiv.org/abs/1207.0443
### Usage:
```Lua
local lpeglj = require"lpeglj"
local pattern = lpeglj.P("a")
-- then:
lpeglj.match(pattern, "a")
-- or, equivalently:
pattern:match("a")
```
### Compatibility:
- full syntactical and functional backward compatibility with LPeg v1.0
- works only with LuaJIT 2.x
### Differences from LPeg v1.0:
Description in doc/USAGE.md
- LPegLJ supports direct and indirect left recursion based on Sérgio Medeiros algorithm (http://arxiv.org/abs/1207.0443)
- patterns can be saved and loaded
- supports memoization (restricted) - useful for complex grammars
- can be used in stream mode (infinite parsing)
- VM action runtime listing (tracing) for debugging purposes