Language Reference¶
This section provides formal documentation of all Graphcal language features.
Overview¶
Graphcal is a domain-specific language for engineering calculations built around a directed acyclic graph (DAG) of computations. Every .gcl file describes parameters (inputs), nodes (computed values), and constants, connected by explicit references.
The language has a layered type system:
| Layer | Feature | Purpose |
|---|---|---|
| 1 | Primitives | Primitive value types (canonical inventory) |
| 2 | Dimensions | Physical dimension algebra (compile-time types) |
| 3 | Units | Value-level scaling factors attached to dimensions |
| 4 | Algebraic Data Types | Constructors, payloads, and pattern matching |
| 5 | Indexes | Finite label sets for collections |
| 6 | DAG Blocks | Reusable computation via dag blocks and include |
Reference Pages¶
-
Computation Model
DAG semantics,
param/node/const node, the@-sigil. -
Type System
The full entity stratification, canonical primitive inventory, and explicit conversions.
-
Dimensions & Units
Dimension algebra, unit definitions, conversion, prelude.
-
Algebraic Data Types
One- and multi-constructor types,
matchexpressions, and generics. -
Indexes
Named, coordinate, and
Fin(N)indexes;for,scan, andunfold. -
DAG Blocks
Reusable computation via
dagblocks andinclude. -
Extern Functions (Plugins)
import pluginblocks: externally-provided functions with declared dimensional signatures. -
Expressions
Operators, precedence,
if/else, literals. -
Multi-File Projects
importdeclarations, package dependencies, aliasing, circular detection. -
Assertions & Attributes
assertdeclarations, tolerance checks,#[assumes(...)]. -
Plots
plotdeclarations, chart types, interactive visualization. -
Built-in Reference
Prelude dimensions, units, constants, and functions.