Skip to content

ssynical/luau-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Luau Parser

A fast lexer and parser for Luau, written in pure Luau.

API

Lexer

Lexer.tokenize(source: string): ({Token}, {string})

Returns an array of tokens (and any error messages)

Parser

Parser.parse(tokens: {Token}): (ASTNode?, {string})

Returns the AST root node (and any error messages)

Parser.format_node(node: ASTNode, indent: number): string

Formats an AST node for debugging

Example Output

Input:

local x = 1 + 2 * 3

AST:

[1:1->1:19] Program
  [1:1->1:19] LocalDecl
    [1:7->1:7] Identifier: "x"
    [1:11->1:19] BinaryExpr: "+"
      [1:11->1:11] NumberLiteral: "1"
      [1:15->1:19] BinaryExpr: "*"
        [1:15->1:15] NumberLiteral: "2"
        [1:19->1:19] NumberLiteral: "3"

Contributing

Contributions welcome!

License

MIT License

See Also

  • Luau - Official Luau language
  • example.luau - Complex test case demonstrating parser capabilities

Made with ❤️ | Last updated 13/12/2025

About

Fast lexer and parser for Luau with full AST support

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages