sipha-core
Core parsing infrastructure for sipha - provides grammar-based parsing, CST construction, and error handling.
Overview
sipha-core is the foundation of the sipha parser ecosystem. It provides:
- Grammar-based parsing with support for complex grammars
- Pratt parsing for operator precedence handling
- Concrete Syntax Tree (CST) construction preserving all syntax information
- Memoization for efficient parsing
- Error recovery with sync tokens
- Rich error diagnostics with source code context
- Visitor pattern for tree traversal
- CST rewriting capabilities
Quick Start
Add sipha-core to your Cargo.toml:
[]
= "0.1.1"
With optional features:
[]
= { = "0.1.1", = ["serde", "color", "diagnostics"] }
Features
default: Includesserde,color, anddiagnosticsfeaturesserde: Enables serialization of grammar rules and CST nodescolor: Adds color support for error outputdiagnostics: Enables rich error diagnostics with miette integration
Example
use ;
let mut parser = create;
parser.register_rule;
let tokens = vec!;
let mut arena: = new;
let mut state = new;
match parser.parse_rule
Documentation
For more information, see:
License
This project is licensed under the MIT License - see the LICENSE file for details.
See Also
- sipha - Umbrella crate with feature flags
- sipha-analysis - Grammar analysis utilities
- sipha-lsp - Language Server Protocol support
- sipha-fmt - Source code formatting utilities