compiler

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileToInstructions

func CompileToInstructions(input string, pm parser.Mode) ([]*bytecode.InstructionSet, error)

func CompileToInstructionsWith

func CompileToInstructionsWith(g *bytecode.Generator, input string, pm parser.Mode) ([]*bytecode.InstructionSet, error)

CompileToInstructionsWith is the REPL-friendly variant: callers pass in a generator they own, allowing it to live across multiple compile calls. The generator's prior chunk output is cleared on entry; any other state the caller has stashed on it is preserved.

The pipeline runs lex → parse → typecheck → bytecode. The type-check pass is gated by Luau-style mode directives in the source:

  • `--!nocheck` skips the pass entirely.
  • `--!strict` enables strict mode (implicit-`any` errors etc.).
  • Anything else (default `--!nonstrict`) runs the gradual checker.

Type errors are returned as a *typecheck.TypeErrors with the same shape as parser errors (single error value, multi-line via Error()).

Types

This section is empty.

Directories

Path Synopsis
Package ast defines the abstract syntax tree for luascript, a language with the syntax of Lua 5.4.
Package ast defines the abstract syntax tree for luascript, a language with the syntax of Lua 5.4.
Package bccache is the on-disk bytecode compile cache.
Package bccache is the on-disk bytecode compile cache.
Package bytecode emits a stack-based instruction stream for luascript (Lua 5.4 syntax).
Package bytecode emits a stack-based instruction stream for luascript (Lua 5.4 syntax).
Package constcheck enforces Lua 5.4's local attributes at compile time: a local declared `<const>` or `<close>` may never be assigned after its declaration.
Package constcheck enforces Lua 5.4's local attributes at compile time: a local declared `<const>` or `<close>` may never be assigned after its declaration.
Package debug provides opt-in profiling helpers for the .lsc profile` subcommand.
Package debug provides opt-in profiling helpers for the .lsc profile` subcommand.
Package parser builds an *ast.Program from a token stream produced by the lexer.
Package parser builds an *ast.Program from a token stream produced by the lexer.
errors
Package errors defines the typed parser error used throughout the luascript front-end.
Package errors defines the typed parser error used throughout the luascript front-end.
precedence
Package precedence encodes the Lua 5.4 binary-operator precedence ladder (see Lua 5.4 reference manual §3.4.8).
Package precedence encodes the Lua 5.4 binary-operator precedence ladder (see Lua 5.4 reference manual §3.4.8).
Package typecheck is the Luau-style gradual type checker for luascript.
Package typecheck is the Luau-style gradual type checker for luascript.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL