diff options
author | Eduardo Julian | 2017-06-09 20:53:26 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-06-09 20:53:26 -0400 |
commit | c50667a431a5ca67328a230f0c59956dc6ff43fa (patch) | |
tree | d07416c74b5e4a477038bcf3fcfbd79106cc3fb4 /new-luxc/source/luxc/synthesizer/function.lux | |
parent | 4480e41e949ba3ba0c9bceeed43e3f144f82103b (diff) |
- Added loop synthesis.
- Some refactoring.
Diffstat (limited to 'new-luxc/source/luxc/synthesizer/function.lux')
-rw-r--r-- | new-luxc/source/luxc/synthesizer/function.lux | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/new-luxc/source/luxc/synthesizer/function.lux b/new-luxc/source/luxc/synthesizer/function.lux index be6a74da0..42aa7a6cd 100644 --- a/new-luxc/source/luxc/synthesizer/function.lux +++ b/new-luxc/source/luxc/synthesizer/function.lux @@ -22,18 +22,23 @@ (-> ls;Variable Bool) (<comp> 0 var))] - [function-var? i.=] - [local-var? i.>] - [captured-var? i.<] + [self? i.=] + [local? i.>] + [captured? i.<] ) -(def: #export (nested-function? scope-args) - (-> Nat Bool) - (n.> +1 scope-args)) +(do-template [<name> <comp> <ref>] + [(def: #export (<name> arity) + (-> ls;Arity Bool) + (<comp> <ref> arity))] -(def: #export (adjust-var scope-args var) - (-> Nat ls;Variable ls;Variable) - (|> scope-args n.dec nat-to-int (i.+ var))) + [nested? n.> +1] + [top? n.= +0] + ) + +(def: #export (adjust-var outer var) + (-> ls;Arity ls;Variable ls;Variable) + (|> outer n.dec nat-to-int (i.+ var))) (def: #export (to-captured idx) (-> Nat Int) |