Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/refreezed/dumbluaparser
Lua parsing library capable of optimizing and minifying code.
https://github.com/refreezed/dumbluaparser
abstract-syntax-tree library lua lua-module lua51 lua52 lua53 lua54 luajit minifier obfuscation optimizer parser pure-lua single-file tokenizer
Last synced: 2 months ago
JSON representation
Lua parsing library capable of optimizing and minifying code.
- Host: GitHub
- URL: https://github.com/refreezed/dumbluaparser
- Owner: ReFreezed
- License: mit
- Created: 2020-07-05T12:00:37.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-23T18:21:54.000Z (over 2 years ago)
- Last Synced: 2023-03-05T08:18:14.221Z (almost 2 years ago)
- Topics: abstract-syntax-tree, library, lua, lua-module, lua51, lua52, lua53, lua54, luajit, minifier, obfuscation, optimizer, parser, pure-lua, single-file, tokenizer
- Language: Lua
- Homepage: http://refreezed.com/luaparser/
- Size: 631 KB
- Stars: 18
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.txt
- License: LICENSE.txt
Awesome Lists containing this project
README
# Dumb Lua Parser
*Dumb Lua Parser* is a library for tokenizing Lua code or creating ASTs (Abstract Syntax Trees) and converting the data back to Lua.
It can also optimize and minify code.The library is a [single Lua file](dumbParser.lua) with no dependencies other than Lua itself.
It works with Lua 5.1, 5.2, 5.3 and 5.4. LuaJIT should work too.
MIT license.Download the latest stable release [here](https://github.com/ReFreezed/DumbLuaParser/releases/latest)
or, if you're cloning the repository, checkout the last commit with a version tag.
Also available on [LuaRocks](https://luarocks.org/modules/refreezed/dumbluaparser).## Basic usage
```lua
local parser = require("dumbParser")local tokens = parser.tokenizeFile("cool.lua")
local ast = parser.parse(tokens)parser.simplify(ast)
parser.printTree(ast)local lua = parser.toLua(ast, true)
print(lua)
```Check out [examples.lua](examples.lua) for some examples.
## Documentation
See the [website](http://refreezed.com/luaparser/docs/) or the top of the [source file](dumbParser.lua).