Skip to content

feat: Luau's own parser reads mission source - #1134

Merged
vdmkenny merged 2 commits into
mainfrom
feat/mission-source-parser
Oct 13, 2026
Merged

vdmkenny merged 2 commits into
mainfrom
feat/mission-source-parser

Conversation

@vdmkenny

Copy link
Copy Markdown
Collaborator

Reading mission source back (#1126) starts here: Luau's own parser reads the text.

  • formats/dte/source/syntax.zig, in the library: the syntax tree as plain Zig types. Each statement and expression has its line and column, and Tree.get gives a node with its parts as a tagged union.
  • source_parser, a module of its own that links Luau's parser. A C++ shim calls Luau::Parser::parse and writes the tree into flat arrays (luau.h). Comptime checks keep both sides' node layout and numbering the same.
  • Constructs mission source doesn't use, such as loops, method calls, ... and strings with values put into them, come back as unsupported nodes with their places, for the compiler to refuse.
  • deps/luau builds the parser as its own library, luau-ast, as Luau's CMake splits it, and luau on top of it. sltool links the parser without the VM.
  • sltool dte check writes each mission as source and parses it. Every mission in the game folder passes.

Left: the compiler and sltool dte build, the next step of #1126.

Closes #1132

Reading mission source back starts with parsing it, and Luau's own parser
reads exactly the syntax the source is written in. A C++ shim calls it and
writes its tree into flat arrays, which the new source_parser module copies
into the library's syntax tree. Comptime checks keep both sides' layout and
numbering the same. Constructs mission source doesn't use, such as loops,
come back as unsupported nodes with their places, for the compiler to refuse.

deps/luau builds the parser as its own library, luau-ast, as Luau's CMake
splits it, so sltool links the parser without the VM. sltool dte check writes
each mission as source and parses it, which every mission in the game folder
passes.

Closes #1132
…ition

The C++ shim now reads like the platform's shims: their brace and pointer
style, static_cast, and exports named openreliant_. Helpers add a name, a
string or a list of expressions, and one message covers the 255-name limit
for locals, targets and parameters. Bindings split in one place in the
syntax tree. if expressions are named where they are refused, and tests
show that type annotations change nothing, as the docs say.

source.zig's module doc and its symbol table's comments are rewritten in
plain English.
@vdmkenny
vdmkenny merged commit 466f5cd into main Oct 13, 2026
4 checks passed
@vdmkenny
vdmkenny deleted the feat/mission-source-parser branch October 13, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mission source: read the text with Luau's own parser

1 participant