MCP server enabling AI assistants to help with ANTLR4 grammar development.
docker pull sshailabh1/antlr4-mcp-server:latestConfigure your MCP client:
{
"mcpServers": {
"antlr4": {
"command": "docker",
"args": ["run", "-i", "--rm", "sshailabh1/antlr4-mcp-server:latest"]
}
}
}./mvnw clean package -DskipTests{
"mcpServers": {
"antlr4": {
"command": "java",
"args": ["-jar", "/path/to/antlr4-mcp-server-0.2.0.jar"]
}
}
}| Tool | Purpose |
|---|---|
validate_grammar |
Syntax validation with error suggestions |
parse_sample |
Parse input, return tree (interpreter mode) |
detect_ambiguity |
Find parsing ambiguities |
analyze_left_recursion |
Detect recursion patterns |
analyze_first_follow |
Compute FIRST/FOLLOW sets |
analyze_call_graph |
Rule dependencies, cycles, unused rules |
visualize_atn |
ATN state diagrams (DOT/Mermaid) |
compile_grammar_multi_target |
Generate parsers (10 languages) |
profile_grammar |
Performance profiling |
Validate and parse "2 + 3 * 4":
grammar Calc;
expr: expr ('*'|'/') expr | expr ('+'|'-') expr | NUMBER ;
NUMBER: [0-9]+ ;
WS: [ \t\r\n]+ -> skip ;
Java, Python, JavaScript, TypeScript, C++, C#, Go, Swift, PHP, Dart
| Document | Purpose |
|---|---|
| Quick Start | Setup in 5 minutes |
| Tool Usage | Complete tool reference |
| Development | Build, test, contribute |
| Examples | Calculator, JSON grammars |
| Constraint | Value |
|---|---|
| Max grammar size | 10 MB |
| Max input size | 1 MB |
| Timeout | 30 seconds |
| Imports | Not supported (inline all rules) |
Apache License 2.0