Skip to main content

Module dsl

Module dsl 

Source
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 (was pub(crate)) so crates that host polydat nodes outside the polydat crate (host runtimes) can reach ConstArg, compile_ctx, and build_node from their register_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 → .polydat source 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 tile statement 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 for construct (for_traversal.md §4): element typing, body-to-child-program lowering, and the metadata a parent program carries for each traversal and producer.

Structs§

CompileOptions
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§

ConstArg
Constant arguments extracted from the AST.
InputVariance
What the compiler does with an open input, one whose type it inferred rather than the author declared: an auto-extern, or an extern a scope builder synthesized (input_variance.md §3, §4). Coordinates and declared inputs are never affected.

Functions§

collect_expr_references
Collect identifier references from an Expr tree into out.
compile_ast_interpreter_with_options
compile_polydat_interpreter_with_options for an already parsed, possibly transformed, program. source is the text the program was parsed from and is used for diagnostics only.
compile_ast_with_engine
compile_polydat_with_engine from a parsed file: the parent compiles on engine through the assembler, and each for body compiles once for the interpreter as the traversal’s record and on any engine at activation (engines.md §3.6).
compile_polydat
Compile a .polydat source string under the default options, on the engine those options name — which is Engine::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_polydat returning 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 in log when one is given: the interpreter-typed entry point every other interpreter form reduces to. compile_polydat_with_engine is the same compile on any engine.
compile_polydat_kernel
compile_polydat_with on Engine::default: compiled code, with the JIT where the build has it.
compile_polydat_kernel_with_options
compile_polydat_kernel with 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 source for engine: 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 through crate::Kernel without knowing which engine it holds. The compile_polydat_kernel* and compile_polydat_checked entry points and compile_polydat are this on Engine::default(); compile_polydat_interpreter_with_options and the deprecated forms build the interpreter’s kernel.
compile_polydat_with_engine
compile_polydat_with with 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 by PolydatAssembler::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_for charges 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_polydat with 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.