This package contains the ANTLR4 grammar and parser for the RCL language.
The ANTLR parser requires Java to generate the TypeScript parser from the grammar files.
- Java 17 or later must be installed
- Run
./install-java.shfor installation instructions
# Install dependencies
bun install
# Generate parser and build TypeScript
bun run buildThis will:
- Generate TypeScript parser files from the ANTLR grammar
- Fix import paths in the generated files
- Compile TypeScript to JavaScript
src/RclLexer.g4- Lexer grammar (tokenization rules)src/RclParser.g4- Parser grammar (syntax rules)src/RclLexerBase.ts- Base class for lexer with Python-like indentation support
The src/generated/ directory contains the generated parser files. These are created by ANTLR and should not be edited manually.
If you cannot install Java, you can:
- Ask someone with Java to run
bun run buildand commit the generated files - Use the pre-built parser from a CI/CD system
- Use a Docker container with Java pre-installed
bun testTests include:
- Grammar validation
- Parser functionality
- Context variable support