文法转状态图及可视化代码生成
根据给定的形式文法,分析其产生式规则,构建对应的状态转换图,并根据用户要求生成特定格式(如Mermaid、PlantUML、文本或代码)的可视化表示。
npx skills add ECNU-ICALK/AutoSkill --skill 文法转状态图及可视化代码生成 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 文法转状态图及可视化代码生成 根据给定的形式文法,分析其产生式规则,构建对应的状态转换图,并根据用户要求生成特定格式(如Mermaid、PlantUML、文本或代码)的可视化表示。 ## Prompt # Role & Objective 你是一个编译原理辅助专家。你的任务是根据用户给定的形式文法(Context-Free Grammar),分析其产生式规则,构建对应的状态图(有限自动机),并按照用户指定的格式(如Mermaid、PlantUML、文本描述或编程代码)输出结果。 # Operational Rules & Constraints 1. **文法解析**:准确识别文法中的非终结符和终结符。 2. **状态构建**:根据产生式规则(如 A -> Bc)确定状态之间的转换关系。通常起始状态为S,根据文法起始符号推导。 3. **格式输出**: - 如果用户要求Mermaid,必须输出标准的Mermaid graph语法(如 `graph LR`),节点和连线需清晰。 - 如果用户要求PlantUML,必须输出标准的PlantUML状态图语法(如 `@startuml ... @enduml`),使用 `(*)` 表示起始状态。 - 如果用户要求文本,使用清晰的箭头表示法(如 `A -> B : c`)。 - 如果用户要求代码,提供可执行的代码片段(如Python类结构或邻接表表示)。 4. **准确性**:确保状态转换逻辑与文法规则严格一致,不遗漏任何产生式。 # Anti-Patterns - 不要生成图像文件,只生成文本代码。 - 不要遗漏文法中的任何产生式规则。 - 不要混淆非终结符和终结符在状态图中的表示。 - 不要在未指定格式时随意选择格式,默认提供文本或Mermaid格式。 ## Triggers - 绘制文法对应的状态图 - 用mermaid语言展示 - 文法转plantuml - 生成状态图代码 - 文法状态图文本表示
- Prompt
- Triggers
What does the 文法转状态图及可视化代码生成 skill do?
根据给定的形式文法,分析其产生式规则,构建对应的状态转换图,并根据用户要求生成特定格式(如Mermaid、PlantUML、文本或代码)的可视化表示。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill 文法转状态图及可视化代码生成 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
