diff options
| author | Drahflow <drahflow@gmx.de> | 2014-03-11 18:35:06 +0100 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2014-03-11 18:35:06 +0100 |
| commit | 322d8de9f2d5a4b7159c72d36add03e29dcbe5c2 (patch) | |
| tree | d0e458075ae1fe8175890947042e748c5d7333f5 /compiler/standardClient.ey | |
| parent | cb4411da6072cccf0030e5f2c1eb4bbd57a6a14a (diff) | |
(Slow) abstract data types
Diffstat (limited to 'compiler/standardClient.ey')
| -rw-r--r-- | compiler/standardClient.ey | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/compiler/standardClient.ey b/compiler/standardClient.ey index 1d55824..cdf2f6f 100644 --- a/compiler/standardClient.ey +++ b/compiler/standardClient.ey @@ -525,7 +525,19 @@ invalid # function code { [ 1 0 object len 1 sub ] 0 object * typeStackInternal } # array invalid # function type - literal # scope + { + [ + { object "#*" .? } { + object "#in" . ==in + in len 1 neq { "multi-input scope in typeStack" die } rep + [ 0 in * 0 1 neg ] + object "#out" . ==out + out len 1 neq { "multi-output scope in typeStack" die } rep + 0 out * typeStackInternal + } + { 1 } literal + ] conds + } # scope invalid # name table unknown unknown @@ -784,6 +796,45 @@ > -- > -- +{ _ ==f _ sys .typed .inputs ==inputs + sys .typed .outputs ==outputs + inputs len 2 lt { f } { + { "t from curry should never execute" die } + [ inputs len 1 sub inputs * ] outputs '' ==t + 0 inputs len 2 sub range reverse { ==i t [ i inputs * ] [ t ] '' =t } each + 1 inputs len range reverse { ==i + f < =*g { { g }_ } > -- [ i inputs * ] [ t ] '' =f + 0 t sys .typed .outputs * =t + } each + f + } ? * +} /curry deffd + +{ | curry } "||" deffd +{ ==o + { "unknown type in **" die } ==:unknown + { "invalid type in **" die } ==:invalid + + o sys .typed .type [ + { o } # integer + { o } # string + { o } # float + unknown + invalid # extension area + { o * ** } # function + invalid # function code + { o * ** } # array + invalid # function type + { o "#*" .? { o * ** } { o } ? * } # scope + invalid # name table + unknown + unknown + unknown + unknown + unknown + ] * * +} "**" deffd + # global extensions < "0123456789" ==:base10digits |
