polydat-grammar
The Polydat language without its runtime: the lexer, the parser, the AST, the pretty-printer, the free-name collector, the diagnostic types, the comprehension sub-language and its algebra, the tile template parsers, the AST visualizer, and the port type vocabulary.
Depend on this crate alone when a tool only needs to read, check,
rewrite, or print Polydat source: an editor integration, a linter, a
formatter, a workload generator, or a documentation tool. A program that
compiles and runs kernels depends on
polydat, which re-exports every
module here at the path it always had, so polydat::dsl::ast and
polydat::ast::PortType are these types.
Example
Lex, parse, and print a program back in canonical form:
use lex;
use parse;
use pp_file;
The printer emits the canonical spelling rather than the source text:
binary operators are fully parenthesized, string interpolation is
desugared to printf, and literals are normalized. The language's
verification rule is that parsing the printed form and printing it
again is a fixed point.
What the runtime owns
What a type means to a compiled buffer, what a comprehension evaluates to, and what a tile renders are decided by the runtime, as trait implementations and functions over the types defined here. This crate has no dependency on the runtime or the node library.
Documentation
The rustdoc on docs.rs covers the
API. The normative language specification, machine-checked against the
parser, is
polydat_grammar.md
in the repository; the comprehension algebra is
comprehension_forms.md
beside it.
License
Apache-2.0.