Skip to content

dingyi222666/lua-parser

Repository files navigation

lua-parser

work in progress

A Lua 5.3 Lexer & Parser written in pure Kotlin.

Features

  • Kotlin Multiplatform support (JVM / JS / Native)
  • Parse source to AST
  • Transform AST to source code
  • Semantic analysis. Provide type information (Work in progress)

Usage

  • Add the dependency to your gradle file
implementation("io.github.dingyi222666:luaparser:1.0.2")

Ok. Use it like this:

val lexer = LuaLexer("print('hello world')")
val parser = LuaParser()

val root = parser.parse(lexer)

println(AST2Lua().asCode(root))

More usage coming soon.

Special thanks

GavinHigham/lpil53

fstirlitz/luaparse

Rosemose/sora-editor