Module Structure
This chapter describes the organization of Sipha’s codebase.
Core Modules
syntax
Syntax tree types and operations:
green.rs: Green tree nodesred.rs: Red tree nodeskind.rs: Syntax kind traitbuilder.rs: Tree buildervisitor.rs: Tree visitorsquery.rs: Tree queries
lexer
Lexical analysis:
builder.rs: Lexer builderdfa.rs: DFA construction and tokenizationtoken.rs: Token typesmod.rs: Module exports
grammar
Grammar definition and validation:
builder.rs: Grammar builderexpr.rs: Grammar expressionsvalidate.rs: Grammar validationanalysis.rs: Grammar analysisdocs.rs: Grammar documentation
backend
Parser backends:
mod.rs: Backend trait and common codell/: LL(k) parser implementationlr/: LR parser implementationglr/: GLR parser implementationcommon.rs: Common backend utilities
incremental
Incremental parsing support:
mod.rs: Incremental parser and session
error
Error types and diagnostics:
mod.rs: Error types and diagnostics
parser
Parser traits and interfaces:
mod.rs: Parser traits
Workspace Structure
sipha/
├── crates/
│ ├── sipha/ # Main library
│ ├── sipha_derive/ # Procedural macros
│ └── sipha_lsp/ # LSP support
├── fuzz/ # Fuzz testing
└── doc/ # Documentation (this book)
Module Dependencies
syntax
↑
├── lexer
│ ↓
│ grammar
│ ↓
│ backend
│ ↓
│ incremental
│
└── error
Next Steps
- See Data Structures for key types
- Check Design Principles for design rationale