vm-dev — community vm-dev, How_to_implment_PL_in_Antlr4, community, ide skills, Claude Code, Cursor, Windsurf

vv1.0
GitHub

About this Skill

Ideal for Advanced Language Agents focusing on bytecode execution and virtual machine development. 简明自制编程语言教程,同时是antlr非官方参考🌰。这里也是cyson这门语言的缘起。

whtoo whtoo
[0]
[0]
Updated: 3/5/2026

Agent Capability Analysis

The vm-dev skill by whtoo is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance.

Ideal Agent Persona

Ideal for Advanced Language Agents focusing on bytecode execution and virtual machine development.

Core Value

Empowers agents to design and implement custom bytecode instruction sets, such as IADD and ISUB, and manage stack frames and memory using Java-based implementations like CymbolStackVM and CymbolRegisterVM.

Capabilities Granted for vm-dev

Implementing custom instruction sets for domain-specific languages
Developing stack-based virtual machines for efficient bytecode execution
Optimizing memory management and garbage collection for virtual machines

! Prerequisites & Limits

  • Requires Java development environment
  • Focused on stack-based and register-based virtual machine architectures
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

vm-dev

Install vm-dev, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

虚拟机开发

🎯 垂直职责

单一职责: 虚拟机实现 - 字节码执行、指令集、栈帧、内存管理、垃圾回收

📦 核心能力

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 → 字节码)

🚀 快速开始

添加新指令

bash
1# 1. 定义操作码 2vim ep18/src/main/java/.../BytecodeDefinition.java 3// enum OpCode { ..., NEW_OP(0x20); } 4 5# 2. 实现指令类 6vim ep18/src/main/java/.../instruction/NewOpInstruction.java 7public class NewOpInstruction extends Instruction { 8 @Override 9 public void execute(ExecutionContext ctx) { 10 // 实现逻辑 11 } 12} 13 14# 3. 注册指令 15vim ep18/src/main/java/.../InstructionFactory.java 16 17# 4. 测试 18mvn test -pl ep18 -Dtest="*NewOpInstruction*"

实现垃圾回收

bash
1# 1. 定义对象头 2class ObjectHeader { 3 Type type; 4 boolean marked; 5 int size; 6} 7 8# 2. 实现标记阶段 9void mark(VarSlot root) { 10 Object obj = heap.get(root); 11 if (obj != null && !obj.header.marked) { 12 obj.header.marked = true; 13 for (VarSlot field : obj.getReferences()) { 14 mark(field); 15 } 16 } 17} 18 19# 3. 实现清除阶段 20void sweep() { 21 heap.removeIf(obj -> !obj.header.marked); 22}

📊 栈帧结构

┌─────────────────────────────────┐
│     返回地址 (Return Address)    │
├─────────────────────────────────┤
│     局部变量区 (Locals)          │
│     [0] [1] [2] [3] ...         │
├─────────────────────────────────┤
│     操作数栈 (Operand Stack)     │
│     [...] [...] [...]           │
└─────────────────────────────────┘

🛠️ 常用命令

bash
1# 虚拟机相关 2mvn compile -pl ep18 # 编译EP18 3mvn test -pl ep18 -Dtest="*Instruction*" # 测试指令 4mvn test -pl ep18 -Dtest="*VM*" # 测试VM 5mvn test -pl ep18 -Dtest="*GC*" # 测试GC 6 7# 运行程序 8mvn exec:java -pl ep18 -Dexec.args="program.cx"

📐 指令格式速查

指令操作码操作数栈效果描述
ICONST0x01value→ value加载整数常量
IADD0x10-a,b → a+b整数加法
ISUB0x11-a,b → a-b整数减法
LOAD0x20index→ value加载局部变量
STORE0x21indexvalue →存储局部变量
CALL0x30addrargs... →调用函数
RET0x31-value →返回函数
JMP0x40offset无条件跳转
CONDJMP0x41offsetcond →条件跳转

⚠️ 常见问题

问题原因解决方案
栈溢出操作数栈超限检查指令栈平衡
栈下溢弹出空栈验证指令前置条件
类型错误操作数类型不匹配添加类型检查
内存泄漏GC未正确标记检查根集完整性

版本: v1.0 | 垂直职责: 虚拟机实现 | 2025-12-23

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is vm-dev?

Ideal for Advanced Language Agents focusing on bytecode execution and virtual machine development. 简明自制编程语言教程,同时是antlr非官方参考🌰。这里也是cyson这门语言的缘起。

How do I install vm-dev?

Run the command: npx killer-skills add whtoo/How_to_implment_PL_in_Antlr4. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for vm-dev?

Key use cases include: Implementing custom instruction sets for domain-specific languages, Developing stack-based virtual machines for efficient bytecode execution, Optimizing memory management and garbage collection for virtual machines.

Which IDEs are compatible with vm-dev?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for vm-dev?

Requires Java development environment. Focused on stack-based and register-based virtual machine architectures.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add whtoo/How_to_implment_PL_in_Antlr4. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use vm-dev immediately in the current project.

Related Skills

Looking for an alternative to vm-dev or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI