Jan Nieuwenhuizen
ddca30271e
Resurrect Mes in Guile.
...
* guile/mes.mes: New file, from the archives.
* guile/mes.scm: Updates.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
0da6a4a248
Avoid garbage returns.
...
* posix.c (set-current-input-port): Return current-input-port.
(force_output): Return scm_unspecified.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
696ff8bc77
Update documentation.
...
* README: Add make targets.
* INSTALL: Add guix.
* HACKING: Add info on sc.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
3a72f1f186
core: Resurrect QUASIQUOTE=0.
...
* mes.c (mes_builtins) [!QUASIQUOTE]: Do not add unquoters.
* module/mes/base-0.mes (push!, pop!, load, mes-use-module): Rewrite
without quasiquote.
* module/mes/quasiquote.mes (quasiquote): Rewrite using if, and.
* module/srfi/srfi-0 (cond-expand): Rewrite without quasiquote.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
2b577eaee0
Add loadable modules.
...
* module/mes/base-0.mes (mes-use-module): Implement.
* module/mes: Update users.
* HACKING: Update.
* NEWS: Update.
* configure (main): Use shell expansion for prefix.
* make/install.make (install): Substitute prefix.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
b74d048b95
Use syntax rather than psyntax.
...
* module/language/c/parser.mes: Switch to syntax.
* module/language/paren.mes: Likewise
* scripts/mescc.mes: Likewise
* scripts/paren.mes: Likewise
* scripts/repl.mes: Likewise
* tests/let-syntax.test: Likewise
* tests/match.test: Likewise
* tests/record.test: Likewise
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
fa9952fa91
Resurrect syntax.mes.
...
* module/mes/syntax.mes: New file.
* AUTHORS: List it.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
b92a8f17f8
core: use FIXED_PRIMITIVES rather than environment cache.
...
* cache.c: Remove.
* define.c: Remove callers.
* mes.c: Likewise.
(vm_eval_env) [FIXED_PRIMITIVES]: Hardcode car, cdr, cons, null_p.
* GNUmakefile: Update.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
0a614e6543
core: Set max arena size.
...
* mes.c (MAX_ARENA_SIZE): New global.
(gc): Use it.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
753b63818c
core: Make arena size configurable.
...
* mes.c (main): Read MES_ARENA.
* scripts/repl.mes: Set MES_ARENA to 5000000 if not already set.
Fixes repl startup.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
0bdad95f61
core: Grow gc arena gradually.
...
* mes.c: (gc_up_arena): New function.
(gc): Use it when possible.
(gc_init_cells, gc_init_news): New function.
(mes_symbols): Use them.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
e4e29f00b0
core: gc bugfixes.
...
* mes.c (make_tmps): New function.
(make_symbols, gc): Use it.
(vm_call_with_values_env): New vm function.
(call-with-values): Call it.
(eval_env): Do not call eval_env inline.
* define.c (vm_define_env): Use r2 rather than local name.
(g_symbols): Rename from symbols.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
f26c7222b2
core: Split-off cache, display, reader.
...
* mes.c: Remove cache, display, reader functions.
* cache.c: New file.
* display.c: New file.
* reader.c: New file.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
1614d13439
Add reader in Scheme.
...
* module/mes/read-0.mes: New file.
* mes.c (char_to_integer, integer_to_char, null_p): Move to core.
(peek_byte, read_byte, unread_byte): New function.
(main): --dump, --load: New option.
* lib.c (char_to_integer, integer_to_char): Remove.
* NEWS: Update.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
e6a0257a79
core: Cleanup cells.
...
* mes.c: Use accessors rather than g_cell[] access throughout.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
d50b0fe24a
core: Add function indirection.
...
* mes.c (functions): New array.
(scm_t): Change function pointer to index.
(make_cell): Handle function.
(call): Update for function change.
(display_): Likewise.
(make_function): New function.
* build-aux/mes-snarf.scm (function->source): Update declarations.
(function->environment): New function.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen
61e42e8527
core: Number based cells.
...
* mes.c (scm_t): Change car, string, ref, cdr, macro, vector into g_cell index
[WAS]: scm_t pointer.
* define.c: Update.
* lib.c: Update.
* math.c: Update.
* posix.c: Update.
* quasiquote.c: Update.
* string.c: Update.
* type.c: Update.
* build-aux/mes-snarf.mes Update.
* tests/gc-4.test: New test.
* tests/gc-5.test: New test.
* tests/gc-6.test: New test.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen
25c29ecb6d
core: Integrate garbage collector/jam scraper.
...
* mes.c (r0, r1, r2, r3, stack): New globals.
(gc_loop): Handle MACRO and SCM.
(gc_copy): Handle FUNCTION, allow for pre-allocated SCM and SYMBOL.
(assq): Flag any BROKEN_HEARTs.
(vm_call): New function. Enables moving C stack to GC stack.
(evlis_env, apply_env, eval_env, expand_macro_env, begin_env,
if_env): Use vm_call-indirection.
(call_lambda): New function.
(vm_apply_env): Rename from apply_env. Remove parameters, instead
use r1, r2 and r0.
(vm_evlis_env, vm_eval_env, vm_expand_macro_env, vm_begin_env,
vm_if_env): Likewise.
(acons): New function.
(mes_environment) [!MES_FULL, MES_MINI]: Add cpp switches to create minimally
filled environment, for debugging.
(main): Print free value at exit.
* define.c (define_env): Use vm_call-indirection.
(vm_define_env): Rename from define_env.
* quasiquote.c (eval_quasiquote): Use vm_call-indirection.
(vm_eval_quasiquote): Rename from eval_quasiquote.
* tests/gc-2.test: New test.
tests/gc-2a.test: New test.
tests/gc-3.test: New test.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen
c035a59094
Add sicp garbage example: tests/gc-1.test.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen
f3225a77e2
core: Make using GC in switchable, set to off; on dumps core.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen
99cedbfbde
core: Add garbage collector/jam collector experiment.
...
* mes.c (gc, gc_loop, gc_copy, gc_move, gc_relocate_car,
gc_relocate_cdr, gc_flip): New function.
* tests/gc-0.test: New file.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen
2866c75907
Add mes gc test setup.
...
* tests/gc.test: New file.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen
84787f9f23
guix hash: 09axqivywpw0l9lm7pk1ncp6690vfv658z731z674ih73yqs5qma
2016-12-12 20:35:07 +01:00
Jan Nieuwenhuizen
376bb5d62b
Release 0.2.
...
* configure (VERSION): Bump to 0.2.
* mes.c (main): Likewise.
* module/mes/repl.mes: Likewise.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
577aef2f74
Update NEWS.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
db2eb86a40
test: Run psyntax before record.
...
* GNUmakefile (TESTS): Run psyntax before record.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
adbf1bb296
test: Add psyntax closure tests.
...
* tests/closure.test (closure 7, closure 8, closure 9): New test.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
07778d3b70
core: Show more info on apply error.
...
* mes.c (apply_env): Be more specific about what cannot be applied.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
c121fe3d72
test: Add toplevel begin define test.
...
* tests/base.test (top begin define): New test.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
ffd2d3df4f
core: Bugfix: report name of undefined variable.
...
* mes.c (assert_defined): Add variable as parmeter, print it. Update
callers.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
6c70e92276
core: Use switch in display_helper.
...
*mes (display_helper): Use switch.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
a0709313ca
core: Refactor eval.
...
* mes.c (eval_env): Rename from builtin_eval, Update callers. Use switch.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
7e8341d76c
core: One SCM type for function.
...
* mes.c (function_t): New struct.
(type): One type for function.
(call): Refactor.
* build-aux/mes-snarf.mes: Use arity annotation. WAS: args. Update
annotations.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
0eda7383f2
core: Cleanup macro expansion.
...
* mes.c (builtin_eval): Call expand_macro_env after handling primitives.
(expand_macro_env): Include syntax-case expansion, remove skipping
of primitives.
(sc_expand_env): Remove.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
bcd6cd9dcc
core: Factor-out assert_defined.
...
* mes.c (assert_defined): New function.
(set_env_x): Use it.
(builtin_eval): Use it.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
97300ef6ae
Implement load.
...
* mes.c (symbol_primitive_load): New symbol.
(builtin_eval): Use it to implement primitive-load.
* module/mes/base-0.mes (push!, pop!): New macro.
(load): New macro.
* tests/data/load.scm: New file.
* tests/base.test (load): New test.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
70bdab7090
posix: Implement open-input-file.
...
* posix.c: New file.
* mes.c: Include posix.environment.h, posix.environment.i, posix.environment.c.
(read_input_file_env): Rename from read_file_env. Update
callers.
(load_env): Rename from load_file_env. Update callers.
* GNUmakefile (mes.o): Add posix.c, posix.environment.h,
posix.environment.i dependencies.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
1e2e2f2a4a
core: Support switching of input stream.
...
* mes.c (g_stdin): New global.
(getchar): New function, use g_stdin.
(ungetchar): Use g_stdin.
(main): Initialize g_stdin to stdin.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
0e13b7e8dd
Update documentation wrt syntax-case.
...
* HACKING: Update wrt syntax-case.
* NEWS: Likewise.
* README: Likewise.
* guix.scm: Likewise.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
14f417d780
Update AUTHORS.
...
* AUTHORS: Include information on lalr, match and psyntax.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
2b373ff40f
Finalize psyntax integration.
...
* mes.c (sc_expand_env): Exclude primitives, expand native macros.
(symbol_expand_macro): New symbol.
* module/mes/psyntax-0.mes (properties-alist): New function.
* module/mes/psyntax-1.mes: Set expand-macro.
(define-syntax, syntax-rules, let-syntax): Remove macro.
* module/language/c/parser.mes: Use psyntax modules, remove syntax module.
* module/language/paren.mes: Likewise.
* scripts/repl.mes: Likewise.
* tests/match.test: Likewise.
* tests/record.test: Likewise.
* tests/psyntax.test (define-syntax swap!): Add test.
* module/mes/let-syntax.mes: Remove.
* module/mes/syntax.mes: Remove.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
c851935d4d
core: Quoted internals are symbols.
...
* mes.c (begin_env): Rename from begin. Update callers.
(scm_begin, scm_if, scm_define, scm_set_x): Rename from symbol_*.
(symbol_begin, symbol_define, symbol_if, scm_lambda, scm_set_x): New symbols.
(mes_environment): Add them to environment, SYMBOL->SCM.
* define.c (define_env): Rename from define. Update callers.
* build-aux/mes-snarf.scm: Shadow internals (SCM) by their symbol.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
8a13b472e3
test: More values, call-with-values tests.
...
* tests/cwv.test: New file.
* GNUmakefile (TESTS): Add it.
* tests/scm.test: Remove value and call-with-values tests.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
019ca90109
psyntax: More tests.
...
* tests/psyntax.test: Add tests.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
f1ae9edd0d
core: Fix quasisyntax reading.
...
* mes.c (readword): Avoid unspecified behaviour in comma list.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
d2768796dc
test: Add new macros.
...
* module/mes/test.mes (pass-if-equal, expect-fail): New macros.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
0bf26fa7d2
repl: Add sc-expand meta command, include syntax-case.
...
* module/mes/repl.mes (,sc-expand): New meta command.
* scripts/repl.mes: Include psyntax-0, psyntax-1, psyntax. Not used as
basis for match yet.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
32214ff608
Add syntax-case based syntax-rules.
...
* module/mes/psyntax-1.mes (syntax-rules): New syntax transformer,
based on syntax-case.
(define-syntax-rule): New macro.
(let-syntax): New macro, for syntax-case.
* tests/let-syntax.test: Switch to syntax-case.
* tests/psyntax.test: Add syntax-rules and syntax-rule test.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
b8a7334941
Bugfix include.mes: skip commented modules.
...
* scripts/include.mes: Make regexp more strict.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
d18542e25f
Initial psyntax integration.
...
* mes.c (sc_expand_env): New function.
(builtin_eval): Use it.
* module/mes/psyntax-0.mes: New file.
* module/mes/psyntax-1.mes: New file.
* tests/psyntax.test: New file.
* GNUmakefile (TESTS): Add it.
2016-12-12 20:33:49 +01:00