Build parsers for your domain-specific languages without the pain.
You have a custom format you need to parse:
route GET /users/{id} -> UserController.show;
SELECT name FROM users WHERE age > 25[database]
host = localhost
port = 5432You don't want to write regex spaghetti. You don't want to spend weeks learning parser theory.
This kit lets you describe your language in plain English, and an AI generates a working parser.
- You describe your language to Claude (or Cursor)
- The AI writes and validates the grammar
- You test with sample inputs
- The AI generates parser code in your language (Python, Java, TypeScript, etc.)
The magic: an MCP server gives the AI real parsing tools, so it validates instead of guessing.
docker pull sshailabh1/antlr4-mcp-server:latestClaude Desktop
Add to your config file: claude_desktop_config.json
{
"mcpServers": {
"antlr4": {
"command": "docker",
"args": ["run", "-i", "--rm", "sshailabh1/antlr4-mcp-server:latest"]
}
}
}Start Claude Desktop after saving.
Ask MCP CLient(AI assistant):
"List all available ANTLR4 tools"
You should see 9 tools listed.
Ask Claude:
"I need to parse config files like this:
[server] port = 8080Write a grammar, validate it, and parse my example."
Claude will:
- Write the grammar
- Validate it (catching real errors)
- Show you the parse tree
- Generate a parser in your language
| File | What It Parses |
|---|---|
Hello.g4 |
Simple greetings (learning example) |
Calculator.g4 |
Math expressions with precedence |
RouteDsl.g4 |
HTTP route definitions |
ConfigDsl.g4 |
INI-style config files |
JsonSubset.g4 |
JSON documents |
SqlSubset.g4 |
Basic SQL queries |
Each has a matching sample file in samples/.
Once your grammar works:
"Generate a Python parser with visitor support."
Install the runtime and use it:
pip install antlr4-python3-runtimefrom antlr4 import CommonTokenStream, InputStream
from RouteDslLexer import RouteDslLexer
from RouteDslParser import RouteDslParser
lexer = RouteDslLexer(InputStream(text))
parser = RouteDslParser(CommonTokenStream(lexer))
tree = parser.file_()Python, Java, JavaScript, TypeScript, Go, C#, C++, Swift, PHP, Dart
| Ask This | What Happens |
|---|---|
| "Validate this grammar" | Checks for syntax errors |
| "Parse this input" | Shows the parse tree |
| "Check for ambiguities" | Finds parsing conflicts |
| "Generate a Python parser" | Creates working code |
| "Show the rule dependencies" | Visualizes grammar structure |
Apache 2.0