@rcs-lang/parser
v2.0.1
Published
ANTLR grammar for RCL
Readme
ANTLR Parser for RCL
This package contains the ANTLR4 grammar and parser for the RCL language.
Building
The ANTLR parser requires Java to generate the TypeScript parser from the grammar files.
Prerequisites
- Java 17 or later must be installed
- Run
./install-java.shfor installation instructions
Build Process
# 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
Development
Grammar Files
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
Generated Files
The src/generated/ directory contains the generated parser files. These are created by ANTLR and should not be edited manually.
Using Pre-built Parser
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
Testing
bun testTests include:
- Grammar validation
- Parser functionality
- Context variable support
