Skip to content

vantoanvh/LuauParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 

Repository files navigation

LuauParser

    LuauParser

Ver License Docs Release Release

A modern, fully featured Luau parser written entirely in Luau
Fully strict-typing with the New Type Solver and optimized for high performance.

Introduction

Only compatibles with New Type Solver.

A complete port of Parser.cpp providing both AST (Abstract Syntax Tree) & CST (Concrete Syntax Tree).
To stay true to the original implementation, the CST does not include low-level trivia such as whitespace.

This Luau parser is primarily intended for plugin development and for building Luau compilers or tooling.
It provides detailed syntax through both AST and CST, making it well suited for advanced language tooling such as linters, formatters, highlighter, refactoring tools, or even a full luau compiler/transpiler.

Performance

This parser is fast because it uses a simple singleton-style procedural design. It just resets its internal variables and runs, avoiding the overhead of more complex architectures.

Code Examples

local Parser = require(path.to.LuauParser)

local success, result = Parser.parse('const foo: (string, ...number) -> (...any) = 123i')

if success then
	print(result.root) -- do anything you want
else
	warn(result.errors)
end

About

A full & optimized Luau parser in luau, both AST and CST with error recovery & various parsing options

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages