The dataflow language
The dataflow language is the bridge between the call by need lambda calculus and
a dataflow graph. It retains aspects of both but is neither completely. It is
represented as a sequence of
let assignments, where the right hand side of
the assignment is always a call of a stateful function or dataflow operator.
Multiple arguments can be given to this call, however they must always be
references to either a locally (
let) bound value, or an environment reference.
It is thus much more restricted than the algorithm language because it
does not support lambdas, and the RHS of
let is not an arbitrary expression.
The dataflow language is defined in
It is sometime necessary (in particular for tests) to create
To avoid having to write them directly in Haskell, the
library includes a
DFLang parser. This parser can be used in Haskell code
QuasiQuotes extension is enabled by importing
[embedDflang| Your dflang expression |] quasi quoter.
It supports the same style comments as the algorithm language.
let (x) (* target bindings *) = some.package/sf (* function reference *) <0> (* call site id *) [s] (* state source (optional) *) (a, b, c) (* arguments *) in let (y, z) = dataflow other.package/a_dataflow_fn<1>() in x
- Target Bindings
- A tuple of bindings that are created by this function call. The names should be unique in the expression. Always has to be a tuple, i.e. comma separated and surrounded by parentheses, even if only one value is created. Can be empty.
- Function Reference
- The fully qualified reference to the function being called. The syntax is
ohua.lang/id. May optionally be preceded by the keyword
dataflowto indicate that this is not a simple function but a dataflow operator, i.e. translates to the
- Call Site Id
- A positive integer uniquely identifying this call. Uniqueness is not checked but the behavior of the compiler is undefined if call site id’s are not unique.
- State Source
- A value to be used as initial state for this function. Must be specified for stateful functions and omitted for stateless functions. Can be a literal of binding (same as arguments).
- A tuple of arguments as input to the function. As with target bindings these need to be comma separated and surrounded by
parentheses, but can be empty. In addition to local variables, such as
myVar, numeric literals
-4, the unit literal
()and references to environment expressions are allowed as arguments. The latter are positive numbers prefixed with