diff options
author | Eduardo Julian | 2015-03-01 18:15:48 -0400 |
---|---|---|
committer | Eduardo Julian | 2015-03-01 18:15:48 -0400 |
commit | f5b2f04fec382da0d164f772ed65ae058e66d8e2 (patch) | |
tree | c88a2d2ab7515c8dfeea7967719eadd2de31f09d /source/lux.lux | |
parent | 2caf39ea09ae96669466e0e17fd2949347acda7a (diff) |
[TODO]
- For some reason, when I fail at compilation due to mistaken use of tags/variants, I don't get the right error reported.
[Fixes]
- Solved a problem where stack values weren't being properly cleaned-up when pattern-matching on variants and branch bodies.
Diffstat (limited to '')
-rw-r--r-- | source/lux.lux | 62 |
1 files changed, 18 insertions, 44 deletions
diff --git a/source/lux.lux b/source/lux.lux index 03c2a6054..2882207d6 100644 --- a/source/lux.lux +++ b/source/lux.lux @@ -69,60 +69,34 @@ ))) (declare-macro lambda) -## (def' lambda -## (lambda' _ tokens -## (lambda' _ state -## (let' output (case' tokens -## (#Cons [(#Form (#Cons [self (#Cons [arg args'])])) (#Cons [body #Nil])]) -## (#Form (#Cons [(#Ident "lambda'") -## (#Cons [self -## (#Cons [arg -## (#Cons [(case' args' -## #Nil -## body - -## _ -## (#Form (#Cons [(#Ident "lux;lambda") -## (#Cons [(#Form (#Cons [(#Ident "_") args'])) -## (#Cons [body #Nil])])]))) -## #Nil])])])]))) -## [(#Cons [output #Nil]) state]) -## ))) - - -## (def' lambda -## (lambda' _ tokens -## (lambda' _ state -## (let' output (case' tokens -## (#Cons [(#Form (#Cons [self (#Cons [arg args'])])) (#Cons [body #Nil])]) -## (#Form (#Cons [(#Ident "lambda'") -## (#Cons [self -## (#Cons [arg -## (#Cons [(case args' -## #Nil -## body - -## _ -## (#Form (#Cons [(#Ident "lux;lambda") -## (#Cons [(#Form (#Cons [(#Ident "_") args'])) -## (#Cons [body #Nil])])]))) -## #Nil])])])]))) -## [(#Cons output #Nil) state]) -## ))) +(def' def + (lambda (_ tokens state) + (let' output (case' tokens + (#Cons [(#Ident name) (#Cons [body #Nil])]) + (#Form (#Cons [(#Ident "def'") tokens])) + + (#Cons [(#Form (#Cons [(#Ident name) args])) + (#Cons [body #Nil])]) + (#Form (#Cons [(#Ident "def'") + (#Cons [(#Ident name) + (#Cons [(#Form (#Cons [(#Ident "lux;lambda") + (#Cons [(#Form (#Cons [(#Ident name) args])) + (#Cons [body #Nil])])])) + #Nil])])]))) + [(#Cons [output #Nil]) state]))) +(declare-macro def) ## (def' def ## (lambda (_ tokens state) ## (let' output (case' tokens ## (#Cons (#Ident name) (#Cons body #Nil)) -## (#Form (#Cons (#Ident "def'") -## (#Cons (#Ident name) -## (#Cons body #Nil)))) +## (#Form (#Cons (#Ident "def'") tokens)) ## (#Cons (#Form (#Cons (#Ident name) args)) ## (#Cons body #Nil)) ## (#Form (#Cons (#Ident "def'") ## (#Cons (#Ident name) -## (#Cons (#Form (#Cons (#Ident "lux:lambda") +## (#Cons (#Form (#Cons (#Ident "lux;lambda") ## (#Cons (#Form (#Cons (#Ident name) args)) ## (#Cons body #Nil)))) ## #Nil))))) |