dimitriv / Ziria

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

Don't reify length type variables until the very last moment #76

Open edsko opened 9 years ago

edsko commented 9 years ago

(This is a change in policy for codegen, and I'm not precisely sure what the current state of affairs is.) If we have a length polymorphic function

fun foo(arr int x, arr[length(x)] bool y) { .. }

which gets translated to an internal type like

fun foo(arr[_r] int x, arr[_r] bool y) { .. }

then these length type variables _r should remain type variables (rather than be reified as proper term variables that we can pass around as arguments or return as results) until the translation to C. This keeps type checking of internal code a lot clearer.