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 | Float, Int, Bool base types |
| 2 | Dimensions | Physical dimension algebra (compile-time types) |
| 3 | Units | Value-level scaling factors attached to dimensions |
| 4 | Algebraic Data Types | Structs, union types, 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
Primitive types:
Float,Int,Bool, and conversions. -
Dimensions & Units
Dimension algebra, unit definitions, conversion, prelude.
-
Algebraic Data Types
Structs, union types,
matchexpressions, generics. -
Indexes
Finite indexes, range indexes,
for,scan,unfold. -
DAG Blocks
Reusable computation via
dagblocks andinclude. -
Expressions
Operators, precedence,
if/else, literals. -
Multi-File Projects
importdeclarations, aliasing, circular detection. -
Assertions & Attributes
assertdeclarations, tolerance checks,#[assumes(...)]. -
Plots
plotdeclarations, chart types, interactive visualization. -
Built-in Reference
Prelude dimensions, units, constants, and functions.