How_to_implment_PL_in_Antlr4: Skill for Claude Code

.claude/skills/antlr4-dev/SKILL.md

antlr4-dev is a skill for Claude Code from whtoo/How_to_implment_PL_in_Antlr4. It costs 29 tokens per session (1,062 once invoked), scanned A, original, BSD-3-Clause.

A development guide for ANTLR4, a tool that turns text into structured code data. It covers grammar files, syntax trees, and visitor code for walking those trees.

In plain words
What is it for?
Use it to edit lexer and parser rules, regenerate the parser, add syntax-tree nodes, update the tree builder, and run parser tests.
Why use it?
It gives a clear workflow for adding language features and finding grammar conflicts without having to piece together the parser project's structure.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

This is whtoo/How_to_implment_PL_in_Antlr4's own configuration. It tells Claude Code how to work on How_to_implment_PL_in_Antlr4 itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything How_to_implment_PL_in_Antlr4 configures →

Reuse

Borrowing it

Nothing to install: this file belongs to whtoo/How_to_implment_PL_in_Antlr4. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/whtoo/How_to_implment_PL_in_Antlr4/main/.claude/skills/antlr4-dev/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/whtoo/How_to_implment_PL_in_Antlr4

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for antlr4-dev

README.md
[![agentmods](https://agentmods.dev/badge/skills/whtoo/how_to_implment_pl_in_antlr4/antlr4-dev/github.svg)](https://agentmods.dev/skills/whtoo/how_to_implment_pl_in_antlr4/antlr4-dev)
Your own site
<a href="https://agentmods.dev/skills/whtoo/how_to_implment_pl_in_antlr4/antlr4-dev"><img src="https://agentmods.dev/badge/skills/whtoo/how_to_implment_pl_in_antlr4/antlr4-dev/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for antlr4-dev

Your own site · 80×15
<a href="https://agentmods.dev/skills/whtoo/how_to_implment_pl_in_antlr4/antlr4-dev"><img src="https://agentmods.dev/badge/skills/whtoo/how_to_implment_pl_in_antlr4/antlr4-dev.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,062 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00029 $0.01062
Opus 5 $0.00015 $0.00531
Sonnet 5 $0.00006 $0.00212
Haiku 4.5 $0.00003 $0.00106

Measured 3d ago against content hash 7d255404fd9b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

antlr4-dev scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/antlr4-dev/SKILL.md · 114 lines

How it starts

The opening of the file, as written. The whole thing — 114 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ANTLR4前端开发

🎯 垂直职责

单一职责: ANTLR4语法设计、词法/语法分析、AST构建、访问者模式

📦 核心能力

1. 语法文件开发

  • 位置: ep20/src/main/antlr4/org/teachfx/antlr4/ep20/parser/Cymbol.g4
  • 语法结构: lexer规则 → parser规则 → AST构建
  • 重新生成: mvn generate-sources -pl ep20

2. AST节点实现

  • 基类: ASTNode.java (位于 ep20/src/main/java/org/teachfx/antlr4/ep20/ast/)
  • 模式: 访问者模式 accept(ASTVisitor<T>)
  • 扩展: 创建新节点继承 ExprNode / StmtNode

3. 访问者模式

// 新节点标准实现
public class NewStmtNode extends StmtNode {
    private final Type field;

    public NewStmtNode(Type field) {
        this.field = field;
    }

    @Override
    public <T> T accept(ASTVisitor<T> visitor) {
        return visitor.visitNewStmt(this);
    }
}

🔗 关系图

ep-navigator (识别EP范围) ← compiler-dev (AST → IR转换)

🚀 快速开始

添加新语法特性

# 1. 编辑 Cymbol.g4
vim ep20/src/main/antlr4/.../parser/Cymbol.g4

# 2. 重新生成解析器
mvn generate-sources -pl ep20

# 3. 创建AST节点
vim ep20/src/main/java/.../ast/NewNode.java

# 4. 更新AST构建器
vim ep20/src/main/java/.../pass/ast/CymbolASTBuilder.java

# 5. 测试
mvn test -pl ep20 -Dtest="*ParserTest"

调试语法冲突

# 使用TestRig可视化语法树
java -cp "antlr-4.13.2-complete.jar:ep20/target/classes" \
  org.antlr.v4.gui.TestRig Cymbol file -gui test.cymbol

# 诊断冲突
mvn generate-sources -pl ep20 -Xantlr4.show-dfa

📚 Cymbol语法速查

类型 规则 示例
变量声明 declaration int x;
函数定义 functionDef int add(int a, int b) { ... }
结构体 structDef struct Point { int x; int y; }
数组 type '[' expr? ']' int[10] arr;
控制流 ifStmt / whileStmt if (x > 0) { ... }

🛠️ 常用命令

# 语法相关
mvn generate-sources -pl ep20              # 重新生成解析器
mvn test -pl ep20 -Dtest="*Lexer*"         # 测试词法
mvn test -pl ep20 -Dtest="*Parser*"        # 测试语法

# AST相关
mvn test -pl ep20 -Dtest="*AST*"           # 测试AST构建
mvn test -pl ep20 -Dtest="*Visitor*"       # 测试访问者

# 完整前端
mvn compile -pl ep20 && mvn test -pl ep20  # 编译并测试前端

Read the full file on GitHub · 114 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 114 lines · 29 tokens per session scan A 7d255404fd9b

Subscribe to this mod's changes

antlr4-dev is a skill published in the GitHub repository whtoo/How_to_implment_PL_in_Antlr4 (34 stars, last pushed 3mo ago), licensed BSD-3-Clause. It adds 29 tokens to every session and 1,062 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories

pcl-expert

Expert in Persona Control Language (PCL) - language design, compiler architecture, runtime systems, and ecosystem development. Use when the user mentions persona control language, compiler design, language design, DSL, runtime systems, or lexer, or when the task involves Language Design & Specification, Compiler…

personamanagmentlayer/pcl · 73 tokens

migrate-oxfmt

Guide for migrating a project from Prettier or Biome to Oxfmt. Use when asked to migrate, convert, or switch a JavaScript/TypeScript project's formatter from Prettier or Biome to Oxfmt.

oxc-project/oxc · 53 tokens

vera-language

Write programs in the Vera programming language. Use when asked to write, edit, debug, or review Vera code (.vera files). Vera is a statically typed, purely functional language with algebraic effects, mandatory contracts, and typed slot references (@T.n) instead of variable names.

aallan/vera · 61 tokens

detecting-languages

Use when the user wants to know which programming language a file or snippet is. Covers implicit detection in ts-pack parse/process, confirming support with ts-pack list/info, and the SDK detection functions for path, extension, and raw content.

xberg-io/tree-sitter-language-pack · 60 tokens

gograph

Go repository intelligence for Claude Code. Use when reading, navigating, editing, reviewing, or refactoring a Go codebase. Exposes 64 query, analysis, and workflow capabilities through the local gograph MCP server, including bounded first-call exploration, AST-aware call graphs, blast-radius analysis, impact, and…

ozgurcd/gograph · 69 tokens

windows-compat

Audit and harden this Rust repo (code-graph-mcp) for Windows correctness: path-spelling drift between producers, the 32,767-char command-line cap, index-key mismatches, and path predicates that assume one ecosystem's layout. Use whenever touching code that builds, compares, prints, or stores a filesystem path; that…

sdsrss/code-graph-mcp · 165 tokens