Yuichi Nishiwaki
1ab588d21f
added hygienic macro facility! Fooo!
2013-11-27 15:58:28 +09:00
Yuichi Nishiwaki
9a027dae6e
add error guard
2013-11-27 15:57:23 +09:00
Yuichi Nishiwaki
bedc5dc6be
revise output format of syntactic closure object
2013-11-27 15:56:29 +09:00
Yuichi Nishiwaki
ceedd05ef0
[bugfix] pic_apply_argv concatenated args in reverse order
2013-11-27 15:55:54 +09:00
Yuichi Nishiwaki
78cafe3db7
add make-syntactic-closure function
2013-11-27 15:04:44 +09:00
Yuichi Nishiwaki
ab74920a6f
add pic_sc (syntactic closure) structure
2013-11-27 15:04:02 +09:00
Yuichi Nishiwaki
a7a3bfc270
[CSE] add new_global_senv and new_local_senv
2013-11-27 14:19:46 +09:00
Yuichi Nishiwaki
b4218a7a03
cosmetic changes
2013-11-27 14:00:23 +09:00
Yuichi Nishiwaki
73831283b6
cleanup
2013-11-27 13:51:24 +09:00
Yuichi Nishiwaki
c1788d31b0
Merge branch 'master' into syntactic-closure
2013-11-27 13:06:37 +09:00
Yuichi Nishiwaki
bbe3e990e4
Revert "pluggable heap pages"
...
This reverts commit e6523730a4
.
2013-11-27 13:04:12 +09:00
Yuichi Nishiwaki
5e3f2dacf4
Revert "add_heap_page should not be invoked in gc_alloc, but should be in obj_alloc"
...
This reverts commit f11623f075
.
2013-11-27 13:04:03 +09:00
Yuichi Nishiwaki
94aac37443
macros must be added to var_tbl
2013-11-26 17:43:59 -08:00
Yuichi Nishiwaki
d2af692280
add a fixme comment
2013-11-26 17:43:49 -08:00
Yuichi Nishiwaki
d7f8d67bf2
debug-print when unbound symbol is found
2013-11-26 16:52:30 -08:00
Yuichi Nishiwaki
38ab43d7fc
[bugfix] binding leak
2013-11-26 16:51:48 -08:00
Yuichi Nishiwaki
3710d5feea
support varg lambda
2013-11-26 16:51:17 -08:00
Yuichi Nishiwaki
b2704fb123
increment xlen in the end
2013-11-26 16:50:38 -08:00
Yuichi Nishiwaki
c336a354e4
publish pic_defmacro as a public API
2013-11-26 09:09:15 -08:00
Yuichi Nishiwaki
2dee30a0b5
macroexpand_list supports improper list
2013-11-26 09:07:57 -08:00
Yuichi Nishiwaki
43d449d2aa
s/define_macro/pic_defmacro/g
2013-11-26 09:07:06 -08:00
Yuichi Nishiwaki
cbd636e0a7
[bugfix] do not release pic->var_tbl when a senv holding it is dead
2013-11-26 09:00:16 -08:00
Yuichi Nishiwaki
e7673c65bd
[bugfix] syntaces should be registered to var_tbl, not global_tbl
2013-11-26 08:59:16 -08:00
Yuichi Nishiwaki
be311cb96f
replace old macroexpand facility with new renamer implementation
2013-11-26 08:43:58 -08:00
Yuichi Nishiwaki
1f3f7c99a2
save macro procesures in each syntax object
2013-11-26 08:42:13 -08:00
Yuichi Nishiwaki
3d1f74d8f5
add 'define-macro' core syntax
2013-11-26 08:41:01 -08:00
Yuichi Nishiwaki
ddbc2c83a2
add missing core symbol registration
2013-11-26 08:39:37 -08:00
Yuichi Nishiwaki
3009473d52
debug prints for macroexpand
2013-11-26 08:38:26 -08:00
Yuichi Nishiwaki
f6bc51d16d
add xlen/xcapa member to pic_senv
2013-11-26 08:36:58 -08:00
Yuichi Nishiwaki
a32473ae92
add core syntaces in pic_open
2013-11-26 08:35:35 -08:00
Yuichi Nishiwaki
a2e1f21b29
add global identifier table
2013-11-26 08:30:30 -08:00
Yuichi Nishiwaki
673b66a723
use register_core_symbol macro to initialize pic_state
2013-11-26 06:40:48 -08:00
Yuichi Nishiwaki
ad3c268f81
insert renamer pass after old macroexpansion phase
2013-11-26 04:08:46 -08:00
Yuichi Nishiwaki
1ad562f1a8
[wip] add renamer
2013-11-26 04:06:46 -08:00
Yuichi Nishiwaki
573ba79782
[bugfix] log10 must not be given 0
2013-11-26 04:06:03 -08:00
Yuichi Nishiwaki
b7f0f3dfb3
[bugfix] get rid of a comma
2013-11-26 04:05:37 -08:00
Yuichi Nishiwaki
c59d8f601b
add PIC_TT_SENV and PIC_TT_SYNTAX
2013-11-26 04:05:02 -08:00
Yuichi Nishiwaki
3c65025394
add macro.h
2013-11-26 04:03:52 -08:00
Yuichi Nishiwaki
bf6a337a5f
add pic_cxxr functions
2013-11-26 02:42:13 -08:00
Yuichi Nishiwaki
72cf45d4ea
add `new_uniq_sym` function
2013-11-25 23:38:39 -08:00
Yuichi Nishiwaki
4701f86ff0
fix a grammar error
2013-11-26 16:22:49 +09:00
Yuichi Nishiwaki
52f1776b22
cleanup
2013-11-25 11:10:57 +09:00
Yuichi Nishiwaki
f11623f075
add_heap_page should not be invoked in gc_alloc, but should be in obj_alloc
2013-11-25 00:24:03 +09:00
Yuichi Nishiwaki
df20de5285
push back dead objects to free list
2013-11-25 00:22:32 +09:00
Yuichi Nishiwaki
40bfe13895
add a comment to sweep algorithm
2013-11-22 07:30:29 -08:00
Yuichi Nishiwaki
563b65efde
s/expand.c/macro.c/
2013-11-22 07:22:52 -08:00
Yuichi Nishiwaki
579735d16e
s/heap_page/pic_heap/g
2013-11-22 07:19:31 -08:00
Yuichi Nishiwaki
e6523730a4
pluggable heap pages
2013-11-22 07:12:03 -08:00
Yuichi Nishiwaki
1be72f1e18
rewrite gc!
2013-11-22 06:38:29 -08:00
Yuichi Nishiwaki
2dd293c0f9
[workaround] add stack overflow detector
2013-11-22 06:37:57 -08:00
Yuichi Nishiwaki
0a521c2314
add overflow guards to some global stacks (or value pools)
2013-11-22 06:35:51 -08:00
Yuichi Nishiwaki
23b806cc41
print propagated error messages when stdlib failed to build
2013-11-22 06:34:34 -08:00
Yuichi Nishiwaki
4b326e4f6e
add new compilation flag GC_DEBUG_DETAIL
2013-11-22 03:29:05 -08:00
Yuichi Nishiwaki
4004282e50
alloc stacks by calloc, not malloc
2013-11-22 03:28:09 -08:00
Yuichi Nishiwaki
626c0adb3a
fix broken pic_type_repr
2013-11-22 03:27:09 -08:00
Yuichi Nishiwaki
f610424ae5
remove unnecessary protect
2013-11-22 01:53:22 -08:00
Yuichi Nishiwaki
05b2717b9e
less memory usage of pic_reverse
2013-11-21 06:32:56 -08:00
Yuichi Nishiwaki
00fc0ee931
protect more objects during expansion
2013-11-21 06:31:32 -08:00
Yuichi Nishiwaki
f146287eff
load_stdlib releases arena objects every time evaluating exprssion
2013-11-21 06:30:33 -08:00
Yuichi Nishiwaki
6581177ec5
realloc pic->irep when exhausted
2013-11-21 06:28:43 -08:00
Yuichi Nishiwaki
58b9e2cb60
debug prints when a global stack is realloc'ed
2013-11-21 06:28:06 -08:00
Yuichi Nishiwaki
e49ddbd13b
[bugfix] makeing a shared library failure under the version 3 of bison
2013-11-18 20:47:20 +09:00
Yuichi Nishiwaki
ed0b02ecfa
fixed #5 (again)
2013-11-18 20:38:03 +09:00
Yuichi Nishiwaki
d2bb4ad4f2
Revert "(maybe) fix #5 "
...
This reverts commit a3ac65a75f
.
2013-11-18 20:36:30 +09:00
Yuichi Nishiwaki
a3ac65a75f
(maybe) fix #5
2013-11-18 20:35:27 +09:00
Yuichi Nishiwaki
d5f01595b0
fixed #4
2013-11-18 20:24:09 +09:00
Yuichi Nishiwaki
6f94202e13
s/pic_expand/pic_macroexpand/g
2013-11-18 16:36:44 +09:00
Yuichi Nishiwaki
a3c2dabcc7
add feature function
2013-11-18 01:46:28 +09:00
Yuichi Nishiwaki
0d952d3639
add string functions
2013-11-18 01:09:54 +09:00
Yuichi Nishiwaki
6cfbe51c87
pic_get_args: change type of argc
2013-11-18 01:07:51 +09:00
Yuichi Nishiwaki
6ac3055816
change return type of pic_str_new to struct pic_string *
2013-11-18 00:28:42 +09:00
Yuichi Nishiwaki
d4188e0969
add error function
2013-11-17 18:16:03 +09:00
Yuichi Nishiwaki
5ffb4eb6c9
add string?
2013-11-17 17:42:52 +09:00
Yuichi Nishiwaki
9526ca789a
free as many as possible!
2013-11-17 17:33:28 +09:00
Yuichi Nishiwaki
fdc9bfea4e
initial exception handling support
2013-11-17 17:25:26 +09:00
Yuichi Nishiwaki
5668ae1b29
[bugfix] local variables should be initialized before copied to env object
2013-11-17 17:24:37 +09:00
Yuichi Nishiwaki
737f916a8c
add pic_errorf
2013-11-17 17:23:13 +09:00
Yuichi Nishiwaki
224b08fb92
[bugfix] after save_cont any local variable must not be modified!
...
If save_cont returns a cont object, a local variable will receive the
object and the machine stack state will have just been changed then.
To avoid that, we need set cont object to the local before the machine
stack is copied.
2013-11-17 17:20:19 +09:00
Yuichi Nishiwaki
38988b7770
add global exception handler stack
2013-11-17 16:02:58 +09:00
Yuichi Nishiwaki
c79e08632c
when restoring continuation sp and ci must be re-allocated
2013-11-17 15:58:53 +09:00
Yuichi Nishiwaki
5947240614
[bugfix] fix crash on deeply nested lambdas
2013-11-17 13:12:59 +09:00
Yuichi Nishiwaki
14ad038051
wipe reallocated cv_tbl
2013-11-17 13:10:36 +09:00
Yuichi Nishiwaki
242a366cbf
check vector index out of range
2013-11-17 02:32:27 +09:00
Yuichi Nishiwaki
1ef3ed91a2
fix for-each compilation bug
2013-11-16 23:32:34 +09:00
Yuichi Nishiwaki
a68b470e06
pic_get_args can parse '*'
2013-11-15 22:53:41 +09:00
Yuichi Nishiwaki
c57f1bfbe1
define math comp predicates as C functions
2013-11-15 22:51:51 +09:00
Yuichi Nishiwaki
e94aaffd34
shrink default arena size!
2013-11-15 19:54:47 +09:00
Yuichi Nishiwaki
9cdca8bc70
implement yy arena gc
2013-11-15 19:40:31 +09:00
Yuichi Nishiwaki
690f66dd76
s/is_marked/gc_is_marked/g
2013-11-15 19:32:01 +09:00
Yuichi Nishiwaki
f506eac3dd
add pic_obj_alloc_unsafe; preparation for yy_arena
2013-11-15 19:31:17 +09:00
Yuichi Nishiwaki
9662ab30ec
add pic_vec_extend_ip (for internal API)
2013-11-15 19:30:25 +09:00
Yuichi Nishiwaki
c62505b930
initialize newly allocated vector with falses
2013-11-15 19:29:54 +09:00
Yuichi Nishiwaki
73d9b0dc79
use strndup if possible
2013-11-15 17:08:18 +09:00
Yuichi Nishiwaki
93e5758e4c
[bugfix] gc may enter an infinite loop
2013-11-15 16:11:54 +09:00
Yuichi Nishiwaki
a2f022df4e
implement native version of some primitive functions such as car,crd...
2013-11-15 16:07:03 +09:00
Yuichi Nishiwaki
984588b1b6
add reference count GC for pic_block objects
2013-11-15 11:51:58 +09:00
Yuichi Nishiwaki
c22f566c06
arena stash can be statically allocated
2013-11-15 10:54:56 +09:00
Yuichi Nishiwaki
066575fa1c
error when apply got non-proc at the first place of arguments
2013-11-14 20:42:14 +09:00
Yuichi Nishiwaki
850290dda3
add some char primitives
2013-11-14 20:41:22 +09:00
Yuichi Nishiwaki
7f35eb7daa
support named characters
2013-11-14 19:45:38 +09:00
Yuichi Nishiwaki
6de5bc7550
propagate jmp_bufs (useful when C stack and scheme stack interleave)
2013-11-14 19:26:06 +09:00
Yuichi Nishiwaki
e68c69ceb1
support datum comment
2013-11-14 17:31:40 +09:00
Yuichi Nishiwaki
48c5c6b17c
add vector-set!
2013-11-14 16:57:07 +09:00
Yuichi Nishiwaki
b56b86aae2
[bugfix] variables defined by internal definitions may be referred from
...
inner environments
2013-11-14 16:52:49 +09:00
Yuichi Nishiwaki
b9fce69c61
support internal definitions
2013-11-13 18:08:22 +09:00
Yuichi Nishiwaki
2fb4720e22
[bugfix] (= 1 1.0) doesn't work
2013-11-13 17:40:31 +09:00
Yuichi Nishiwaki
5479e7c6ba
[bugfix] atan and log functions doesn't accept single argument
2013-11-13 17:38:54 +09:00
Yuichi Nishiwaki
223e873ff0
accept empty lines in repl
2013-11-13 17:37:05 +09:00
Yuichi Nishiwaki
d6c377a33b
native support for dynamic-wind
2013-11-11 18:04:21 +09:00
Yuichi Nishiwaki
8c40fc8d9e
add square bracket notation
2013-11-11 11:57:01 +09:00
Yuichi Nishiwaki
8b484b69d7
rename fields in struct pic_cont
2013-11-11 10:14:42 +09:00
Yuichi Nishiwaki
4fea9169cc
error when argument of apply is not a proper list
2013-11-11 08:01:08 +09:00
Yuichi Nishiwaki
7f3d3ac11b
copy stacks to restore a continuation
2013-11-11 07:59:52 +09:00
Yuichi Nishiwaki
96d75b3c06
add apply function
2013-11-10 00:41:59 +09:00
Yuichi Nishiwaki
fd3300f9db
emit int result in int-int division if possible
2013-11-09 16:32:13 +09:00
Yuichi Nishiwaki
0d2e49c17e
cleanup
2013-11-09 15:29:58 +09:00
Yuichi Nishiwaki
9d467e4d14
change some function names in cont.c
2013-11-09 15:25:19 +09:00
Yuichi Nishiwaki
76990d512f
suppress warnings
2013-11-09 15:24:58 +09:00
Yuichi Nishiwaki
64ae8bd7b0
initial call/cc support
2013-11-09 14:14:25 +09:00
Yuichi Nishiwaki
e373aa7b92
add missing pic_apply_argv definition
2013-11-09 14:13:14 +09:00
Yuichi Nishiwaki
0d28f246de
add pic_get_proc
2013-11-09 14:12:59 +09:00
Yuichi Nishiwaki
89eceec7f8
fix a bug that pic_apply faults when cfunc proc is given in DEBUG mode
2013-11-09 14:12:36 +09:00
Yuichi Nishiwaki
125189e25e
fix a bug in initial ciend setting
2013-11-09 14:11:54 +09:00
Yuichi Nishiwaki
d973f41d84
values of some compound types can reach to expanstion phase
2013-11-09 14:11:19 +09:00
Yuichi Nishiwaki
d3ed7bce53
eq? and eqv? return true when the pointers are equal
2013-11-09 13:41:11 +09:00
Yuichi Nishiwaki
62f19e85c5
varg * and / operators
2013-11-07 12:52:59 +09:00
Yuichi Nishiwaki
9d304be02e
varg - operator
2013-11-07 12:18:00 +09:00
Yuichi Nishiwaki
84c1156b9d
add unary minus operator
2013-11-07 12:17:37 +09:00
Yuichi Nishiwaki
ae376b4903
fix broken pic_float_p
2013-11-07 12:17:16 +09:00
Yuichi Nishiwaki
b0a4249220
varg + operator
2013-11-06 18:55:06 +09:00
Yuichi Nishiwaki
8a0b8da884
missing pic_eqv_p (when PIC_NAN_BOXING disabled)
2013-11-06 18:54:46 +09:00
Yuichi Nishiwaki
fc42c71304
add eqv? and equal?
2013-11-06 16:12:31 +09:00
Yuichi Nishiwaki
27dc840118
eq? predicate supports nan-boxing
2013-11-06 16:06:31 +09:00
Yuichi Nishiwaki
ac14a2271b
fix a bug in pic_false_value
2013-11-05 21:08:32 +09:00
Yuichi Nishiwaki
d9cb5d4eee
nan-boxing support
2013-11-05 20:33:24 +09:00
Yuichi Nishiwaki
e056586ab9
add pic_init_value macro
2013-11-05 00:42:44 -05:00
Yuichi Nishiwaki
46fccff806
cleanup
2013-11-05 00:30:03 -05:00
Yuichi Nishiwaki
5850699d75
force indirect reference to pic_value vtype
2013-11-04 23:37:08 -05:00
Yuichi Nishiwaki
9bba0353e8
add some bytevector primitives
2013-11-04 22:58:16 -05:00
Yuichi Nishiwaki
aebf7f00f7
initial bytevector support
2013-11-04 22:38:23 -05:00
Yuichi Nishiwaki
1675ad9f52
initial char support
2013-11-04 21:37:18 -05:00
Yuichi Nishiwaki
8aca1ebc96
rename pic_code.u.c -> pic_code.u.r
2013-11-04 21:32:09 -05:00
Yuichi Nishiwaki
5bb762b6e3
[bugfix] crash on calling vector-ref
2013-11-04 20:59:43 -05:00
Yuichi Nishiwaki
01a5819706
add vector primitives
2013-11-04 20:55:57 -05:00
Yuichi Nishiwaki
fb66791216
do not create pic_env object when not needed
2013-11-04 20:27:44 -05:00
Yuichi Nishiwaki
86458359e3
reduce allocation size when creating pic_env object in OP_CALL
2013-11-04 20:23:06 -05:00
Yuichi Nishiwaki
2dc955aaf5
s/cv_tbl/dirty_flags/g
2013-11-04 19:14:21 -05:00
Yuichi Nishiwaki
d0602303e3
s/num_val/valuec/g
2013-11-04 16:07:36 -05:00
Yuichi Nishiwaki
f5b98e38f8
[bugfix] allocate pic_env values area for local variables
2013-11-04 15:32:26 -05:00
Yuichi Nishiwaki
76dadc8448
remove toplevel pic_env that is never used
2013-11-04 15:30:11 -05:00
Yuichi Nishiwaki
aeff650ccf
no need to control arena_index in pic_codegen
2013-11-04 13:18:46 -05:00
Yuichi Nishiwaki
808fe32ac0
add boolean functions
2013-11-03 11:39:13 -05:00
Yuichi Nishiwaki
404ccb7fb1
cleanup
2013-11-01 19:19:51 +09:00
Yuichi Nishiwaki
346b159e7e
add some debug prints
2013-11-01 19:02:46 +09:00
Yuichi Nishiwaki
1f0d096ed6
protect return values from gc at the end of VM
2013-11-01 18:56:17 +09:00
Yuichi Nishiwaki
77b6b94e74
gc must mark macros as well
2013-11-01 18:55:44 +09:00
Yuichi Nishiwaki
8007baf011
[bugfix] allocate space to hold closed rest args variable in pic_env
2013-11-01 18:55:23 +09:00
Yuichi Nishiwaki
75667d7649
[bugfix] push nil_value even if ci->argc equals varg proc's argc
2013-11-01 15:09:20 +09:00
Yuichi Nishiwaki
5a7b19b348
save each opcode currently fetched into 'c'
2013-11-01 14:44:26 +09:00
Yuichi Nishiwaki
5e74caa7a5
add some important primitive macros such as cond, and, or, ...etc
2013-10-31 00:31:33 +09:00
Yuichi Nishiwaki
207ec5bd24
add eq? function
2013-10-31 00:29:55 +09:00
Yuichi Nishiwaki
98a41314fe
parser returns multiple expressions in a call
2013-10-30 17:06:01 +09:00
Yuichi Nishiwaki
6fcce1cd23
cleanup
2013-10-30 16:43:15 +09:00
Yuichi Nishiwaki
b7e55b043f
introduce legacy macros
2013-10-30 16:42:44 +09:00
Yuichi Nishiwaki
abd5bc9216
fix a bug introded in prev prev commit
2013-10-30 15:40:40 +09:00
Yuichi Nishiwaki
1e4ff3276a
add pic_type_repr
2013-10-30 15:37:33 +09:00
Yuichi Nishiwaki
d4001a70ae
VM works with procs not terminated with OP_STOP
2013-10-30 15:36:28 +09:00
Yuichi Nishiwaki
5be1cd7092
add some comments in codegen_scopes' members
2013-10-30 12:16:45 +09:00
Yuichi Nishiwaki
611b273dcd
missed to add src/vector.c
2013-10-30 10:12:04 +09:00
Yuichi Nishiwaki
76ec63d1ca
adjust callinfo when OP_STOP
2013-10-30 10:05:47 +09:00
Yuichi Nishiwaki
9bc172bde5
add stack underflow detector
2013-10-30 10:05:21 +09:00
Yuichi Nishiwaki
a4d20060e7
compile tail calls into OP_TAILCALL
2013-10-30 10:04:23 +09:00
Yuichi Nishiwaki
e4b913cb15
add OP_TAILCALL
2013-10-30 10:03:46 +09:00
Yuichi Nishiwaki
4721f42f5a
bugfix: define can take only 1 argument
2013-10-29 22:16:16 +09:00
Yuichi Nishiwaki
edd890ae0b
support 2-argument if syntax
2013-10-29 22:15:58 +09:00
Yuichi Nishiwaki
073f45666a
write function should be print even env objects
2013-10-29 16:44:38 +09:00
Yuichi Nishiwaki
a0a8a94abc
add gc stress test
2013-10-29 16:40:25 +09:00
Yuichi Nishiwaki
35bbd66812
fix gc bug: ci->env and env-up are nullable
2013-10-29 16:39:57 +09:00
Yuichi Nishiwaki
edcd060a8a
initial vector support
2013-10-29 15:51:37 +09:00
Yuichi Nishiwaki
49072bf5e4
[bugfix] fix closure issue
2013-10-29 10:16:56 +09:00
Yuichi Nishiwaki
15fdbc9c7d
add some symbol primitive functions
2013-10-29 02:49:38 +09:00
Yuichi Nishiwaki
4402497a46
fix a bug related to immediate symbol value
2013-10-29 02:33:49 +09:00
Yuichi Nishiwaki
9424f0b9c0
show codegen error message when compilation failure
2013-10-29 02:33:22 +09:00
Yuichi Nishiwaki
1d9410638d
remove unused auxuality data field proc->aux
2013-10-29 02:23:14 +09:00
Yuichi Nishiwaki
db38cdc7e0
check sym_pool size when interning symbol
2013-10-29 02:16:26 +09:00
Yuichi Nishiwaki
63b52991da
introduce immediate symbol value
2013-10-29 02:11:31 +09:00
Yuichi Nishiwaki
a19c59ba87
remove stuff rerated to parser_control from scan.l
2013-10-28 22:55:15 +09:00
Yuichi Nishiwaki
94e1e245ea
create picrin objects in parser stage, not in scan stage
2013-10-28 22:49:15 +09:00
Yuichi Nishiwaki
9a20b50fc5
[vm] take care of int overflow
2013-10-28 21:26:39 +09:00
Yuichi Nishiwaki
4fa2bad5fa
add pic_apply function (and remove pic_run)
2013-10-28 17:45:13 +09:00
Yuichi Nishiwaki
67c13b841c
read line comments
2013-10-28 13:04:24 +09:00
Yuichi Nishiwaki
c77b8be011
insert type checks in pic_get_args
2013-10-28 00:40:10 +09:00
Yuichi Nishiwaki
5133e04c39
bugfix in pic_get_args
2013-10-28 00:33:24 +09:00
Yuichi Nishiwaki
90b691be67
add exact/inexact function
2013-10-28 00:33:10 +09:00
Yuichi Nishiwaki
350f4d1abd
[bugfix] support 'I' format in pic_get_args
2013-10-28 00:24:51 +09:00
Yuichi Nishiwaki
d3df6dcbf2
support exact integer
2013-10-28 00:21:24 +09:00
Yuichi Nishiwaki
63c05209f8
add built-in library
2013-10-27 18:38:55 +09:00
Yuichi Nishiwaki
f192c96650
parse-from-file facility
2013-10-27 18:38:41 +09:00
Yuichi Nishiwaki
c93cef8c8c
do not wrap with a begin read expressions if it is single
2013-10-27 18:14:15 +09:00
Yuichi Nishiwaki
f3041b7ebc
support rest arguments
2013-10-27 18:13:36 +09:00
Yuichi Nishiwaki
40a2568142
read multiple expressions; read exprs are wrapped in a begin
2013-10-27 17:24:44 +09:00
Yuichi Nishiwaki
14dcb63c33
support `(define (foo . args) . body)` style definition
2013-10-27 02:51:06 +09:00
Yuichi Nishiwaki
870320f3a1
refactor incomplete data parsing
2013-10-27 02:06:59 +09:00
Yuichi Nishiwaki
51253c00b9
add procedure?
2013-10-25 00:37:20 +09:00
Yuichi Nishiwaki
c782912212
add pair?
2013-10-25 00:37:08 +09:00
Yuichi Nishiwaki
c88f0926a4
fix a bug in valid_formal
2013-10-25 00:35:37 +09:00
Yuichi Nishiwaki
83de938342
add some port predicates
2013-10-24 22:56:04 +09:00
Yuichi Nishiwaki
7bb27295c0
warn global redefinition
2013-10-24 22:29:40 +09:00
Yuichi Nishiwaki
331fdaba4c
warn various kinds of syntax errors during codegen
2013-10-24 21:55:07 +09:00
Yuichi Nishiwaki
9cb28f3156
add OP_EQ/OP_LT/OP_LE
2013-10-24 21:10:13 +09:00
Yuichi Nishiwaki
2732a5a4ec
inti env->value with undef objects
2013-10-24 20:53:27 +09:00
Yuichi Nishiwaki
411395995c
s/env.numcv/env.num_val/g
2013-10-24 03:41:48 +09:00
Yuichi Nishiwaki
a926c54be3
warn invalid application
2013-10-24 03:38:29 +09:00
Yuichi Nishiwaki
d75b624b4a
add OP_LSET and OP_CSET
2013-10-24 03:14:32 +09:00
Yuichi Nishiwaki
337b54dc40
initial closure support
2013-10-24 02:51:02 +09:00
Yuichi Nishiwaki
4b31901bce
add OP_CREF
2013-10-24 02:04:49 +09:00
Yuichi Nishiwaki
bd851318d1
add pic_env struct
2013-10-24 02:02:07 +09:00
Yuichi Nishiwaki
f854e225c8
test implementation for closed variable reference
2013-10-24 00:33:37 +09:00
Yuichi Nishiwaki
ec0f0d3572
add pic_calloc
2013-10-24 00:32:03 +09:00
Yuichi Nishiwaki
0fd1bbeae9
throw wrong number of arguments error for user defined lambda call
2013-10-24 00:09:40 +09:00
Yuichi Nishiwaki
2ec7f381d0
cleanup codegen.c
2013-10-23 17:26:02 +09:00
Yuichi Nishiwaki
79ee6f6ae4
introduce codegen_state structure
2013-10-23 17:25:39 +09:00
Yuichi Nishiwaki
035de0016b
evaluate arguments in normal (lexical) order
2013-10-23 15:55:42 +09:00
Yuichi Nishiwaki
d12ed0a139
rename pic_scope -> codegen_scope
2013-10-23 15:52:14 +09:00
Yuichi Nishiwaki
947ddc45c8
bugfix: lambda must use new_scope to gen body code
2013-10-23 15:46:18 +09:00
Yuichi Nishiwaki
cc025626d5
use start state to parse strings
2013-10-23 13:44:45 +09:00
Yuichi Nishiwaki
dd7958c3d6
reader supports quasiquote abbrev
2013-10-23 12:39:48 +09:00
Yuichi Nishiwaki
f01ac50dd2
add set-car!/set-cdr!
2013-10-23 12:01:06 +09:00
Yuichi Nishiwaki
5f05fed38f
add missing extended identifier characters
2013-10-23 12:00:53 +09:00
Yuichi Nishiwaki
f31ddb36a2
reentrant scanner
2013-10-23 03:45:57 +09:00
Yuichi Nishiwaki
bb0bb0e186
reentrant parser (but not for scanner)
2013-10-23 03:13:10 +09:00
Yuichi Nishiwaki
dd3adf30e6
use xhash to manage scopes during codegin
2013-10-22 22:22:35 +09:00
Yuichi Nishiwaki
76cba3fad2
add some number-theoretic division functions
2013-10-22 18:29:55 +09:00
Yuichi Nishiwaki
828606aed5
throw an error when finding invalid argument specifier
2013-10-22 17:44:47 +09:00
Yuichi Nishiwaki
779199d571
add many many number primitive functions
2013-10-22 17:24:07 +09:00
Yuichi Nishiwaki
d696339577
[bugfix] pic_get_args should ignore optional args when i > argc
2013-10-22 17:23:21 +09:00
Yuichi Nishiwaki
b45d7d9592
add eof-object type
2013-10-22 16:02:20 +09:00
Yuichi Nishiwaki
176d167de8
add some file open functions
2013-10-22 15:44:03 +09:00
Yuichi Nishiwaki
6245ec7e05
finalize port objects when collected
2013-10-22 15:40:36 +09:00
Yuichi Nishiwaki
d2e09fa2c7
add file related functions
2013-10-22 15:16:35 +09:00
Yuichi Nishiwaki
0c1babb6c5
add pic_reverse
2013-10-22 00:19:43 +09:00
Yuichi Nishiwaki
114d6b708b
since pic_string is a first-class value, move it to value.h
2013-10-21 17:38:05 +09:00
Yuichi Nishiwaki
f5154625ba
add aux object field to proc object
2013-10-21 17:35:14 +09:00
Yuichi Nishiwaki
72a6e90d83
exit functions take an optional argument
2013-10-21 14:13:08 +09:00
Yuichi Nishiwaki
86177b7c4e
pic_get_args supports optional argument
2013-10-21 13:57:02 +09:00
Yuichi Nishiwaki
6c8dd50ab8
add exit and emergency-exit
2013-10-21 12:08:46 +09:00
Yuichi Nishiwaki
db1f977600
add pic_list_p
2013-10-21 12:03:35 +09:00
Yuichi Nishiwaki
15c4361381
return #f if get-environment-variable refers undefined env-var
2013-10-21 12:03:25 +09:00
Yuichi Nishiwaki
adab797391
add system.c
2013-10-21 11:51:02 +09:00
Yuichi Nishiwaki
7dbb2c6de4
cleanup
2013-10-21 11:44:23 +09:00
Yuichi Nishiwaki
b02f81760c
pic_get_args supports strings
2013-10-21 11:42:21 +09:00
Yuichi Nishiwaki
ba78a00d5c
take care of escaped characters in string
2013-10-21 11:12:34 +09:00
Yuichi Nishiwaki
8f4788ca27
read strings
2013-10-21 10:48:03 +09:00
Yuichi Nishiwaki
a49675c322
add OP_PUSHCONST
2013-10-21 09:29:56 +09:00
Yuichi Nishiwaki
5e43fe58fe
add string type
2013-10-21 08:48:55 +09:00
Yuichi Nishiwaki
cefa9a9885
handle runtime error
2013-10-20 23:30:01 +09:00
Yuichi Nishiwaki
d57d8ff3c0
place main.c under etc/
2013-10-20 18:44:26 +09:00
Yuichi Nishiwaki
05eb62cc4d
do not abort when meet a compilation error
2013-10-20 18:17:12 +09:00
Yuichi Nishiwaki
4f8aa03b24
clarify the meanings of error functions
2013-10-20 17:41:48 +09:00
Yuichi Nishiwaki
12e2f10869
add error.c file
2013-10-20 17:26:18 +09:00
Yuichi Nishiwaki
444fc7c750
split codegen and vm
2013-10-20 17:06:47 +09:00
Yuichi Nishiwaki
510b84702e
eq? compares symbol's ptr
2013-10-20 14:07:27 +09:00
Yuichi Nishiwaki
7322271d65
intern symbols using hash table
2013-10-20 14:05:48 +09:00
Yuichi Nishiwaki
bde09e063a
add pic_acons function
2013-10-20 14:04:39 +09:00
Yuichi Nishiwaki
40c996bd03
fix confusion of GC_DEBUG and VM_DEBUG
2013-10-20 13:07:14 +09:00
Yuichi Nishiwaki
6d8d7bb8bd
exit repl with ^D
2013-10-20 12:57:15 +09:00
Yuichi Nishiwaki
50b9c2bd97
add pair.h
2013-10-20 12:34:57 +09:00
Yuichi Nishiwaki
6faaa5261c
add time functions
2013-10-20 12:04:15 +09:00
Yuichi Nishiwaki
cfae6f3c59
add OP_NILP
2013-10-20 03:53:02 +09:00
Yuichi Nishiwaki
78f301794a
add OP_CAR/OP_CDR
2013-10-20 03:48:06 +09:00
Yuichi Nishiwaki
9bb3c4f4db
suppress warnings around parser/scanner
2013-10-20 03:11:08 +09:00
Yuichi Nishiwaki
daac4dd7f3
suppress compiler warnings
2013-10-20 03:05:42 +09:00
Yuichi Nishiwaki
5e96d05fd1
insert OP_POP into sequential operation
2013-10-18 02:29:11 +09:00
Yuichi Nishiwaki
3d523a8081
the first callinfo's argc is 1
2013-10-18 01:30:35 +09:00
Yuichi Nishiwaki
a0e2089e56
mark global variables
2013-10-18 00:17:55 +09:00
Yuichi Nishiwaki
e7a5784fd7
allocate global variable entry area by malloc and save it into pic_state
2013-10-18 00:15:15 +09:00
Yuichi Nishiwaki
c92a672e01
change the stack layout: to hold proc object on the stack when procedure
...
call is invoked
2013-10-17 23:29:18 +09:00
Yuichi Nishiwaki
1646de5e8d
initial port commit
2013-10-17 22:42:47 +09:00
Yuichi Nishiwaki
e87f632327
writer writes lists in short form
2013-10-17 22:42:20 +09:00
Yuichi Nishiwaki
b58c6d1e8b
remove test_object_creation from main.c
2013-10-17 21:00:54 +09:00
Yuichi Nishiwaki
986afa2fc9
add missing preprocessor if statement
2013-10-17 20:55:33 +09:00
Yuichi Nishiwaki
1a6c8a3cca
support multi-line input in REPL
2013-10-17 20:48:50 +09:00
Yuichi Nishiwaki
458ac6b9ab
support dotted list
2013-10-17 18:14:18 +09:00
Yuichi Nishiwaki
87aae8dd8f
refactor port.c
2013-10-17 17:57:27 +09:00
Yuichi Nishiwaki
5671c43a77
do not abort when finding syntax error
2013-10-17 17:57:12 +09:00
Yuichi Nishiwaki
d9e47bdd05
add begin syntax
2013-10-17 17:54:28 +09:00
Yuichi Nishiwaki
17f0c928da
add readline support
2013-10-17 17:08:33 +09:00
Yuichi Nishiwaki
0ccff2f626
free nested environment in codegen
2013-10-17 14:29:37 +09:00
Yuichi Nishiwaki
7925f2b502
implement direct threading VM
2013-10-17 13:54:48 +09:00
Yuichi Nishiwaki
3ecfe821e2
emit error message when compiling a reference to a closed variable
2013-10-17 13:38:09 +09:00
Yuichi Nishiwaki
840593f5f3
remove noisy debug print
2013-10-16 17:49:16 +09:00
Yuichi Nishiwaki
fc152f034a
debug printer supports OP_LREF
2013-10-16 17:49:07 +09:00
Yuichi Nishiwaki
6bd4747673
debug printer supports OP_JMP/OP_JMPIF
2013-10-16 17:46:33 +09:00
Yuichi Nishiwaki
27da3d030b
add less than(<) operator
2013-10-16 17:43:38 +09:00
Yuichi Nishiwaki
4d4fbeb9aa
allow recursive function definition
2013-10-16 17:43:23 +09:00
Yuichi Nishiwaki
6c903db758
if syntax
2013-10-16 17:42:47 +09:00
Yuichi Nishiwaki
87dce75c78
add local variables
2013-10-16 17:20:53 +09:00
Yuichi Nishiwaki
5c8d81e8b5
support closure call
2013-10-16 15:30:52 +09:00
Yuichi Nishiwaki
49e1f54195
fix stack operation bug
2013-10-16 13:24:19 +09:00
Yuichi Nishiwaki
9b7fdb0725
undef object must not appear in the user land
2013-10-16 13:24:08 +09:00
Yuichi Nishiwaki
ff646e05dd
support boolean values
2013-10-16 13:17:01 +09:00
Yuichi Nishiwaki
a6920c192f
add compiler option -Wall
2013-10-16 13:15:43 +09:00
Yuichi Nishiwaki
f6eddbc6d3
save all ireps into pic_state
...
in order to decrease the stress GC will get, restore irep structures
under pic_state instead of under each procs and making it collectable object
2013-10-16 11:53:25 +09:00
Yuichi Nishiwaki
c593a46a62
add OP_LAMBDA (lambda object creation)
2013-10-16 11:32:30 +09:00
Yuichi Nishiwaki
19abedf746
warn when a closure is applied
2013-10-16 11:28:57 +09:00
Yuichi Nishiwaki
b60e4df3d9
add pic_realloc
2013-10-16 11:21:41 +09:00
Yuichi Nishiwaki
40a971230d
read signed real numbers
2013-10-16 10:19:16 +09:00
Yuichi Nishiwaki
4340c23f20
cleanup
2013-10-16 09:30:35 +09:00
Yuichi Nishiwaki
728a4cb9d5
[gc] mark ci
2013-10-16 09:29:47 +09:00
Yuichi Nishiwaki
62303ed91e
[gc] mark predefined symbols
2013-10-16 09:29:39 +09:00
Yuichi Nishiwaki
a90e124697
change ways of taking care of CI
2013-10-16 09:28:58 +09:00
Yuichi Nishiwaki
04896bcd93
[gc] bugfix: do not mark a value out of the stack range
2013-10-16 09:28:13 +09:00
Yuichi Nishiwaki
136977f357
[gc] show freed object counts
2013-10-16 09:22:15 +09:00
Yuichi Nishiwaki
c41c5533fe
[gc] more debug prints
2013-10-16 09:21:57 +09:00
Yuichi Nishiwaki
1fc4ef18d1
fix gc bug
2013-10-16 09:21:13 +09:00
Yuichi Nishiwaki
36b455d9c2
do not pop sp in pic_get_args; OP_CALL takes care of stack unwinding
2013-10-16 09:19:43 +09:00
Yuichi Nishiwaki
910f370482
[gc] base header size is 1, not 0
2013-10-16 09:17:44 +09:00
Yuichi Nishiwaki
22abdae12a
add callinfo
2013-10-15 23:29:34 +09:00
Yuichi Nishiwaki
ea6230e90c
configurable stack size
2013-10-15 23:28:23 +09:00
Yuichi Nishiwaki
f280b0a5ce
add some mathematic functions
2013-10-15 23:26:18 +09:00
Yuichi Nishiwaki
7f04cad34d
scan real numbers
2013-10-15 23:25:31 +09:00
Yuichi Nishiwaki
0515b8ba2a
pic_get_args supports double type (f)
2013-10-15 23:25:07 +09:00
Yuichi Nishiwaki
e42eb5acd5
change ways of stack operation (no longer push dummy object at first)
2013-10-15 22:34:20 +09:00
Yuichi Nishiwaki
a93c3caabf
move pic_env to proc.h
2013-10-15 21:53:45 +09:00
Yuichi Nishiwaki
b998c903a3
remove eval.c
2013-10-15 21:52:44 +09:00
Yuichi Nishiwaki
d40c8b5921
add cfunc_p flag to pic_proc
2013-10-15 21:52:14 +09:00
Yuichi Nishiwaki
a5dcaba970
add support for arithmetic operations
2013-10-15 21:29:07 +09:00
Yuichi Nishiwaki
2d4a5ed1ea
add standard functions: write/newline
2013-10-15 21:14:33 +09:00
Yuichi Nishiwaki
af9dd45e65
change the type of immediate number value from int to double
2013-10-15 20:05:12 +09:00
Yuichi Nishiwaki
02d52723ac
add some FFI functions such as pic_defun and pic_get_args
2013-10-15 19:19:34 +09:00
Yuichi Nishiwaki
8a5ea7d7dc
implement OP_CALL
2013-10-15 19:18:33 +09:00
Yuichi Nishiwaki
e5ada35d9d
directly change pic->sp via PUSH/POP macros
2013-10-15 19:15:51 +09:00
Yuichi Nishiwaki
266e6c6400
change repl prompt
2013-10-15 19:12:33 +09:00
Yuichi Nishiwaki
6a10162c2c
add picrin/proc.h
2013-10-15 13:21:40 +09:00
Yuichi Nishiwaki
daece7ae67
add object creation debug flag to picconf
2013-10-15 09:14:34 +09:00
Yuichi Nishiwaki
099d40cfb8
print raw read expression in repl
2013-10-15 09:08:10 +09:00
Yuichi Nishiwaki
78303a72e5
include necessary headers when GC_DEBUG
2013-10-15 09:07:55 +09:00
Yuichi Nishiwaki
2afdb54c16
print generated irep
2013-10-15 09:07:19 +09:00
Yuichi Nishiwaki
fea6b7f633
push undef to the stack as a first dummy object
2013-10-15 09:02:49 +09:00
Yuichi Nishiwaki
528c2e2c15
bugfix around GC
2013-10-15 08:58:23 +09:00
Yuichi Nishiwaki
6bd38273d2
free arena objects created in main function
2013-10-14 18:29:30 +09:00
Yuichi Nishiwaki
42dbd5fe98
save some special symbols in pic_state structure
2013-10-14 18:28:52 +09:00
Yuichi Nishiwaki
8c73ded2c4
add debug prints at GC
2013-10-14 18:22:14 +09:00
Yuichi Nishiwaki
276e139ec6
fix bugs around GC
2013-10-14 18:21:56 +09:00
Yuichi Nishiwaki
ed7a9d5758
fix commit bug introduced in HEAD^^
2013-10-14 17:36:07 +09:00
Yuichi Nishiwaki
22414b61e8
let the printer output proc objects and unknown values
2013-10-14 17:35:01 +09:00
Yuichi Nishiwaki
c706d4f326
sweep objects from base pointer (not from freep)
2013-10-14 17:34:04 +09:00
Yuichi Nishiwaki
a7cc9bd69d
add missing braek statement
2013-10-14 17:32:24 +09:00
Yuichi Nishiwaki
c53bf58e7e
move debug prints
2013-10-14 17:07:09 +09:00
Yuichi Nishiwaki
daa65bdecf
pop value from the stack at the end of VM execution
2013-10-14 17:05:49 +09:00
Yuichi Nishiwaki
298a8e685f
replace use of malloc/free with pic_alloc/pic_free
2013-10-14 17:04:59 +09:00
Yuichi Nishiwaki
a5db43ba91
add object finalizer
2013-10-13 19:00:39 +09:00
Yuichi Nishiwaki
dc2f25ef2a
initial GC commit
2013-10-13 19:00:12 +09:00
Yuichi Nishiwaki
2ef277d5bd
add arena protection to the VM
2013-10-13 17:29:21 +09:00
Yuichi Nishiwaki
8b859d4dbc
define stack operation macros POP and PUSH
2013-10-13 17:27:44 +09:00
Yuichi Nishiwaki
f0541e0f6b
arena doesn't have to be explicitly initialized
2013-10-13 17:26:17 +09:00
Yuichi Nishiwaki
a6f561d66e
change the type of argument pic_gc_protect accepts
2013-10-13 17:25:36 +09:00
Yuichi Nishiwaki
ee985a31cd
add GC arena
2013-10-13 17:02:29 +09:00
Yuichi Nishiwaki
012b387c89
change the semantics of pic_alloc/pic_free
2013-10-13 16:56:30 +09:00
Yuichi Nishiwaki
a0556087f9
rename pic_gc_alloc to pic_obj_alloc
2013-10-13 16:55:07 +09:00
Yuichi Nishiwaki
1fb9ac5d03
let pic_proc be a first class object
2013-10-13 16:16:13 +09:00
Yuichi Nishiwaki
d92bd71293
force alignment of headers
2013-10-13 16:02:08 +09:00
Yuichi Nishiwaki
c250d3b07f
use C malloc instead of pic_alloc
2013-10-13 16:01:40 +09:00
Yuichi Nishiwaki
e3600a65c9
replace mock allocator with simple k&r malloc
2013-10-13 15:14:15 +09:00
Yuichi Nishiwaki
38858e7a11
replace big VM loop stuff with macros
2013-10-12 18:48:35 +09:00
Yuichi Nishiwaki
3eefa2669f
depress compiler warnings
2013-10-12 18:46:41 +09:00
Yuichi Nishiwaki
e4be084b0e
skip whitespaces in lex
2013-10-12 18:46:11 +09:00
Yuichi Nishiwaki
4cceb73db6
support global variable
2013-10-12 14:40:55 +09:00
Yuichi Nishiwaki
69e927d7bc
add pic_raise
2013-10-12 14:40:27 +09:00
Yuichi Nishiwaki
b284973035
add #<undef>
2013-10-12 14:40:01 +09:00
Yuichi Nishiwaki
8d23ef666f
cleanup
2013-10-12 13:06:02 +09:00
Yuichi Nishiwaki
5f90f49604
remove old VM test code
2013-10-12 13:01:48 +09:00
Yuichi Nishiwaki
ee3442210c
replace evaluator in repl to the VM
2013-10-12 12:55:05 +09:00
Yuichi Nishiwaki
65c9843d83
add VM codegen
2013-10-12 12:53:54 +09:00
Yuichi Nishiwaki
b2fa560bc7
eval accepts int values
2013-10-12 12:48:30 +09:00
Yuichi Nishiwaki
2ee11a367f
parse int values
2013-10-12 12:07:28 +09:00
Yuichi Nishiwaki
1a45eab148
store stack base and end
2013-10-12 00:20:53 +09:00
Yuichi Nishiwaki
643d8be66d
first VM impl
2013-10-12 00:16:19 +09:00
Yuichi Nishiwaki
03fbd0bdb6
add fixnum
2013-10-12 00:15:46 +09:00
Yuichi Nishiwaki
6b0c1aa668
first eval commit
2013-10-11 17:36:51 +09:00
Yuichi Nishiwaki
25d84c1e8a
parser echoing test in main repl
2013-10-11 15:20:53 +09:00
Yuichi Nishiwaki
8533d7b87f
initial parser commit
2013-10-11 15:18:37 +09:00
Yuichi Nishiwaki
2a6978a3b9
fix bugs around compilation
2013-10-10 17:54:35 +09:00
Yuichi Nishiwaki
bd4f3680ea
do object create test before entering main
2013-10-10 17:48:37 +09:00
Yuichi Nishiwaki
b640dc08e8
add pic_debug function
2013-10-10 17:48:01 +09:00
Yuichi Nishiwaki
0c382c2bdb
add pic_intern_cstr
2013-10-10 17:22:25 +09:00
Yuichi Nishiwaki
0fad63f22a
add nil stuff
2013-10-10 17:08:54 +09:00
Yuichi Nishiwaki
9038939bd1
add some pair functions
2013-10-10 17:06:26 +09:00
Yuichi Nishiwaki
177d2c7098
add pic_obj_value function
2013-10-10 17:05:58 +09:00
Yuichi Nishiwaki
97ba95e12f
add our own malloc implementation (just a mock for now)
2013-10-10 16:44:51 +09:00
Yuichi Nishiwaki
bb4131799d
add missing argument for calloc
2013-10-10 16:18:03 +09:00
Yuichi Nishiwaki
25c9fef1d0
add pic_state structure
2013-10-10 16:15:41 +09:00
Yuichi Nishiwaki
9d33e0e079
warn line input overflow
2013-10-09 17:14:48 +09:00
Yuichi Nishiwaki
4cdd8e8b01
add simple repl (just echoing the input)
2013-10-09 17:10:32 +09:00
Yuichi Nishiwaki
e1d1a11f00
initial commit
2013-10-09 16:58:35 +09:00