From f5b2f04fec382da0d164f772ed65ae058e66d8e2 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 1 Mar 2015 18:15:48 -0400 Subject: [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. --- source/lux.lux | 62 +++++++++++++++++----------------------------------------- 1 file changed, 18 insertions(+), 44 deletions(-) (limited to 'source') 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))))) -- cgit v1.2.3