Expand description
The Polydat compiler: from a parsed .polydat program to an
assembler and a kernel. The language itself (lexer, parser, AST,
pretty printer, pragmas, tile templates) lives in
polydat_grammar and is re-exported here at its old paths.
Modules§
- ast
- Abstract syntax tree for the Polydat DSL.
- compile
- DSL-to-assembly bridge: compile a parsed Polydat AST into a runtime kernel.
- const_
constraints - Assembly-time validation of Polydat node constant arguments.
- cursor_
sugar - Cursor-constructor sugar registry.
- error
- Structured error types for the Polydat DSL with rich source context.
- events
- Polydat compiler diagnostic event stream.
- factories
- Node factories, the host-side registry view, and extern resolvers.
- factory
- External-facing factory module. Made
pub(waspub(crate)) so crates that host polydat nodes outside the polydat crate (host runtimes) can reachConstArg,compile_ctx, andbuild_nodefrom theirregister_nodes!invocations. Node factory: maps Polydat function names to runtime node instances. - lexer
- Lexer for the Polydat DSL.
- parser
- Recursive descent parser for the Polydat DSL.
- pprint
- AST →
.polydatsource pretty-printer. - pragmas
- Pragmas for Polydat source.
- refs
- Grammar-based free-name extraction for Polydat expression text.
- registry
- Function registry: known function signatures for DSL validation.
- stub
- Caller-native, typed polydat expression stubs.
- tile
- The tile template grammar (polytile.md §2.2): holes, projections, branches, and the doubled-open escape, parsed over configurable delimiters and sigil. The textual front end for Polytile; the structural front end (§3) lowers to the same pieces.
- tile_
lower - Lowering a
tilestatement to a program (polytile.md §6). - tile_
structural - The structural front end and the host boundary of Polytile (polytile.md §3, §5.6).
- transform
- Program transforms: host intentions expressed as changes to the program rather than as runtime behavior around it.
- traversal
- Compile-time support for the
forconstruct (for_traversal.md §4): element typing, body-to-child-program lowering, and the metadata a parent program carries for each traversal and producer.
Structs§
- Compile
Options - The options every entry point compiles under. A host that names none gets the defaults: no source directory, no library paths, every binding an output, lax typing, the default context label, no cursor limit, and the most compiled engine this build has.
Enums§
- Const
Arg - Constant arguments extracted from the AST.
- Input
Variance - What the compiler does with an open input, one whose type it
inferred rather than the author declared: an auto-extern, or an
externa scope builder synthesized (input_variance.md §3, §4). Coordinates and declared inputs are never affected.
Functions§
- collect_
expr_ references - Collect identifier references from an
Exprtree intoout. - compile_
ast_ interpreter_ with_ options compile_polydat_interpreter_with_optionsfor an already parsed, possibly transformed, program.sourceis the text the program was parsed from and is used for diagnostics only.- compile_
ast_ with_ engine compile_polydat_with_enginefrom a parsed file: the parent compiles onenginethrough the assembler, and eachforbody compiles once for the interpreter as the traversal’s record and on any engine at activation (engines.md §3.6).- compile_
polydat - Compile a
.polydatsource string under the default options, on the engine those options name — which isEngine::default, the most native form the build has. - compile_
polydat_ checked - Compile with full diagnostics: errors, warnings, suggestions, on the default engine.
- compile_
polydat_ interpreter compile_polydatreturning the interpreter’s concrete kernel.- compile_
polydat_ interpreter_ with_ options - Compile Polydat source into the interpreter’s kernel under
options, recording pragma and assembly events inlogwhen one is given: the interpreter-typed entry point every other interpreter form reduces to.compile_polydat_with_engineis the same compile on any engine. - compile_
polydat_ kernel compile_polydat_withonEngine::default: compiled code, with the JIT where the build has it.- compile_
polydat_ kernel_ with_ options compile_polydat_kernelwith the kernel path’s options (source directory, library paths, required outputs, strict typing, the error context label, the cursor limit, and the engine preference) and the compile event log.- compile_
polydat_ with - Compile
sourceforengine: the interpreter, the closure tier, the hybrid kernel, or pure native code. Every engine accepts every program the interpreter accepts, or refuses it with a reason (crate::KernelError::Refused); a host drives the result throughcrate::Kernelwithout knowing which engine it holds. Thecompile_polydat_kernel*andcompile_polydat_checkedentry points andcompile_polydatare this onEngine::default();compile_polydat_interpreter_with_optionsand the deprecated forms build the interpreter’s kernel. - compile_
polydat_ with_ engine compile_polydat_withwith the kernel path’s options (source directory, library paths, required outputs, strict typing, the error context label, the cursor limit) and the compile event log. On the interpreter this is the whole kernel path, traversals included; on a compiled engine the assembler entry point followed byPolydatAssembler::compile_engine_with_log.- eval_
const_ expr - Evaluate a constant expression by compiling it as a one-binding
program: what a comprehension source such as
partitions("*\/4", 1000)goes through. Cached by source text, so the same text compiles once per process (for_traversal.md §5.2). An expression that reaches a dynamic input is a lifecycle error. The compile, when there is one, is recorded in a ledger of its own;eval_const_expr_forcharges it to a tree’s. - parse_
polydat - Parse Polydat source into the program tree, the form every transform reads and rewrites.
- parse_
polydat_ with_ tile_ defaults parse_polydatwith the hole delimiters and directive sigil a tile body that declares none of its own is read with.- stdlib_
sources - Return the embedded standard library module sources.