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
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
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
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
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
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
Jan Nieuwenhuizen
781957cbe9
Implement apply with multiple arguments.
...
* module/mes/base-0.mes (apply): Handle multiple arguments.
* tests/base.test: (apply, apply 1, apply 2): New test.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
1f511481a3
Fix values.
...
* mes.c (call): Respect any other non-value arguments.
* tests/scm.test (values, values 2, values 3, call-with-values): New test.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
d209a18121
Introduce reference type, use vectors of SCM.
...
* mes.c (type): Add REF.
(scm_t): Add ref, change vector to *scm_t. Update users.
(alloc): New function.
(cons, make_char, make_macro, make_number, make_string,
internal_make_symbol, make_vector): Use it.
(make_ref): New function.
(vector_entry): New function.
(make_vector, list_to_vector, vector_set_x): Use it.
(vector_ref): Dereference REF entry.
(display_helper): Handle REF.
* lib.c (vector_to_list): Handle REF.
* type.c (ref_p): New function.
* tests/vector.test (vector list): New test.
Bugfix vector-ref.
* mes.c (vector-ref): Make copies of simple values. Fixes lalr.
* tests/vector.test (vector-set! 3): New test.
2016-12-12 20:33:48 +01:00
Jan Nieuwenhuizen
497bbdc76f
boot: fix builtin? tests.
...
* tests/scm.test: Test primitives, not eval.
2016-10-21 11:14:33 +02:00
Jan Nieuwenhuizen
46eca44fb4
boot: vector support.
...
* mes.c (make_vector): Change to scm interface.
(temp_number): New global.
(list_to_vector): Use it.
* module/mes/scm.mes (c:make-vector): New function.
* tests/scm.test: Remove vector tests.
* tests/vector.test: New file.
* GNUmakefile (TESTS): Add it.
2016-10-21 10:51:09 +02:00
Jan Nieuwenhuizen
a4c3acc7ba
Add report to closure test.
...
* tests/closure.test: Add report.
2016-10-18 19:10:16 +02:00
Jan Nieuwenhuizen
d18e50a569
make tests standalone executable.
...
* tests/closure.test: Add shebang and boot-0 include.
* tests/let-syntax.test: Likewise.
* tests/let.test: Likewise.
* tests/match.test: Likewise.
* tests/quasiquote.test: Likewise.
* tests/record.test: Likewise.
* tests/scm.test: Likewise.
* GNUmakefile (mes-check): Run tests by exec'ing.
2016-10-19 00:36:12 +02:00
Jan Nieuwenhuizen
d114634203
Prepare for 0.1 release: new directory structure.
...
* scripts/elf.mes: New file.
* scripts/include.mes: New file.
* scripts/mescc.mes: New file.
* scripts/paren.mes: New file.
* scripts/repl.mes: New file.
* doc/examples/main.c: Move from ./main.c.
* module/mes/base-0.mes: Move from ./base0.mes.
* module/mes/base.mes: Move from top.
* module/mes/elf.mes: Likewise.
* module/mes/let-syntax.mes: Likewise.
* module/mes/let.mes: Likewise.
* module/mes/mes.mes: Likewise.
* module/mes/quasiquote.mes: Likewise.
* module/mes/repl.mes: Likewise.
* module/mes/scm.mes: Likewise.
* module/mes/syntax.mes: Likewise.
* module/mes/lalr-0.mes: Move from lib/lalr.mes.
* module/mes/lalr.mes: Move from lib/lalr.scm.
* module/mes/match.mes: Move from lib/match.scm.
* module/mes/record-0.mes: Move from lib/record.mes.
* module/mes/record.mes: Move from lib/record.scm.
* module/mes/test.mes: Move flom lib/.
* module/rnrs/bytevectors.mes: Move from lib/rnrs.
* module/srfi/srfi-0.mes: Move from lib/srfi.
* module/srfi/srfi-1.mes: Likewise.
* module/srfi/srfi-9.mes: Likewise.
* module/language/c/lexer.mes: Move from ./c-lexer.scm.
* module/language/c/parser.mes: Move from ./mescc.scm.
* module/language/c/compiler.mes: New file, split from parser.mes.
* module/language/paren.mes: Move from ./paren.scm.
* module/mes/libc-i386.mes: New file, split from elf.mes.
* tests/base.test: Move from test/.
* tests/closure.test: Likewise.
* tests/let-syntax.test: Likewise.
* tests/let.test: Likewise.
* tests/match.test: Likewise.
* tests/quasiquote.test: Likewise.
* tests/record.test: Likewise.
* tests/scm.test: Likewise.
* hello.S: Remove.
* hello.c: Remove.
* loop2.mes: Remove.
* test/foo.test: Remove.
2016-10-12 23:40:11 +02:00