dimitriv / Ziria

A domain-specific-language and compiler for low-level bitstream processing.
92 stars 18 forks source link

Let arrays with non-constant elements not supported #37

Closed bradunov closed 9 years ago

bradunov commented 9 years ago

Add constant size arrays with variable values. For example, let y = {x1, x2} in currently does not compile, but seems to have very clean sematics: var tmp:arr[2] : int; tmp[0] := x1; tmp[1] := x2; let y = tmp

For example:

let f(a:arr int) = let x1 = 5; let x2 = 4; let b = {x1, x2} in let c = b[1] in return c in

read[int] >>> emit f({1,2}) >>> write[int]

edsko commented 9 years ago

This is related to #28. Currently array values can only have scalar values as elements in the AST (that is, bits, ints, doubles, bools, strings, or unit values). This issue asks for this to be extended to variables, and issue #28 asks for this to be extended to contain nested structs. Both extensions will require modifications to the AST and hence to the rest of the compiler pipeline, in addition to extensions to the parser.

edsko commented 9 years ago

Partly implemented. See #85.