Concepts Overview
This section covers the core concepts in synkit:
- Tokens - Token enum, token structs, and the
Tok!macro - Parsing -
ParseandPeektraits, stream operations - Spans & Errors - Source locations,
Spanned<T>, error handling - Printing -
ToTokenstrait and round-trip formatting
Core Flow
Source → Lexer → TokenStream → Parse → AST → ToTokens → Output
- Lexer (logos): Converts source string to token sequence
- TokenStream: Wraps tokens with span tracking and skip logic
- Parse: Trait for converting tokens to AST nodes
- AST: Your domain-specific tree structure
- ToTokens: Trait for converting AST back to formatted output