Quellcode durchsuchen

Pathetic try to get macros to work with the non recursive version

master
fumfar hiwi vor 6 Jahren
Ursprung
Commit
2146926780
3 geänderte Dateien mit 15 neuen und 2 gelöschten Zeilen
  1. +2
    -0
      bin/pre.slime
  2. BIN
     
  3. +13
    -2
      src/eval.cpp

+ 2
- 0
bin/pre.slime Datei anzeigen

@@ -17,6 +17,8 @@
(define (force promise) (define (force promise)
(promise)) (promise))


(define-syntax (mac a) (list + 1 1))

(define-syntax (when condition . body) (define-syntax (when condition . body)
:doc "Special form for when multiple actions should be done if a :doc "Special form for when multiple actions should be done if a
condition is true. condition is true.



+ 13
- 2
src/eval.cpp Datei anzeigen

@@ -687,6 +687,7 @@ namespace Slime {
case Action::Pop: return "Pop"; case Action::Pop: return "Pop";
case Action::If: return "If"; case Action::If: return "If";
} }
return "??";
}()); }());
} }
printf("\nams:\n "); printf("\nams:\n ");
@@ -696,6 +697,13 @@ namespace Slime {
pause(); pause();
}; };


proc push_pc_on_cs = [&] {
for_lisp_list (pcs.data[pcs.next_index-1]) {
cs.append(it);
}
pcs.data[pcs.next_index-1] = Memory::nil;
};

proc handle_if = [&] { proc handle_if = [&] {
/* | | | <test> | /* | | | <test> |
| | -> | <then> | | | -> | <then> |
@@ -831,7 +839,8 @@ namespace Slime {
else if (pc == Memory::_begin) try handle_begin(); else if (pc == Memory::_begin) try handle_begin();
else if (pc == Memory::_define) try handle_define(); else if (pc == Memory::_define) try handle_define();
else { else {
// push_pc_on_cs();
push_pc_on_cs();
nas.append(Action::Step);
} }
} else { } else {
nas.append(Action::Step); nas.append(Action::Step);
@@ -839,7 +848,9 @@ namespace Slime {
} break; } break;
case Lisp_Object_Type::Function: { case Lisp_Object_Type::Function: {
if (pc->value.function->type == Function_Type::Macro) { if (pc->value.function->type == Function_Type::Macro) {
// push_pc_on_cs();
push_pc_on_cs();
nas.append(Action::Eval);
nas.append(Action::Step);
} else { } else {
nas.append(Action::Step); nas.append(Action::Step);
} }


Laden…
Abbrechen
Speichern