Skip to content

resinfo/rescript-lua-ast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReScript Lua AST

This is a ReScript representation of the Lua AST as described here and here, with some minor modifications. This library is not a parser; rather, it can used to build Lua AST from a different AST (perhaps your own language), which can then be used to generate Lua programs with the Printer.res module.

Notes

This is a work in progress, and as such hasn't been published to NPM. Once the test suite is fully fleshed out, this will be available as a library.

Usage

let program = "local hello, world = world, 1"

let ast = Ast.Block(list{
  Local(
    (Id("hello"), list{Id("world")}),
    Some((
      ExprLhs(LhsIdent(Id("world"))),
      list{Number(1.)},
    )),
  ),
})

Printer.print(ast) == program

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

About

A ReScript representation and printer for the Lua AST.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published