Commit graph

657 commits

Author SHA1 Message Date
Jan Nieuwenhuizen 05cae56813 core: Remove append.
* lib.c (append): Remove.
* scaffold/mini-mes.c (append): Remove.
* module/mes/base-0.mes (append): New function.
* module/mes/read-0.mo: Regenerate.
* module/mes/read-0-32.mo: Regenerate.
2017-04-02 08:05:55 +02:00
Jan Nieuwenhuizen 117006cf7c test: Add test for append-map.
* tests/srfi-1.test ("append-map"): New test.
2017-04-02 08:04:25 +02:00
Jan Nieuwenhuizen dfabe9b215 core: Check gc free harder.
* gc.c (gc_check): New fuction.
* mes.c (eval_apply): Use it.
2017-04-01 23:00:50 +02:00
Jan Nieuwenhuizen e9ac52dfda mescc: Fix by value assignment from array-of struct entry.
* module/language/c99/compiler.mes (expr->accu): Fix by value
  assignment from array-of struct entry.
* scaffold/t.c (struct_test): Test it.
* vector.c (make_vector, list_to_vector, vector_to_list): Use it;
  remove workarounds.
* gc.c (gc_copy): Likewise.
2017-04-01 23:12:37 +02:00
Jan Nieuwenhuizen 2209b5728d core: Fix flush for _POSIX_SOURCE.
* posix.c (write_byte, force_output)[_POSIX_SOURCE]: Use FILE*
  functions.  Fixes repl.mes.
2017-04-01 20:25:03 +02:00
Jan Nieuwenhuizen 3f60c2ec95 core: Increase MAX_ARENA_SIZE and GC safety.
* mes.c (MAX_ARENA_SIZE): Double to 40000000.
 (GC_SAFETY): Set to 10000 cells (WAS: 1000).
* scaffold/mini-mes.c (MAX_ARENA_SIZE, GC_SAFETY): Likewise.
* gc.c (gc)[MES_DEBUG]: Also print safety area.
2017-04-01 19:10:28 +02:00
Jan Nieuwenhuizen 5cd5681a4d HACKING: scripts/mescc.mes scaffold/t.c runs. 2017-04-01 17:07:28 +02:00
Jan Nieuwenhuizen 28fd45b7b0 core: Increase GC safety.
* mes.c (GC_SAFETY): Set to 1000 cells (WAS: 100).
* scaffold/mini-mes.c (GC_SAFETY): Likewise.
2017-04-01 16:51:48 +02:00
Jan Nieuwenhuizen 28347aa3a3 HACKING: scripts/mescc.mes scaffold/tiny-mes.c runs. 2017-04-01 16:15:08 +02:00
Jan Nieuwenhuizen e87469c721 HACKING: scripts/mescc.mes scaffold/cons-mes.c runs. 2017-04-01 16:12:51 +02:00
Jan Nieuwenhuizen 542a8c2106 test: Add nyacc cpp match tests; two fail.
* tests/match.test ("match nyacc 0", "match nyacc 1"): New tests.
 ("match nyacc simple", "match nyacc tkl0"): New tests; FAIL with Mes.
 (report): Set failure expectation to 2 for Mes.
* HACKING: Add to bugs.
2017-04-01 15:06:07 +02:00
Jan Nieuwenhuizen 3b527affa3 scm: Support test failure expectation.
* module/mes/test.mes (result): Take second argument to mean expected
  failure count.
2017-04-01 15:01:59 +02:00
Jan Nieuwenhuizen 08c04ff845 scm: Evaluate arguments of OR only once.
* module/mes/base.mes (or): Evaluate arguments only once.
* module/mes/read-0.mes (or): Likewise.
* tests/base.test ("or only once"): Test it.
* module/mes/read-0-32.mo: Regenerate.
2017-04-02 16:47:22 +02:00
Jan Nieuwenhuizen 232e87bd9d scm: Have char-set-contains? strictly return boolean.
* module/srfi/srfi-14.mes (char-set-contains?): Return #t rather than
  memq result.
2017-04-01 09:36:34 +02:00
Jan Nieuwenhuizen a8587b6453 scm: Fix bug in assq-set!
* module/mes/scm.mes (assq-set!): Bugfix.
2017-04-01 07:23:10 +02:00
Jan Nieuwenhuizen 4d933001d5 scm: Add c????r.
* module/mes/base-0.mes (caar, cadr, cdar, cddr, map): Remove.  Update callers.
* module/mes/base.mes (): Remove.
* module/mes/base.mes (cadadr, cddadr, cdddar): New function.
2017-04-02 09:35:47 +02:00
Jan Nieuwenhuizen 2c25f45678 scm: Add access?
* module/mes/guile.mes (access?): New dummy function.  Fixes Nyacc's #include.
2017-03-31 21:41:32 +02:00
Jan Nieuwenhuizen 091c1ccd31 doc: Add Roamdmap.
* HACKING: Add roadmap.
2017-03-29 08:05:18 +02:00
Jan Nieuwenhuizen d938b38d5e scm: Add open-input-string, read-string.
* module/mes/guile.mes (open-input-string, read-string): New functions.
* tests/guile.test: New file.
* GNUmakefile (TESTS): Add it.
2017-04-01 12:51:35 +02:00
Jan Nieuwenhuizen fc263de433 build: Cleanup, use gcc-specific snarfing.
* .gitignore: Ignore *.o-32, mes-mini-mes.
* scripts/nyacc-calc.mes: Remove.
* scripts/nyacc.mes: Remove.
* scripts/paren.mes: Remove.
* make/install.make (install): Remove them.
p* module/mes/mes-0.mes: Remove.
* module/mes/loop-0.mes: Remove.
* build-aux/mes-snarf.scm (main): Add --mini option.
* GNUmakefile (mini-mes): Use it.
2017-04-02 17:01:22 +02:00
Jan Nieuwenhuizen b99f756367 core: Fix error message when macro is missing.
* mes.c (scm_vm_eval_check_func): New symbol.
  (eval_apply): In eval, evaluate car before evlis.  Fixes error
  message when macro match is missing in (match ... (car x)).
  (mes_symbols): Add cell_call_with_values, cell_current_module to environment.
* scaffold/mini-mes.c (eval_apply): Likewise.
2017-03-27 20:14:48 +02:00
Jan Nieuwenhuizen 124085e4dc test: Add pmatch tests.
* tests/pmatch.test: New file.
* GNUmakefile (TESTS): Add it.
2017-03-29 08:07:51 +02:00
Jan Nieuwenhuizen b45d7b599f nyacc: prefix globals. 2017-03-28 20:26:16 +02:00
Jan Nieuwenhuizen 1f1b850640 scm: Bugfix display of named characters: add port.
* module/mes/display.mes (display): Typo, add port.
2017-03-27 21:41:44 +02:00
Jan Nieuwenhuizen 4d4c793018 nyacc: Add missing (mes pmatch) include.
* module/nyacc/lang/c99/cpp.mes (mes): Include (mes pmatch).
2017-03-27 21:01:22 +02:00
Jan Nieuwenhuizen 2e007d3727 nyacc: Use pmatch rather than match for cpp.
* module/nyacc/lang/c99/cpp.scm (nyacc lang c99 cpp): Import (system
  base pmatch) rather than (ice-9 match).
  (rtokl->string): Rewrite using pmatch.
2017-04-01 12:16:09 +02:00
Jan Nieuwenhuizen 945fb39d18 scm: Bugfix drain-input.
* module/mes/guile.mes (drain-input): Bugfix: return string.
2017-03-27 21:00:49 +02:00
Jan Nieuwenhuizen a53e878435 scm: Add assoc-set!
* module/mes/scm.mes (assoc-set!): New function.
* tests/scm.test ("assoc-set!", "assoc-set! new"): New tests.
2017-03-27 07:01:15 +02:00
Jan Nieuwenhuizen 58dfe0b7bd scm: Add compose.
* module/mes/scm.mes (compose): New function.
* tests/scm.test ("compose"): New test.
2017-03-27 00:35:36 +02:00
Jan Nieuwenhuizen 22880ac831 scm: Support reading negative hex numbers.
* module/mes/read-0.mes (read-hex): Support negative hex numbers.
* tests/math.test ("#x-10"): New test.
* tests/read.test: Add test.
2017-03-27 00:11:05 +02:00
Jan Nieuwenhuizen 44755ceff2 scm: Support map4.
* module/mes/base-0.mes (map): Remove.  Update callers.
* module/mes/base.mes (map): Support map4.
2017-03-26 23:48:15 +02:00
Jan Nieuwenhuizen cf356a553c nyacc: Add simple split-cppdef for Mes.
* module/nyacc/lang/c99/body.scm: Add non-regexp split-cppdef for Mes.
2017-03-26 23:09:44 +02:00
Jan Nieuwenhuizen 6b3328c71c scm: Add with-throw-handler hack.
* module/mes/catch.mes (with-throw-handler): Add hack for Nyacc 0.75
2017-03-26 23:09:11 +02:00
Jan Nieuwenhuizen 3cbadcda86 scm: Add list->char-set.
* module/srfi/srfi-14.mes (list->char-set): New function.
* tests/srfi-14.test ("list->char-set!"): Test it.
2017-03-26 22:33:51 +02:00
Jan Nieuwenhuizen 408696f380 mini-mes: Debugging to stderr.
* scaffold/mini-mes.c (error, bload_env, main): Send debug info to
  stderr.

throw/catch dinges: URG
2017-03-26 22:12:24 +02:00
Jan Nieuwenhuizen a226588a5e scripts: Allow running with any mes.
* scripts/mescc.mes: Run $MES if set, default to ../scripts/mes.
* scripts/repl.mes: Likewise.
2017-03-26 22:09:24 +02:00
Jan Nieuwenhuizen 773efafd8f mini-mes: Include and enable gc.
* scaffold/mini-mes.c: Set MES_GC=1.
 (ARENA_SIZE)[MES_GC]: Reduce to 10,000 cells (WAS: 1,000,000,000
 chars).
 (g_news): New global.
 (NTYPE, NCAR, NVALUE, NLENGTH, NCDR, NVECTOR): New macros.
 (mes_symbols)[MES_GC]: Call gc_init_news.
 (mes_builtins): Include gc.i, gc.environment.i.
2017-03-26 16:03:41 +02:00
Jan Nieuwenhuizen 934260fc27 mini-mes: Workarounds for gc.c.
* gc.c (gc_copy)[!__GNUC__]: Avoid by value assignment from array-of
  struct entry.
* scaffold/mini-mes.c (gc_init_cells): Workarounds.
2017-04-01 23:30:45 +02:00
Jan Nieuwenhuizen 6a816687e8 core: Prepare gc.c for mescc, non-POSIX_SOURCE.
* mes.c (NLENGTH, NVALUE, NVECTOR): New macros.
  (mes_builtins): Add comment on .i include order.
* module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0.
* gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs
  rather than fprintf.
  (gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector.
* gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c
  implementation.
2017-03-26 15:55:12 +02:00
Jan Nieuwenhuizen 17f89b2c78 mescc: Bugfix for realloc.
* module/mes/libc.mes (realloc): Thinko.
2017-03-26 15:49:45 +02:00
Jan Nieuwenhuizen f015150cd8 mescc: Bugfix for neg.
* module/language/c99/compiler.mes (expr->accu): Fix neg.
* scaffold/t.c (math_test): Test it.
* scaffold/mini-mes.c (ash): Remove workaround.
2017-03-25 19:03:03 +01:00
Jan Nieuwenhuizen c39c04cb56 mescc: Support rshift, have guile-mini-mes pass math test.
* module/mes/as-i386.mes (i386:accu>>base): New function.
* module/mes/as-i386.scm (mes): Export it.
* module/language/c99/compiler.mes (expr->accu): Support rshift.
* scaffold/t.c (math_test): Test it.
* scaffold/mini-mes.c (ash): Use it.
2017-03-25 18:48:40 +01:00
Jan Nieuwenhuizen 701169764c test: Enable vector read test.
* tests/read.test: Enable vector read test.
2017-03-26 16:47:18 +02:00
Jan Nieuwenhuizen ddf96c3958 mini-mes: Support vectors.
* scaffold/mini-mes.c (REF, MAKE_REF): New macro.
  Include vector.h, vector.c.
  (mes_builtins): Include vector.i, vector.environment.i.
2017-03-25 14:05:17 +01:00
Jan Nieuwenhuizen 6c6df16ca3 mini-mes: Workarounds for vector.c.
* vector.c (make_vector, vector_set_x, list_to_vector)[!__GNUC__]: Avoid
  by value assignment from array-of struct entry.
2017-03-25 17:15:07 +01:00
Jan Nieuwenhuizen 43abef7cf5 core: prepare vector.c for mescc.
* vector.c (make_vector, vector_set_x, vector_to_list): Use REF, VALUE
  rather than .ref, .value.
2017-03-25 14:04:48 +01:00
Jan Nieuwenhuizen 30743ce141 mini-mes: Fully remove reader from core.
* scaffold/mini-mes.c (lookup_): Remove.
* mes.c: Likewise.
* reader.c (lookup_): Enable.
* mlib.c (putc): New function.
* module/mes/libc.mes (putc): New function.
2017-03-25 15:58:44 +01:00
Jan Nieuwenhuizen 040b9aedfc mescc: Support bitwise or.
* module/mes/as-i386.mes (i386:accu-or-base): New function.
* module/mes/as-i386.scm: Export it.
* module/language/c99/compiler.mes (expr->accu): Use it; support bitwise or.
* scaffold/t.c (math_test): Test it.
* scaffold/mini-mes.c (logior): Use it.
2017-03-24 23:15:01 +01:00
Jan Nieuwenhuizen ca633abdda mescc: Lshift support non-fixed shift value.
* module/mes/as-i386.mes (i386:accu<<base): New function.
* module/mes/as-i386.scm: Export it.
* module/language/c99/compiler.mes (expr->accu): Use it.
* scaffold/t.c (math_test): Test it.
2017-03-24 22:32:02 +01:00
Jan Nieuwenhuizen ce55c198c0 mescc: Use signed integer comparison.
* module/language/c99/compiler.mes (test->jump->info):
* module/mes/as-i386.mes (i386:Xjump-le, i386:Xjump-g, i386:Xjump-l,
  i386:Xjump-ge): New functions.
* module/mes/as-i386.scm: Export them.
* scaffold/t.c (math_test): Test them.
* tests/scm.test ("iota -1"): Enable for mesc.
2017-03-24 21:45:19 +01:00