plankevm/plank-monorepo/parser-engineer
Claude Code and agent skill by plankevm/plank-monorepo
- community
Checking that the SKILL.md file is still in the repository.
Mandatory use when developing or analyzing the parser, CST, lexer, or AST. Use when adding new syntax constructs, fixing parse errors, improving error recovery, or debugging tokenization issues.
Install
npx vskill@latest install plankevm/plank-monorepo/parser-engineerSKILL.md
Parser Engineer
Overview
LSP-grade error-resilient parser for the Plank language. Core principle: faithfully represent ALL input, including malformed code, while maximizing recovered syntactic structure.
Crate: frontend/parser (plank-parser) Grammar Reference: docs/Grammar.md — always consult before implementing new parsing rules. Cross-reference: When modifying CST node definitions, also use the data-structure skill.
File Structure
Key Principles
Never Crash on Errors
The parser must consume all input regardless of how malformed. When encountering unexpected tokens:
- Wrap them in error nodes
- Emit a diagnostic
- Continue parsing
Never panic, return early, or leave tokens unconsumed.
Guards Before Parsing
Check for expected tokens before calling sub-parsers:
This prevents cascading errors from entering parsers in broken states.
Avoid Recursion
Model syntactic constructs as variable-length lists rather than recursive calls. Recursion consumes stack and artificially limits nesting depth.
Single-Reason Child Count Variance
A node's child count should only vary for one reason, enabling easy introspection:
- ❌ Bad:
Ifwith variableElseIfBranchcount AND optional elseBlock - ✅ Good:
Ifwith guaranteedElseIfBranchListand optional elseBlock
Examples: ConstDecl vs TypedConstDecl, Block vs ComptimeBlock
CST Representation
Homogeneous tree storing the entire input faithfully. Children are linked lists (indices to next sibling and first child).
Requirements:
- Represent incomplete constructs and extra tokens
- Semantic info inferable from tree structure alone (no token inspection needed except for atoms)
- Keywords modifying semantics (
inline,mut,comptime) must be reflected in node structure
Memory layout: Nodes stored in pre-order in the arena for cache performance. Post-fix operators may require allocating parents after children.
Parser Method Reference
| Method | Consumes? | Side Effects | Use When | |
|---|---|---|---|---|
at(Token) | No | None | Raw check, no trivia skip | |
check(Token) | No | Skips trivia, adds to expected set | Testing before committing | |
eat(Token) | If matches | Skips trivia, adds to expected set | Optional tokens | |
expect(Token) | If matches | Skips trivia, emits error if no match | Required tokens |
Node Construction Pattern
Expected Token Set Tracking
Use check chains + emit_unexpected instead of emit_missing_token:
Each check call adds to the expected set, producing descriptive errors.
Statement Results
try_parse_stmt returns Option<StmtResult>:
| Variant | Meaning | Example | |
|---|---|---|---|
Statement(node) | Complete, consumed semicolon | x = 1; | |
MaybeEndExpr(node) | No semicolon, could be end expr | { }, if x { } else { } | |
ForcedEndExpr(node) | Must be end expr (needs semi if stmt) | x + y without ; |
Expression Modes
| Mode | Use Case | |
|---|---|---|
AllowAll | General expression context | |
CondExpr | Condition in if/while (prevents block ambiguity) | |
TypeExpr | Type annotation context |
Testing Conventions
Use test utilities in frontend/parser/src/tests/:
Snapshot tests:
- Node kinds:
WhileStmt,BinaryExpr(Plus) - Tokens: quoted strings (
"while"," ") - Children indented under parents
Error tests:
Common Mistakes
| Mistake | Fix | |
|---|---|---|
Using emit_missing_token directly | Use check chains + emit_unexpected | |
| Recursive parsing for variable-length constructs | Use iterative loops | |
| Variable child count for multiple reasons | Split node kinds or use list wrappers | |
| Not wrapping unexpected tokens in error nodes | Always consume all input | |
| Inspecting tokens to determine semantics | Reflect meaning in node structure |
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplankc/.claude/skills/parser-engineer/SKILL.md
Popularity
- Repository stars
- 62
- Repository forks
- 18
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/plankevm/plank-monorepo/parser-engineer)