parser-development

Guide parser implementation with error recovery for new Biome languages.

25.5k|1.2k|Updated Jul 27, 2023
One-click install
npx skills add https://github.com/biomejs/biome --skill parser-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: parser-development
Source: https://github.com/biomejs/biome/tree/main/.claude/skills/parser-development
Command: npx skills add https://github.com/biomejs/biome --skill parser-development

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill provides guidance and tools for developing and enhancing parsers for new programming languages within the Biome toolchain, including robust error recovery mechanisms.

Core Features & Use Cases

  • Grammar Authoring: Define language syntax using the .ungram format.
  • Parser Generation: Automatically generate parser code from grammar definitions.
  • Lexer Implementation: Create lexers for tokenizing source code.
  • Error Recovery: Implement strategies to handle syntax errors gracefully.
  • Use Case: A developer needs to add support for a new templating language to Biome, requiring them to define its grammar, generate the parser, and implement error handling for malformed templates.

Quick Start

Use the parser-development skill to generate a parser for a new language by creating a .ungram file in xtask/codegen/ and running just gen-grammar <language_name>.

Frequently Asked Questions about parser-development

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

FAQPage Schema
How do I build a language parser with error recovery in Biome?

To build a language parser in Biome, author your grammar using the .ungram format, implement the lexer for tokenization, and generate the parser code. The skill guides this process and facilitates robust error recovery mechanisms for handling syntax errors gracefully.

What is the .ungram format used for in grammar authoring?

The .ungram format is used to define language syntax during grammar authoring. You create a .ungram file to specify the grammar rules, which then allows the Biome toolchain to automatically generate the corresponding parser code for that language.

How do I add support for a new language to the Biome compiler?

To add support for a new language to the Biome compiler, define its syntax in a .ungram file located in xtask/codegen/, implement the lexer, and execute the generation command. This process generates the parser needed to process the new language.

Does Biome parser generation work for languages like CSS, JSON, and HTML?

Yes, Biome parser generation supports languages like CSS, JSON, HTML, JavaScript, and GraphQL. The skill provides guidance for implementing lexers and generating parsers for these languages, ensuring deterministic task execution for coding agents working on the codebase.

How does error recovery work when implementing a lexer for a new language?

Error recovery during lexer implementation allows the parser to handle syntax errors gracefully without halting execution. The skill guides the implementation of strategies to manage malformed templates or unexpected tokens, ensuring robust parsing for new languages.

What's the best way to generate parser code from a grammar definition?

The best way to generate parser code is to define your syntax in a .ungram file and run the generation command. This automatically translates your grammar definitions into functional parser code within the Biome codebase.