add-language

Guides adding a new programming language pack with parser, grammar, and registry declarations.

9|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/timcsy/semorphe --skill add-language-timcsy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-language
Source: https://github.com/timcsy/semorphe/tree/main/knowledge/skills/add-language
Command: npx skills add https://github.com/timcsy/semorphe --skill add-language-timcsy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding a new programming language to the Semorphe block editor involves many non-obvious steps—grammar registration, parser setup, lift patterns, degradation blocks, toolbox categories—and missing any one causes silent failures like blocks from the wrong language appearing or code panels showing unknown-component errors. This Skill provides the complete ordered checklist so nothing is skipped. ## Core Features & Use Cases - Ordered Setup Sequence: Walks through grammar/wasm first, then the language pack skeleton, program root component, degradation targets, toolbox categories, and finally the first real component. - Global Registry Checklist: Covers the four singleton registries (language pack, toolbox categories, degradation blocks, comment syntax) that must each be declared per language, with correct module-top-level timing. - Failure Symptom Catalog: Documents real failure modes—cross-language component identity leaks, silent AST mis-parsing, restore-path desync—so you can diagnose issues by symptom. - Use Case: You want to add Python support to the block editor. Follow this Skill to register the tree-sitter grammar, declare the language pack with programRoot and install, add structural lift patterns, and verify by pasting real Python code in the browser. ## Quick Start Ask the AI to walk you through adding a new programming language to the block editor using the add-language checklist, starting with the grammar and parser setup.

Frequently Asked Questions about add-language

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new programming language to a Blockly-based editor?

Start with the grammar and wasm parser, then create the language pack skeleton declaring grammar, programRoot, and install. Next add structural lift patterns, degradation blocks, and toolbox categories before building the first real component through the component pipeline.

What is the difference between a language and a teaching language?

A language (like cpp or python) has its own grammar and parser, while teaching languages (like c-beginner or arduino) share one grammar and only need topics and targets JSON files. Adding a teaching language does not require this full language-addition workflow.

Why do blocks from the wrong language appear when parsing code?

This happens when lift patterns lack an explicit grammar declaration, so patterns match by astNodeType name across grammars that naturally collide. Every lift pattern and handwritten lifter must declare which grammar it belongs to.

Why does the code panel show unknown component errors after adding a language?

This indicates a missing programRoot declaration or a missing install call in the language pack. Without programRoot the assembler picks another language's root component, and without install the language's generators are never registered.

Can I write lift patterns from grammar documentation alone?

No, you should print the real AST with a throwaway probe test because documented assumptions are often wrong. Guessed structures fail silently by producing incomplete trees, such as missing elif branches, rather than throwing errors.