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.
curl -O https://raw.githubusercontent.com/whtoo/How_to_implment_PL_in_Antlr4/main/.claude/skills/vm-dev/SKILL.mdgit clone --depth 1 https://github.com/whtoo/How_to_implment_PL_in_Antlr4Wrote 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.
[](https://agentmods.dev/skills/whtoo/how_to_implment_pl_in_antlr4/vm-dev)<a href="https://agentmods.dev/skills/whtoo/how_to_implment_pl_in_antlr4/vm-dev"><img src="https://agentmods.dev/badge/skills/whtoo/how_to_implment_pl_in_antlr4/vm-dev.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00032 | $0.01339 |
| Opus 5 | $0.00016 | $0.00669 |
| Sonnet 5 | $0.00006 | $0.00268 |
| Haiku 4.5 | $0.00003 | $0.00134 |
Grade A, and why
vm-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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 143 lines — stays where its author put it; the contents beside it link to each section on GitHub.
虚拟机开发
🎯 垂直职责
单一职责: 虚拟机实现 - 字节码执行、指令集、栈帧、内存管理、垃圾回收
📦 核心能力
1. 字节码设计 (EP13-EP15)
- 定义:
BytecodeDefinition.java - 指令集: IADD, ISUB, IMUL, IDIV, LOAD, STORE, CALL, RET, JMP
- 操作数栈: 后进先出 (LIFO)
2. 栈式虚拟机 (EP18)
- 位置:
ep18/src/main/java/org/teachfx/antlr4/ep18/stackvm/ - 核心:
CymbolStackVM.java - 栈帧:
StackFrame.java(局部变量 + 操作数栈 + 返回地址)
3. 寄存器虚拟机 (EP18R)
- 位置:
ep18r/src/main/java/org/teachfx/antlr4/ep18r/regvm/ - 核心:
CymbolRegisterVM.java - 寄存器分配: 基于ABI约定的寄存器使用
4. 内存管理 (EP18/EP18R)
- 堆内存:
HeapMemory.java - GC: 标记-清除算法
- 对象布局: 类型信息 + 字段数据
🔗 关系图
→ ep-navigator (识别EP范围) → compiler-dev (IR → 字节码)
🚀 快速开始
添加新指令
# 1. 定义操作码
vim ep18/src/main/java/.../BytecodeDefinition.java
// enum OpCode { ..., NEW_OP(0x20); }
# 2. 实现指令类
vim ep18/src/main/java/.../instruction/NewOpInstruction.java
public class NewOpInstruction extends Instruction {
@Override
public void execute(ExecutionContext ctx) {
// 实现逻辑
}
}
# 3. 注册指令
vim ep18/src/main/java/.../InstructionFactory.java
# 4. 测试
mvn test -pl ep18 -Dtest="*NewOpInstruction*"
实现垃圾回收
# 1. 定义对象头
class ObjectHeader {
Type type;
boolean marked;
int size;
}
# 2. 实现标记阶段
void mark(VarSlot root) {
Object obj = heap.get(root);
if (obj != null && !obj.header.marked) {
obj.header.marked = true;
for (VarSlot field : obj.getReferences()) {
mark(field);
}
}
}
# 3. 实现清除阶段
void sweep() {
heap.removeIf(obj -> !obj.header.marked);
}
📊 栈帧结构
┌─────────────────────────────────┐
│ 返回地址 (Return Address) │
├─────────────────────────────────┤
│ 局部变量区 (Locals) │
│ [0] [1] [2] [3] ... │
├─────────────────────────────────┤
│ 操作数栈 (Operand Stack) │
│ [...] [...] [...] │
└─────────────────────────────────┘
🛠️ 常用命令
# 虚拟机相关
mvn compile -pl ep18 # 编译EP18
mvn test -pl ep18 -Dtest="*Instruction*" # 测试指令
mvn test -pl ep18 -Dtest="*VM*" # 测试VM
mvn test -pl ep18 -Dtest="*GC*" # 测试GC
# 运行程序
mvn exec:java -pl ep18 -Dexec.args="program.cx"
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.
- yesterday First seen · 143 lines · 32 tokens per session scan A 26604f44adb1
vm-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 32 tokens to every session and 1,339 once invoked, about $0.0002 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.
Other skills, from other repositories
edge-python
Write, run, test and package Edge Python programs with the edge CLI. Use when editing .py files in an Edge Python project or when the user asks for Edge Python code.
functions-development
Build serverless Go or Python functions for Falcon Foundry apps. TRIGGER when user asks to "create a function", "write a serverless function", "build backend logic", runs foundry functions create, or needs help with FDK handler patterns, function testing, or collection integration from functions. Also TRIGGER when…
jar-analysis
Explore, search, read, and decompile Java JAR, WAR, EAR, AAR, and Spring Boot fat-jar files via the dejared MCP server. Use this skill whenever the user references a .jar file path, asks what a third-party Java library does, wants to read a config embedded in a JAR (application.yml, spring.factories, MANIFEST.MF)…
maven-code-search
Use the Maven Decoder MCP server to inspect code, APIs, methods, dependencies, versions, and usage examples from Maven artifacts installed in the user's local /.m2 repository. Use when working on Java, Maven, Gradle, Spring, Jakarta, Android, or JVM projects and the user asks about dependency internals, installed…
matlab
Build, review, migrate, and safely plan MATLAB or GNU Octave numerical workflows, including arrays, tabular/time data, tests, projects, graphics, MAT files, and explicit Python interoperability.
ast-grep
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for…