Swap continuation & context in the lambda and template structures.

This is to separate the three 'call' parameters (target, argv, ctx) from
the 'return to' parameter (k). The old order made it look as if the dynamic
context was in some way related to the continuation, which is not the case.
This commit is contained in:
Jesse D. McDonald 2010-04-11 19:18:46 -05:00
parent 9af29f28da
commit bc3df6dd17
27 changed files with 101 additions and 101 deletions

View File

@ -144,10 +144,10 @@ static void register_template(gc_root_t *ms_root)
WRITE_BARRIER(vec_root.value); WRITE_BARRIER(vec_root.value);
_get_vector(vec_root.value)->elements[TS(ARG_LIST)] = string_to_value("argument-list"); _get_vector(vec_root.value)->elements[TS(ARG_LIST)] = string_to_value("argument-list");
WRITE_BARRIER(vec_root.value); WRITE_BARRIER(vec_root.value);
_get_vector(vec_root.value)->elements[TS(CONTINUATION)] = string_to_value("continuation");
WRITE_BARRIER(vec_root.value);
_get_vector(vec_root.value)->elements[TS(CONTEXT)] = string_to_value("context"); _get_vector(vec_root.value)->elements[TS(CONTEXT)] = string_to_value("context");
WRITE_BARRIER(vec_root.value); WRITE_BARRIER(vec_root.value);
_get_vector(vec_root.value)->elements[TS(CONTINUATION)] = string_to_value("continuation");
WRITE_BARRIER(vec_root.value);
unregister_gc_root(&vec_root); unregister_gc_root(&vec_root);
} }
/* Slot 4: Callable object used as proxy when structure is apply'd. */ /* Slot 4: Callable object used as proxy when structure is apply'd. */
@ -192,10 +192,10 @@ static void register_lambda(gc_root_t *ms_root)
WRITE_BARRIER(vec_root.value); WRITE_BARRIER(vec_root.value);
_get_vector(vec_root.value)->elements[LS(ARG_LIST)] = string_to_value("argument-list"); _get_vector(vec_root.value)->elements[LS(ARG_LIST)] = string_to_value("argument-list");
WRITE_BARRIER(vec_root.value); WRITE_BARRIER(vec_root.value);
_get_vector(vec_root.value)->elements[LS(CONTINUATION)] = string_to_value("continuation");
WRITE_BARRIER(vec_root.value);
_get_vector(vec_root.value)->elements[LS(CONTEXT)] = string_to_value("context"); _get_vector(vec_root.value)->elements[LS(CONTEXT)] = string_to_value("context");
WRITE_BARRIER(vec_root.value); WRITE_BARRIER(vec_root.value);
_get_vector(vec_root.value)->elements[LS(CONTINUATION)] = string_to_value("continuation");
WRITE_BARRIER(vec_root.value);
unregister_gc_root(&vec_root); unregister_gc_root(&vec_root);
} }
/* Slot 4: Callable object used as proxy when structure is apply'd. */ /* Slot 4: Callable object used as proxy when structure is apply'd. */

View File

@ -33,8 +33,8 @@
#define TEMPLATE_SLOT_BYTE_CODE 3 #define TEMPLATE_SLOT_BYTE_CODE 3
#define TEMPLATE_SLOT_TAIL_CALL 4 #define TEMPLATE_SLOT_TAIL_CALL 4
#define TEMPLATE_SLOT_ARG_LIST 5 #define TEMPLATE_SLOT_ARG_LIST 5
#define TEMPLATE_SLOT_CONTINUATION 6 #define TEMPLATE_SLOT_CONTEXT 6
#define TEMPLATE_SLOT_CONTEXT 7 #define TEMPLATE_SLOT_CONTINUATION 7
#define TEMPLATE_SLOTS 8 #define TEMPLATE_SLOTS 8
#define LAMBDA_SLOT_GLOBAL_VARS 0 #define LAMBDA_SLOT_GLOBAL_VARS 0
@ -43,8 +43,8 @@
#define LAMBDA_SLOT_BYTE_CODE 3 #define LAMBDA_SLOT_BYTE_CODE 3
#define LAMBDA_SLOT_TAIL_CALL 4 #define LAMBDA_SLOT_TAIL_CALL 4
#define LAMBDA_SLOT_ARG_LIST 5 #define LAMBDA_SLOT_ARG_LIST 5
#define LAMBDA_SLOT_CONTINUATION 6 #define LAMBDA_SLOT_CONTEXT 6
#define LAMBDA_SLOT_CONTEXT 7 #define LAMBDA_SLOT_CONTINUATION 7
#define LAMBDA_SLOTS 8 #define LAMBDA_SLOTS 8
void builtin_init(void); void builtin_init(void);

View File

@ -155,8 +155,8 @@ in:
-- (11111NNN) [reserved, N < 4] -- (11111NNN) [reserved, N < 4]
self (11111100) [current lambda] self (11111100) [current lambda]
argv (11111101) [argument list] argv (11111101) [argument list]
k (11111110) [continuation] ctx (11111110) [dynamic context]
ctx (11111111) [dynamic context] k (11111111) [continuation]
out: out:
fN (1NNNNNNN) [0 <= N < 120] fN (1NNNNNNN) [0 <= N < 120]
@ -168,8 +168,8 @@ lambda:[
code: byte-string containing sequence of 4-byte instruction words code: byte-string containing sequence of 4-byte instruction words
tail-call: in-ref of lambda to tail-call tail-call: in-ref of lambda to tail-call
arguments: in-ref of argument list to pass to tail-call arguments: in-ref of argument list to pass to tail-call
continuation: in-ref of continuation to pass to tail-call
context: in-ref of dynamic context to pass to tail-call context: in-ref of dynamic context to pass to tail-call
continuation: in-ref of continuation to pass to tail-call
] ]
template:[ template:[
@ -179,8 +179,8 @@ template:[
code: linked code: linked
tail-call: copied verbatim tail-call: copied verbatim
arguments: copied verbatim arguments: copied verbatim
continuation: copied verbatim
context: copied verbatim context: copied verbatim
continuation: copied verbatim
] ]
Protocol: Protocol:

View File

@ -116,7 +116,7 @@
k k
) )
#S(template ; g2 #S(template ; g2
#() #(#f)
#B(f0) #B(f0)
1 ; f0 1 ; f0
#B( #B(
@ -124,8 +124,8 @@
) )
k k
f0 f0
ctx g1
nil g1
) )
) )
#() #()
@ -166,7 +166,7 @@
#0=#S(lambda #0=#S(lambda
#( #(
#S(lambda ; g1 = (lambda (k) (k 1)) #S(lambda ; g1 = (lambda (k) (k 1))
#(1) ; g1 = 1 #(1 #f) ; g1 = 1; g2 = #f
#() ; instance #() ; instance
1 ; frame (f0) 1 ; frame (f0)
#B( #B(
@ -174,25 +174,25 @@
) )
k ; tail-call k ; tail-call
f0 ; arguments f0 ; arguments
ctx ; dynamic context g2 ; dynamic context
nil ; continuation g2 ; continuation
) )
#S(template ; g2 = (lambda (k) ...) #S(template ; g2 = (lambda (k) ...)
#( #(
#=0 ; g1 = fact #=0 ; g1 = fact
#S(template ; g2 = (lambda (_ m) (k (* n m))) #S(template ; g2 = (lambda (_ m) (k (* n m)))
#() ; globals #(#f) ; globals
#B(i0 ctx k) ; instance (i0=n, i1=ctx, i2=k) #B(i0 k) ; instance (i0=n, i1=k)
1 ; frame (f0) 1 ; frame (f0)
#B( #B(
(set! f0 (car argv)) (set! f0 (car argv))
(set! f0 (fix* i0 f0)) (set! f0 (fix* i0 f0))
(set! f0 (cons f0 nil)) (set! f0 (cons f0 nil))
) )
i2
f0
i1 i1
nil f0
g1
g1
) )
1 ; g3 = 1 1 ; g3 = 1
) )

View File

@ -91,8 +91,8 @@ value_t run_interpreter(value_t lambda, value_t argv)
fflush(stdout); fflush(stdout);
fputs("LAMBDA: ", stderr); fprint_value(stderr, state.lambda.value); fputc('\n', stderr); fputs("LAMBDA: ", stderr); fprint_value(stderr, state.lambda.value); fputc('\n', stderr);
fputs("ARGLIST: ", stderr); fprint_value(stderr, state.argv.value); fputc('\n', stderr); fputs("ARGLIST: ", stderr); fprint_value(stderr, state.argv.value); fputc('\n', stderr);
fputs("CONT'N: ", stderr); fprint_value(stderr, state.k.value); fputc('\n', stderr);
fputs("CONTEXT: ", stderr); fprint_value(stderr, state.ctx.value); fputc('\n', stderr); fputs("CONTEXT: ", stderr); fprint_value(stderr, state.ctx.value); fputc('\n', stderr);
fputs("CONT'N: ", stderr); fprint_value(stderr, state.k.value); fputc('\n', stderr);
fputc('\n', stderr); fputc('\n', stderr);
fflush(stderr); fflush(stderr);
#endif #endif
@ -323,13 +323,13 @@ static void perform_tail_call(interp_state_t *state)
new_lambda = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, TAIL_CALL))); new_lambda = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, TAIL_CALL)));
new_argv = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, ARG_LIST))); new_argv = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, ARG_LIST)));
new_k = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, CONTINUATION)));
new_ctx = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, CONTEXT))); new_ctx = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, CONTEXT)));
new_k = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, CONTINUATION)));
state->lambda.value = new_lambda; state->lambda.value = new_lambda;
state->argv.value = new_argv; state->argv.value = new_argv;
state->k.value = new_k;
state->ctx.value = new_ctx; state->ctx.value = new_ctx;
state->k.value = new_k;
} }
static value_t eval_expression(interp_state_t *state, uint8_t code, uint8_t in1, uint8_t in2) static value_t eval_expression(interp_state_t *state, uint8_t code, uint8_t in1, uint8_t in2)
@ -544,9 +544,9 @@ static value_t get_input(const interp_state_t *state, fixnum_t var)
case 253: case 253:
return state->argv.value; return state->argv.value;
case 254: case 254:
return state->k.value;
case 255:
return state->ctx.value; return state->ctx.value;
case 255:
return state->k.value;
default: default:
return UNDEFINED; return UNDEFINED;
} }
@ -570,8 +570,8 @@ static void register_state(interp_state_t *state, value_t lambda, value_t argv)
register_gc_root(&state->lambda, lambda); register_gc_root(&state->lambda, lambda);
register_gc_root(&state->argv, argv); register_gc_root(&state->argv, argv);
register_gc_root(&state->frame, make_vector(120, UNDEFINED)); register_gc_root(&state->frame, make_vector(120, UNDEFINED));
register_gc_root(&state->k, FALSE_VALUE);
register_gc_root(&state->ctx, FALSE_VALUE); register_gc_root(&state->ctx, FALSE_VALUE);
register_gc_root(&state->k, FALSE_VALUE);
register_gc_root(&state->in1, FALSE_VALUE); register_gc_root(&state->in1, FALSE_VALUE);
register_gc_root(&state->in2, FALSE_VALUE); register_gc_root(&state->in2, FALSE_VALUE);
register_gc_root(&state->in3, FALSE_VALUE); register_gc_root(&state->in3, FALSE_VALUE);
@ -582,8 +582,8 @@ static void unregister_state(interp_state_t *state)
unregister_gc_root(&state->lambda); unregister_gc_root(&state->lambda);
unregister_gc_root(&state->argv); unregister_gc_root(&state->argv);
unregister_gc_root(&state->frame); unregister_gc_root(&state->frame);
unregister_gc_root(&state->k);
unregister_gc_root(&state->ctx); unregister_gc_root(&state->ctx);
unregister_gc_root(&state->k);
unregister_gc_root(&state->in1); unregister_gc_root(&state->in1);
unregister_gc_root(&state->in2); unregister_gc_root(&state->in2);
unregister_gc_root(&state->in3); unregister_gc_root(&state->in3);

View File

@ -8,8 +8,8 @@ typedef struct interp_state
gc_root_t lambda; gc_root_t lambda;
gc_root_t frame; gc_root_t frame;
gc_root_t argv; gc_root_t argv;
gc_root_t k;
gc_root_t ctx; gc_root_t ctx;
gc_root_t k;
gc_root_t in1; gc_root_t in1;
gc_root_t in2; gc_root_t in2;
gc_root_t in3; gc_root_t in3;

View File

@ -53,7 +53,7 @@
; ((lambda _ (loop)) (posix-write 1 str result)) ; ((lambda _ (loop)) (posix-write 1 str result))
; (k))) ; (k)))
#(0 1 #="posix-write") #(0 1 #="posix-write")
"\x41\xfc\xfe\xff" ; #(i1=str self=loop k ctx) "\x41\xfc\xfe\xff" ; #(i1=str self=loop ctx k)
2 2
"\x00\x81\x03\xfd\; (set! f1 (car argv)) "\x00\x81\x03\xfd\; (set! f1 (car argv))
\x02\x80\x81\x00\; (set! f0 (cons f1 nil)) \x02\x80\x81\x00\; (set! f0 (cons f1 nil))
@ -61,11 +61,11 @@
\x02\x80\x02\x80\; (set! f0 (cons g2 f0)) \x02\x80\x02\x80\; (set! f0 (cons g2 f0))
\x01\x81\x81\x01\; (set! f1 (eq? f1 g1)) \x01\x81\x81\x01\; (set! f1 (eq? f1 g1))
\x80\x81\x00\x80\; (set! f0 (if f1 nil f0)) \x80\x81\x00\x80\; (set! f0 (if f1 nil f0))
\x81\x81\x42\x03"; (set! f1 (if f1 i2 g3)) \x81\x81\x43\x03"; (set! f1 (if f1 i3 g3))
0x81 ; f1 0x81 ; f1
0x80 ; f0 0x80 ; f0
0x42 ; i2
0x41 ; i1 0x41 ; i1
0x43 ; i3
) )
) )
"\x80\x81" ; #(f0 f1) "\x80\x81" ; #(f0 f1)
@ -77,8 +77,8 @@
\x00\x81\x1b\x02"; (set! f1 (lambda g2)) \x00\x81\x1b\x02"; (set! f1 (lambda g2))
0x01 ; g1 0x01 ; g1
0x80 ; f0 0x80 ; f0
0xfe ; ctx
0x81 ; f1 0x81 ; f1
0xff ; ctx
) )
) )
#() #()
@ -88,11 +88,11 @@
\x00\x82\x1b\x03"; (set! f2 (lambda g3)) \x00\x82\x1b\x03"; (set! f2 (lambda g3))
0x82 ; f2 0x82 ; f2
0x00 ; nil 0x00 ; nil
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
) )
"\xfe\xff" ; k ctx "\xfe\xff" ; ctx k
1 1
"\x00\x80\x03\xfd\; (set! f0 (car argv)) "\x00\x80\x03\xfd\; (set! f0 (car argv))
\x80\x80\x01\x40\; (set! f0 (if f0 g1 i0)) \x80\x80\x01\x40\; (set! f0 (if f0 g1 i0))
@ -111,8 +111,8 @@
\x00\x81\x1b\x03"; (set! f1 (lambda g3)) \x00\x81\x1b\x03"; (set! f1 (lambda g3))
0x02 ; g2 0x02 ; g2
0x80 ; f0 0x80 ; f0
0xfe ; ctx
0x81 ; f1 0x81 ; f1
0xff ; ctx
) )
; vim:set sw=2 expandtab syntax=: ; vim:set sw=2 expandtab syntax=:

View File

@ -17,7 +17,7 @@
#( #(
#i"../lib/math/fact.rla" #i"../lib/math/fact.rla"
) )
"\xfe\xff" ; k ctx "\xfe\xff" ; ctx k
0 0
"" ""
0x01 ; g1 0x01 ; g1
@ -32,7 +32,7 @@
"\x00\x80\x1b\x01"; (set! f0 (lambda g1)) "\x00\x80\x1b\x01"; (set! f0 (lambda g1))
0x02 ; g2 0x02 ; g2
0xfd ; argv 0xfd ; argv
0xfe ; ctx
0x80 ; f0 0x80 ; f0
0xff ; ctx
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -20,7 +20,7 @@
"" ""
0x01 ; g1 0x01 ; g1
0x02 ; g2 0x02 ; g2
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -10,7 +10,7 @@
"" ""
0x01 ; g1 0x01 ; g1
0x02 ; g2 0x02 ; g2
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -15,7 +15,7 @@
\x00\x81\x03\x81\; (set! f1 (car f1)) \x00\x81\x03\x81\; (set! f1 (car f1))
\x08\x80\x80\x81\; (set! f0 (fix+ f0 f1)) \x08\x80\x80\x81\; (set! f0 (fix+ f0 f1))
\x02\x80\x80\x00"; (set! f0 (cons f0 nil)) \x02\x80\x80\x00"; (set! f0 (cons f0 nil))
0xfe ; k 0xff ; k
0x80 ; f0 0x80 ; f0
0x01 ; g1 0x01 ; g1
0x01 ; g1 0x01 ; g1
@ -29,7 +29,7 @@
"" ""
0x01 ; g1 0x01 ; g1
0x02 ; g2 0x02 ; g2
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -15,7 +15,7 @@
\x00\x81\x03\x81\; (set! f1 (car f1)) \x00\x81\x03\x81\; (set! f1 (car f1))
\x08\x80\x80\x81\; (set! f0 (fix+ f0 f1)) \x08\x80\x80\x81\; (set! f0 (fix+ f0 f1))
\x02\x80\x80\x00"; (set! f0 (cons f0 nil)) \x02\x80\x80\x00"; (set! f0 (cons f0 nil))
0xfe ; k 0xff ; k
0x80 ; f0 0x80 ; f0
0x01 ; g1 0x01 ; g1
0x01 ; g1 0x01 ; g1
@ -29,7 +29,7 @@
"" ""
0x01 ; g1 0x01 ; g1
0x02 ; g2 0x02 ; g2
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -10,7 +10,7 @@
"" ""
0x01 ; g1 0x01 ; g1
0x02 ; g2 0x02 ; g2
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -13,7 +13,7 @@
"" ""
0x01 ; g1 0x01 ; g1
0x02 ; g2 0x02 ; g2
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -20,7 +20,7 @@
"" ""
0x01 ; g1 0x01 ; g1
0x02 ; g2 0x02 ; g2
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -10,7 +10,7 @@
"" ""
0x01 ; g1 0x01 ; g1
0x02 ; g2 0x02 ; g2
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -17,7 +17,7 @@
#() #()
0 0
"" ""
0xfe ; k 0xff ; k
0x01 ; g1 0x01 ; g1
0x02 ; g2 0x02 ; g2
0x02 ; g2 0x02 ; g2
@ -37,7 +37,7 @@
; (lambda (m) ; (lambda (m)
; (k (* n m))))) ; (k (* n m)))))
#(#f) #(#f)
"\x40\xfe" ; i0 k "\x40\xff" ; i0 k
1 1
"\x00\x80\x03\xfd\; (set! f0 (car argv)) "\x00\x80\x03\xfd\; (set! f0 (car argv))
\x0a\x80\x40\x80\; (set! f0 (fix* i0 f0)) \x0a\x80\x40\x80\; (set! f0 (fix* i0 f0))
@ -56,8 +56,8 @@
\x00\x81\x1b\x02"; (set! f1 (lambda g2)) \x00\x81\x1b\x02"; (set! f1 (lambda g2))
0x03 ; g3 0x03 ; g3
0x80 ; f0 0x80 ; f0
0xfe ; ctx
0x81 ; f1 0x81 ; f1
0xff ; ctx
) )
) )
#() #()
@ -68,7 +68,7 @@
\x00\x81\x1b\x81"; (set! f1 (lambda f1)) \x00\x81\x1b\x81"; (set! f1 (lambda f1))
0x81 ; f1 0x81 ; f1
0x00 ; nil 0x00 ; nil
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -12,7 +12,7 @@
\x02\x81\x81\x82\; (set! f1 (cons f1 f2)) \x02\x81\x81\x82\; (set! f1 (cons f1 f2))
\x02\x80\x80\x81\; (set! f0 (cons f0 f1)) \x02\x80\x80\x81\; (set! f0 (cons f0 f1))
\x02\x80\x80\x00"; (set! f0 (cons f0 nil)) \x02\x80\x80\x00"; (set! f0 (cons f0 nil))
0xfe ; k 0xff ; k
0x80 ; f0 0x80 ; f0
0x01 ; g1 0x01 ; g1
0x01 ; g1 0x01 ; g1

View File

@ -25,7 +25,7 @@
; (lambda (x) ; (lambda (x)
; ((if x k2 k) x)) ; ((if x k2 k) x))
#(#f) #(#f)
"\x40\xfe" ; i0 k "\x40\xff" ; i0 k
1 1
"\x00\x80\x03\xfd\; (set! f0 (car argv)) "\x00\x80\x03\xfd\; (set! f0 (car argv))
\x80\x80\x41\x40"; (set! f0 (if f0 i1 i0)) \x80\x80\x41\x40"; (set! f0 (if f0 i1 i0))
@ -35,14 +35,14 @@
0x01 ; g1 0x01 ; g1
) )
) )
"\xfe" ; k "\xff" ; k
2 2
"\x00\x80\x03\xfd\; (set! f0 (car argv)) "\x00\x80\x03\xfd\; (set! f0 (car argv))
\x00\x81\x1b\x01"; (set! f1 (lambda g1)) \x00\x81\x1b\x01"; (set! f1 (lambda g1))
0x80 ; f0 0x80 ; f0
0x00 ; nil 0x00 ; nil
0xfe ; ctx
0x81 ; f1 0x81 ; f1
0xff ; ctx
) )
#t #t
) )
@ -54,7 +54,7 @@
\x02\x80\x81\x80"; (set! f0 (cons f1 f0)) \x02\x80\x81\x80"; (set! f0 (cons f1 f0))
0x01 ; g1 0x01 ; g1
0x80 ; f0 0x80 ; f0
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -24,8 +24,8 @@
\x02\x81\x02\x81"; (set! f1 (cons g2 f1)) \x02\x81\x02\x81"; (set! f1 (cons g2 f1))
0x01 ; g1 0x01 ; g1
0x81 ; f1 0x81 ; f1
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
) )
#() #()
@ -35,7 +35,7 @@
\x02\x80\x02\x80"; (set! f0 (cons g2 f0)) \x02\x80\x02\x80"; (set! f0 (cons g2 f0))
0x01 ; g1 0x01 ; g1
0x80 ; f0 0x80 ; f0
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -9,7 +9,7 @@
\x00\x81\x03\x81\; (set! f1 (car f1)) \x00\x81\x03\x81\; (set! f1 (car f1))
\x02\x80\x80\x81\; (set! f0 (cons f0 f1)) \x02\x80\x80\x81\; (set! f0 (cons f0 f1))
\x02\x80\x80\x00"; (set! f0 (cons f0 nil)) \x02\x80\x80\x00"; (set! f0 (cons f0 nil))
0xfe ; k 0xff ; k
0x80 ; f0 0x80 ; f0
0x01 ; g1 0x01 ; g1
0x01 ; g1 0x01 ; g1

View File

@ -19,7 +19,7 @@
"\x81" ; f1 "\x81" ; f1
1 1
"\x02\x80\x40\x00"; (set! f0 (cons i0 nil)) "\x02\x80\x40\x00"; (set! f0 (cons i0 nil))
0xfe ; k 0xff ; k
0x80 ; f0 0x80 ; f0
0x01 ; g1 0x01 ; g1
0x01 ; g1 0x01 ; g1
@ -36,7 +36,7 @@
; (lambda (new-init) ; (lambda (new-init)
; (k (foldl fn new-init (cdr lst)))) ; (k (foldl fn new-init (cdr lst))))
#(#=0) #(#=0)
"\x40\x41\x42\xfe\xff" ; i0 i1 i2 k ctx "\x40\x41\x42\xfe\xff" ; i0 i1 i2 ctx k
2 2
"\x00\x80\x04\x42\; (set! f0 (cdr i2)) "\x00\x80\x04\x42\; (set! f0 (cdr i2))
\x02\x80\x80\x00\; (set! f0 (cons f0 nil)) \x02\x80\x80\x00\; (set! f0 (cons f0 nil))
@ -57,8 +57,8 @@
\x00\x81\x1b\x01"; (set! f1 (lambda g1)) \x00\x81\x1b\x01"; (set! f1 (lambda g1))
0x40 ; i0 0x40 ; i0
0x80 ; f0 0x80 ; f0
0xfe ; ctx
0x81 ; f1 0x81 ; f1
0xff ; ctx
) )
) )
#() #()
@ -73,7 +73,7 @@
\x00\x83\x1b\x83"; (set! f0 (lambda f3)) \x00\x83\x1b\x83"; (set! f0 (lambda f3))
0x83 ; f0 0x83 ; f0
0x00 ; nil 0x00 ; nil
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -21,7 +21,7 @@
"\x81" ; f1 "\x81" ; f1
1 1
"\x02\x80\x40\x00"; (set! f0 (cons i0 nil)) "\x02\x80\x40\x00"; (set! f0 (cons i0 nil))
0xfe ; k 0xff ; k
0x80 ; f0 0x80 ; f0
0x01 ; g1 0x01 ; g1
0x01 ; g1 0x01 ; g1
@ -37,7 +37,7 @@
#S(#="template" #S(#="template"
; (lambda (v) (k (fn lstcar v))) ; (lambda (v) (k (fn lstcar v)))
#() #()
"\x40\x81\xfe\xff" ; i0 f1 k ctx "\x40\x81\xfe\xff" ; i0 f1 ctx k
1 1
"\x00\x80\x03\xfd\; (set! f0 (car argv)) "\x00\x80\x03\xfd\; (set! f0 (car argv))
\x02\x80\x80\x00\; (set! f0 (cons f0 nil)) \x02\x80\x80\x00\; (set! f0 (cons f0 nil))
@ -59,8 +59,8 @@
\x02\x83\x40\x83"; (set! f3 (cons i0 f3)) \x02\x83\x40\x83"; (set! f3 (cons i0 f3))
0x02 ; g2 0x02 ; g2
0x83 ; f3 0x83 ; f3
0xfe ; ctx
0x82 ; f2 0x82 ; f2
0xff ; ctx
) )
) )
#() #()
@ -75,7 +75,7 @@
\x00\x83\x1b\x83"; (set! f3 (lambda f3)) \x00\x83\x1b\x83"; (set! f3 (lambda f3))
0x83 ; f3 0x83 ; f3
0x00 ; nil 0x00 ; nil
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -13,7 +13,7 @@
\x02\x80\x02\x80"; (set! f0 (cons g2 f0)) \x02\x80\x02\x80"; (set! f0 (cons g2 f0))
0x01 ; g1 0x01 ; g1
0x80 ; f0 0x80 ; f0
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -17,7 +17,7 @@
; (lambda (y) ; (lambda (y)
; (k (cons y rlst))) ; (k (cons y rlst)))
#(#f) #(#f)
"\x81\xfe\xff" ; f1 k ctx "\x81\xff" ; f1 k
1 1
"\x00\x80\x03\xfd\; (set! f0 (car argv)) "\x00\x80\x03\xfd\; (set! f0 (car argv))
\x02\x80\x80\x40\; (set! f0 (cons f0 i0)) \x02\x80\x80\x40\; (set! f0 (cons f0 i0))
@ -37,20 +37,20 @@
\x02\x80\x80\x00"; (set! f0 (cons f0 nil)) \x02\x80\x80\x00"; (set! f0 (cons f0 nil))
0x40 ; i0 0x40 ; i0
0x80 ; f0 0x80 ; f0
0xfe ; ctx
0x81 ; f1 0x81 ; f1
0xff ; ctx
) )
#S(#="template" #S(#="template"
; (lambda (rlst) ; (lambda (rlst)
; (k (reverse rlst))) ; (k (reverse rlst)))
#(#f #i"reverse.rla") #(#i"reverse.rla")
"\xfe" "\xfe\xff" ; ctx k
0 0
"" ""
0x02 ; g2 0x01 ; g1
0xfd ; argv 0xfd ; argv
0x40 ; i0 0x40 ; i0
0x01 ; g1 0x41 ; i1
) )
) )
#() #()
@ -65,7 +65,7 @@
\x00\x83\x1b\x03"; (set! f3 (lambda g3)) \x00\x83\x1b\x03"; (set! f3 (lambda g3))
0x01 ; g1 0x01 ; g1
0x82 ; f2 0x82 ; f2
0xfe ; ctx
0x83 ; f3 0x83 ; f3
0xff ; ctx
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -25,7 +25,7 @@
; (lambda (x) ; (lambda (x)
; ((if x k2 k) x)) ; ((if x k2 k) x))
#(#f) #(#f)
"\x40\xfe" ; i0 k "\x40\xff" ; i0 k
1 1
"\x00\x80\x03\xfd\; (set! f0 (car argv)) "\x00\x80\x03\xfd\; (set! f0 (car argv))
\x80\x80\x40\x41"; (set! f0 (if f0 i0 i1)) \x80\x80\x40\x41"; (set! f0 (if f0 i0 i1))
@ -35,14 +35,14 @@
0x01 ; g1 0x01 ; g1
) )
) )
"\xfe" ; k "\xff" ; k
2 2
"\x00\x80\x03\xfd\; (set! f0 (car argv)) "\x00\x80\x03\xfd\; (set! f0 (car argv))
\x00\x81\x1b\x01"; (set! f1 (lambda g1)) \x00\x81\x1b\x01"; (set! f1 (lambda g1))
0x80 ; f0 0x80 ; f0
0x00 ; nil 0x00 ; nil
0xfe ; ctx
0x81 ; f1 0x81 ; f1
0xff ; ctx
) )
#f #f
) )
@ -54,7 +54,7 @@
\x02\x80\x81\x80"; (set! f0 (cons f1 f0)) \x02\x80\x81\x80"; (set! f0 (cons f1 f0))
0x01 ; g1 0x01 ; g1
0x80 ; f0 0x80 ; f0
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -14,7 +14,7 @@
\x02\x80\x02\x80"; (set! f0 (cons g2 f0)) \x02\x80\x02\x80"; (set! f0 (cons g2 f0))
0x01 ; g1 0x01 ; g1
0x80 ; f0 0x80 ; f0
0xfe ; k 0xfe ; ctx
0xff ; ctx 0xff ; k
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab: