Compiler Pipeline
Lexing, parsing, type-checking, compile output, and import/round-trip stages.
The compiler is deterministic and schema-aware from source text to stretchpress.blocks.v1.
Pipeline
source .quire
-> lexer
-> parser
-> module resolver (imports + package manifests)
-> schema-aware type checker
-> compiler
-> source-map + block JSON output
quire import takes block JSON back to Quire source for editor or builder interoperability.
Lexing/parsing
- Lexer emits positioned tokens for identifiers, keywords, literals, operators, punctuation, and newlines.
- Parser is recursive-descent and builds AST nodes for documents, blocks, attributes, controls, and expressions.
Type checking
Validation includes:
- imported modules and package manifests resolve
- import cycle detection
- known types and model symbols
- block props and required props
- attribute type compatibility
- conditional, repeat, and arithmetic/logical type safety
- capability registration and call arity/type
Diagnostics
Diagnostics have stable P-codes.
P01xx: lexerP02xx: parserP03xx: semantic/type-checkerP99xx: internal
quire check src/page.quire --json
Example JSON shape:
{
"code": "P0363",
"severity": "error",
"message": "Type Product has no field 'doesNotExist'."
}
Compilation output
Canonical block shape:
{
"format": "stretchpress.blocks",
"version": 1,
"view": {},
"blocks": [],
"sourceMap": []
}
compile -> import -> compile preserves semantic IR (view, bindings, blocks).
Imports and migration importer
quire import reconstructs .quire source from block JSON.
quire migrate uses the same stretchpress.blocks.v1 import route:
quire migrate path/to/template.liquid --from liquid --out path/to/page.quire --report path/to/report.json
Formatter
quire format parses and canonicalizes syntax, and fails on invalid programs instead of producing lossy output.