mes.git
19 months agodoc: Release udpate.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 22:45:00 +0000 (00:45 +0200)]
doc: Release udpate.

* BOOTSTRAP: Update.
* HACKING: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.13: New file.

19 months agomescc: Merge mescc.mes and mescc.scm.
Jan Nieuwenhuizen [Fri, 27 Apr 2018 21:47:31 +0000 (23:47 +0200)]
mescc: Merge mescc.mes and mescc.scm.

* scripts/mescc: New file.
* scripts/mescc.mes: Remove.
* guile/mescc.scm: Remove.
* guile/guix/make.scm (CC.mescc): Update.
* install.sh (TINYCC_SEED): Update.
* make.scm (bootstrap?): Update.
* test.sh (MES): Update.
* check-boot.sh: Use $GUILE to allow running without Guile.

19 months agocore: Add chmod.
Jan Nieuwenhuizen [Fri, 27 Apr 2018 21:31:45 +0000 (23:31 +0200)]
core: Add chmod.

* src/posix.c (chmod_): New function.

19 months agocore: jam-scaper/garbage-collector: Use only one arena.
Jan Nieuwenhuizen [Wed, 25 Apr 2018 06:35:05 +0000 (08:35 +0200)]
core: jam-scaper/garbage-collector: Use only one arena.

* src/mes.c (ARENA_SIZE): Lower to 200000.
  (MES_MAX_ARENA): Bump to 300000000.
  (JAM_SIZE): New global.
  (make_cell__): Remove ARENA assert.
  (gc_init_cells): Alloc ARENA_SIZE + JAM_SIZE.
  (mes_symbols): Do not init news.
  (gc_init_news): Remove.
  (main): Initialize JAM_SIZE, consider MES_JAM environment variable.
* src/gc.c (gc_init_news): Move from mes.c.  Start at g_free.
  (gc_flip): Do not flip to g_news, instead copy g_news to cells.
  (gc_up_arena): Realloc to ARENA_SIZE + JAM_SIZE.
  (gc_): Init news.  Only up arena if g_news is safe.

19 months agomescc: Create less garbage when dumping M1.
Jan Nieuwenhuizen [Tue, 24 Apr 2018 05:26:27 +0000 (07:26 +0200)]
mescc: Create less garbage when dumping M1.

* module/mes/M1.mes (display-join): New function.
* (object->M1): Use it.

19 months agocore: last_pair: Move to core.
Jan Nieuwenhuizen [Tue, 24 Apr 2018 05:00:35 +0000 (07:00 +0200)]
core: last_pair: Move to core.

* src/lib.c (last_pair): New function.
* module/mes/scm.mes (last-pair): Remove.

19 months agocore: equal2_p: Add short-circuit and eliminate tail call.
Jan Nieuwenhuizen [Tue, 24 Apr 2018 04:59:18 +0000 (06:59 +0200)]
core: equal2_p: Add short-circuit and eliminate tail call.

* src/lib.c (equal2_p): Add short-circuit and eliminate tail call.

19 months agomescc: Use display for dumping M1.
Jan Nieuwenhuizen [Mon, 23 Apr 2018 04:56:35 +0000 (06:56 +0200)]
mescc: Use display for dumping M1.

* module/mes/M1.mes (object->M1): Use display for dumping M1.

19 months agomes: Guile-like command-line interface.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 09:51:28 +0000 (11:51 +0200)]
mes: Guile-like command-line interface.

* module/mes/boot-0.scm (tty?): Guile-like command-line interface.
* scripts/repl.mes: Remove.
* scripts/mescc.mes: Update.
* tests/*.test: Update scripts.
* module/mes/repl.mes (repl): Add ,quit.

19 months agomes: getopt-long: Support stop-at-first-non-option.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 09:49:30 +0000 (11:49 +0200)]
mes: getopt-long: Support stop-at-first-non-option.

* module/mes/getopt-long.scm (process-options): Fix parsing `-'.  Add
  parameter: stop-at-first-non-option.
  (getopt-long): Add keyword parameter #:stop-at-first-non-option.

19 months agomes: Add isatty?.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 09:48:38 +0000 (11:48 +0200)]
mes: Add isatty?.

* src/posix.c (isatty_p): New function.

19 months agomlibc: Add isatty.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 09:47:44 +0000 (11:47 +0200)]
mlibc: Add isatty.

* lib/libc.c (isatty): New function.
* include/unistd.h: Declare it.

19 months agomlibc: Add ioctl.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 09:42:47 +0000 (11:42 +0200)]
mlibc: Add ioctl.

* stage0/x86.M1 (SYS_ioctl): New define.
* lib/linux-mes.c (ioctl): New syscall.
* lib/linux-gcc.c (ioctl): New syscall.
* include/sys/ioctl.h: New file.

20 months agocore: Compile minimal mes with MES_MINI=1.
Jan Nieuwenhuizen [Tue, 10 Apr 2018 19:43:19 +0000 (21:43 +0200)]
core: Compile minimal mes with MES_MINI=1.

* src/mes.c: Compile minimal mes with MES_MINI=1.

19 months agocore; reader_read_string: Support escaped characters.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 22:33:50 +0000 (00:33 +0200)]
core; reader_read_string: Support escaped characters.

* src/reader.c (reader_read_string): Support escaped characters.

19 months agoRevert "mescc: Use core:write."
Jan Nieuwenhuizen [Sun, 22 Apr 2018 14:38:55 +0000 (16:38 +0200)]
Revert "mescc: Use core:write."

This reverts commit d88e31dfec3158a830c32f9f732b052cfccac6eb.

19 months agomescc: Use core:write.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 21:58:37 +0000 (23:58 +0200)]
mescc: Use core:write.

* scripts/mescc.mes (source->ast): Use core:write.

19 months agomes: display: Display escaped characters.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 18:08:38 +0000 (20:08 +0200)]
mes: display: Display escaped characters.

* module/mes/display.mes (display): Display escaped characters.

19 months agocore: display_helper: Display escaped characters.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 21:58:28 +0000 (23:58 +0200)]
core: display_helper: Display escaped characters.

* src/lib.c (display_helper): Display escaped characters.

19 months agomes: Resurrect macros in repl.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 15:30:14 +0000 (17:30 +0200)]
mes: Resurrect macros in repl.

* src/mes.c (scm_vm_begin_expand): Rename to core:begin-expand.
 (eval_apply): Expose it.
* module/mes/repl.mes (repl): Use it to resurrect macros.

19 months agocore: Fixes for garbage collector/jam scraper.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 11:31:12 +0000 (13:31 +0200)]
core: Fixes for garbage collector/jam scraper.

* src/gc.c (gc_loop): Do not relocate car of TCLOSURE, TCONTINUATION.
  Check for TBROKEN_HEART.
* src/mes.c (make_closure_): Set car to 0.
  (check_apply): Check for TBROKEN_HEART.  Fixes reporting artificial
  out-of-memory error.
  (eval_apply): Likewise.
* src/vector.c (vector_entry): Only copy TCHAR and TNUMBER.

19 months agocore: drop global_p from variable.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 11:19:54 +0000 (13:19 +0200)]
core: drop global_p from variable.

* src/mes (struct scm): Remove field global_p.
 (VARIABLE_GLOBAL_P): Remove.
 (make_variable_): Remove global_p parameter.  Update callers.
* src/lib.c (display_helper): Drop VARIABLE_GLOBAL_P support.

19 months agocore: Reenable full printing of lists.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 06:54:14 +0000 (08:54 +0200)]
core: Reenable full printing of lists.

* src/lib.c (display_helper): Reenable full printing of lists.

19 months agocore: append2, append_reverse, reverse, reverse!: Create less garbage.
Jan Nieuwenhuizen [Fri, 20 Apr 2018 12:38:24 +0000 (14:38 +0200)]
core: append2, append_reverse, reverse, reverse!: Create less garbage.

* src/mes.c (append_reverse): New function.
  (reverse_x_): New function.
  (append2): Use them to create less garbage.
* module/mes/scm.mes (reverse): Create less garbage.
* module/srfi/srfi-1.mes (reverse!): Rewrite, use core:reverse!.
  (append-reverse): Remove.

19 months agocore: vector_to_list: Create less garbage.
Jan Nieuwenhuizen [Fri, 20 Apr 2018 11:22:47 +0000 (13:22 +0200)]
core: vector_to_list: Create less garbage.

* src/vector.c (vector_to_list): Create less garbage.

19 months agocore: Optimize vector-map, vector-for-each.
Jan Nieuwenhuizen [Fri, 20 Apr 2018 11:06:00 +0000 (13:06 +0200)]
core: Optimize vector-map, vector-for-each.

* module/srfi/srfi-43.mes (vector-map): Optimize.
  (vector-for-each): Optimize.
* tests/srfi-43.test: New file.
* tests/srfi-43.test-guile: New file.
* check.sh (tests): Add it.
* make.scm (mes-tests): Add it.

19 months agoRevert "build-32.sh"
Jan Nieuwenhuizen [Wed, 18 Apr 2018 17:35:25 +0000 (19:35 +0200)]
Revert "build-32.sh"

This reverts commit ace8b6f1b52de58c9ab404ed13234f397dac6bdc.

19 months agobuild-32.sh
Jan Nieuwenhuizen [Mon, 16 Apr 2018 18:25:31 +0000 (20:25 +0200)]
build-32.sh

20 months agocore: Cleanup make_cell, remove tmp cells.
Jan Nieuwenhuizen [Sat, 14 Apr 2018 06:15:49 +0000 (08:15 +0200)]
core: Cleanup make_cell, remove tmp cells.

* src/mes.c (make_cell__): New function.
  (make_cell_): Use it.
  (length__): New function.
  (tmp, tmp_num, tmp_num2, tmp_num_, tmp_num2_, make_tmps): Remove.
  Update callers to use make_cell__ directly.
 * src/vector.c (make_vector__): New function.
  (make_vector_): Use it.

19 months agoRevert "mlibc: Use memmove in realloc."
Jan Nieuwenhuizen [Sat, 21 Apr 2018 11:42:16 +0000 (13:42 +0200)]
Revert "mlibc: Use memmove in realloc."

This reverts commit f47a21e3cb4814c4a30d10ff59e5c947441725e9.

19 months agomlibc: Use memmove in realloc.
Jan Nieuwenhuizen [Sun, 15 Apr 2018 06:13:36 +0000 (08:13 +0200)]
mlibc: Use memmove in realloc.

* src/libc.c (memmove): New function.
  (realloc): Use it.
* src/libc+tcc.c (memmove): Remove.

19 months agomes: Add char-whitespace?
Jan Nieuwenhuizen [Sun, 15 Apr 2018 06:04:09 +0000 (08:04 +0200)]
mes: Add char-whitespace?

* module/srfi/srfi-14.mes (char-whitespace?): New function.

19 months agomes: Move base-0.mes int boot-0.scm.
Jan Nieuwenhuizen [Sat, 14 Apr 2018 20:06:28 +0000 (22:06 +0200)]
mes: Move base-0.mes int boot-0.scm.

* module/mes/boot-02.scm: New file, rename from boot-0.scm.
* module/mes/boot-0.scm: Add base-0.mes.
* module/mes/base-0.mes: Remove.

20 months agomes: Unify mlibc-gcc and mes builds.
Jan Nieuwenhuizen [Fri, 13 Apr 2018 06:18:19 +0000 (08:18 +0200)]
mes: Unify mlibc-gcc and mes builds.

* make.scm (bin.gcc): Remove stray slash.
* src/mes.c: Unify mlibc-gcc and mes builds.
(gc_init_cells):
(gc_init_news):
(bload_env):
* src/reader.c (reader_read_character):
(reader_read_string):

20 months agocore: Remove local variables from gc.
Jan Nieuwenhuizen [Thu, 12 Apr 2018 19:33:38 +0000 (21:33 +0200)]
core: Remove local variables from gc.

* src/gc.c (gl_loop): Remove local variables.

20 months agocore: Listen to MES_SAFETY environment variable.
Jan Nieuwenhuizen [Thu, 12 Apr 2018 05:08:09 +0000 (07:08 +0200)]
core: Listen to MES_SAFETY environment variable.

20 months agocore: Remove local variables from eval/apply.
Jan Nieuwenhuizen [Thu, 12 Apr 2018 05:07:24 +0000 (07:07 +0200)]
core: Remove local variables from eval/apply.

* src/mes.c (eval_apply): Move all variables to global scope.

20 months agocore: Remove MesCC reminder.
Jan Nieuwenhuizen [Thu, 12 Apr 2018 05:06:40 +0000 (07:06 +0200)]
core: Remove MesCC reminder.

20 months agocore: Update default memory settings.
Jan Nieuwenhuizen [Wed, 11 Apr 2018 18:46:06 +0000 (20:46 +0200)]
core: Update default memory settings.

* src/mes.c (MAX_ARENA_SIZE)[__MESC__]: Set to maximum 172100000.

20 months agocore: Tune debug printing.
Jan Nieuwenhuizen [Mon, 9 Apr 2018 05:12:38 +0000 (07:12 +0200)]
core: Tune debug printing.

* src/mes.c: Tune debug printing.
* src/gc.c: Likewise.
* module/mes/guile.mes: Likewise.
* HACKING: Describe it.

20 months agocore: Rewrite reader to create less garbage.
Jan Nieuwenhuizen [Mon, 9 Apr 2018 06:41:30 +0000 (08:41 +0200)]
core: Rewrite reader to create less garbage.

* src/reader.c (reader_read_line_comment): Rename from read_line_comment.
(reader_identifier_p): New function.
(reader_end_of_word_p): New function.
(reader_read_identifier_or_number): New function.
(reader_read_sexp_): Rewrite.  Update callers.
(reader_read_list): Rewrite.
(reader_lookup_): Remove.

20 months agocore: Add isspace.
Jan Nieuwenhuizen [Tue, 10 Apr 2018 19:51:15 +0000 (21:51 +0200)]
core: Add isspace.

* include/ctype.h (isspace): Declare.
* lib/libc.c (isspace): New function.

20 months agocore: Rewrite string reader.
Jan Nieuwenhuizen [Sun, 8 Apr 2018 21:14:45 +0000 (23:14 +0200)]
core: Rewrite string reader.

* src/reader.c (reader_read_string): Rewrite, create much less
  garbage.
  (append_char): Remove.

20 months agoinstall: Fix prefix confusion.
Jan Nieuwenhuizen [Sun, 8 Apr 2018 15:01:59 +0000 (17:01 +0200)]
install: Fix prefix confusion.

* install.sh: Substitute @PREFIX@ with MES_PREFIX.
* scripts/mescc.mes: Grok PREFIX as MES_PREFIX.

20 months agoguix.scm: Update mes to 0.12.
Jan Nieuwenhuizen [Sun, 8 Apr 2018 12:43:44 +0000 (14:43 +0200)]
guix.scm: Update mes to 0.12.

* guix.scm (mes, mes.git): Update to 0.12.

20 months agoRelease 0.12. v0.12
Jan Nieuwenhuizen [Fri, 6 Apr 2018 05:24:05 +0000 (07:24 +0200)]
Release 0.12.

* configure (VERSION): Bump to 0.12.

2 years agodoc: Release udpate.
Jan Nieuwenhuizen [Tue, 21 Nov 2017 18:22:26 +0000 (19:22 +0100)]
doc: Release udpate.

* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.12: New file.
* throughout: (janneke) coming out.

20 months agoguix.scm: Update mescc-tools to 0.4.
Jan Nieuwenhuizen [Sun, 8 Apr 2018 05:51:14 +0000 (07:51 +0200)]
guix.scm: Update mescc-tools to 0.4.

* guix.scm (mescc-tools): Update to 0.4.

20 months agocore: Workaround for mescc.
Jan Nieuwenhuizen [Sun, 8 Apr 2018 05:50:12 +0000 (07:50 +0200)]
core: Workaround for mescc.

* src/mes.c (eval_apply)[__MESC__]: Add reminder for macro_p, global_p.

20 months agobuild: Remove scripts/mes symlink.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 16:27:26 +0000 (18:27 +0200)]
build: Remove scripts/mes symlink.

20 months agomes: Add string-fold, string-fold-right.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 11:37:07 +0000 (13:37 +0200)]
mes: Add string-fold, string-fold-right.

* module/srfi/srfi-13.mes (string-fold, string-fold-right): New
  function.
* tests/srfi-13.test ("string-fold"): Test it.
  ("string-fold-right"): Test it.

20 months agomes: Allow tick as part of identifier.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 11:36:23 +0000 (13:36 +0200)]
mes: Allow tick as part of identifier.

* src/reader.c (reader_read_sexp_): Do not treat tick as special.

20 months agomescc: Remove debugging.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 11:14:58 +0000 (13:14 +0200)]
mescc: Remove debugging.

* module/language/c99/compiler.mes: Remove debugging.

20 months agomescc: No comments in M1 when running on Mes.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 11:13:26 +0000 (13:13 +0200)]
mescc: No comments in M1 when running on Mes.

* module/language/c99/compiler.mes (ast-comment): If mes?, return nil.

20 months agomescc: Trace globals.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 10:56:17 +0000 (12:56 +0200)]
mescc: Trace globals.

* module/language/c99/compiler.mes (mescc:trace): New function.  Use
  throughout.

20 months agoRevert "core: Add member."
Jan Nieuwenhuizen [Sat, 7 Apr 2018 11:15:26 +0000 (13:15 +0200)]
Revert "core: Add member."

This reverts commit 921686a0a3b06281f1804d04e6d4a0344dda507a.

20 months agocore: Add member.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 10:18:50 +0000 (12:18 +0200)]
core: Add member.

* src/lib.c (member): New function.
* module/mes/scm.mes (member): Remove.

20 months agomescc: trace M1 dumping.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 08:24:57 +0000 (10:24 +0200)]
mescc: trace M1 dumping.

* module/language/c99/compiler.mes (info->object): Add tracing.
* module/mes/M1.mes (object->M1): Add tracing.

20 months agoRevert "guix: Update nyacc to 0.83.31."
Jan Nieuwenhuizen [Sat, 7 Apr 2018 11:41:32 +0000 (13:41 +0200)]
Revert "guix: Update nyacc to 0.83.31."

This reverts commit 624b85d6b1dd876542f7ad342d6beb8a92408397.

20 months agoguix: Update nyacc to 0.83.31.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 07:48:47 +0000 (09:48 +0200)]
guix: Update nyacc to 0.83.31.

* guix.scm (nyacc): Update to 0.83.31.

20 months agomescc: Have Nyacc trace functions while parsing.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 07:35:08 +0000 (09:35 +0200)]
mescc: Have Nyacc trace functions while parsing.

* guile/mescc.scm (main): Set NYACC_TRACE.
* scripts/mescc.mes (main): Set NYACC_TRACE.

20 months agomes: Add setenv.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 07:34:02 +0000 (09:34 +0200)]
mes: Add setenv.

* src/posix.c (setenv_): New function.
* tests/base.test ("setenv, getenv"): Test it.

20 months agocore: Add setenv.
Jan Nieuwenhuizen [Sat, 7 Apr 2018 07:21:51 +0000 (09:21 +0200)]
core: Add setenv.

* lib/libc.c (setenv): New function.
* include/stdlib.h (setenv): Declare it.
* scaffold/tests/61-array.c (test): Test it.

20 months agoguix: Add manifest.
Jan Nieuwenhuizen [Thu, 5 Apr 2018 21:13:23 +0000 (23:13 +0200)]
guix: Add manifest.

* build-aux/manifest.scm: New file.

20 months agoguix: Update Nyacc to 0.80.42.
Jan Nieuwenhuizen [Thu, 5 Apr 2018 19:24:11 +0000 (21:24 +0200)]
guix: Update Nyacc to 0.80.42.

* guix.scm (nyacc): Update to 0.80.42.

20 months agomescc: Also print `parsing: input' when using -E.
Jan Nieuwenhuizen [Fri, 6 Apr 2018 05:18:19 +0000 (07:18 +0200)]
mescc: Also print `parsing: input' when using -E.

* module/language/c99/compiler.mes (c99-input->ast): Print `parsing:
  input'.
  (c99-input->info): Remove that.

20 months agocore: Cleanup reader.
Jan Nieuwenhuizen [Thu, 5 Apr 2018 20:41:53 +0000 (22:41 +0200)]
core: Cleanup reader.

* src/reader.c (reader_read_sexp_): Rename from reader_read_word_.  Cleanup.
  (read_hash): Cleanup.

20 months agomes: Cleanup formatting.
Jan Nieuwenhuizen [Thu, 5 Apr 2018 19:35:31 +0000 (21:35 +0200)]
mes: Cleanup formatting.

20 months agocore: Add equal2?.
Jan Nieuwenhuizen [Thu, 5 Apr 2018 18:01:04 +0000 (20:01 +0200)]
core: Add equal2?.

* src/lib.c (equal2_p): New function.
* module/mes/base.mes (equal2?): Remove.

20 months agocore: Add memq.
Jan Nieuwenhuizen [Thu, 5 Apr 2018 09:03:09 +0000 (11:03 +0200)]
core: Add memq.

* lib/mes.c (memq): New function.
* module/mes/scm.mes (memq): Remove.

20 months agomes: Remove duplicate memq.
Jan Nieuwenhuizen [Thu, 5 Apr 2018 09:02:06 +0000 (11:02 +0200)]
mes: Remove duplicate memq.

* module/mes/base-0.mes (memq): Remove.

2 years agomes: Single environment lookup for variables, SICP chapter 3.
Jan Nieuwenhuizen [Sat, 9 Dec 2017 07:33:50 +0000 (08:33 +0100)]
mes: Single environment lookup for variables, SICP chapter 3.

* src/mes.c (t): Add TVARIABLE.
  (scm_vm_eval_deref): New vm special.
  (make_vref_): New internal function.
  (eval_apply): WIP: replace symbols with their variable reference.
* src/gc.c (gc_loop): Handle TVARIABLE.
* src/lib.c (display_helper): Handle TVARIABLE.
* module/mes/type-0.mes (<cell:variable>): New variable.
  (cell:type-alist): Add it.
  (variable?): New function.
* module/mes/display.mes (display): Handle <variable>.

20 months agocore: Remove override hook for read-input-file.
Jan Nieuwenhuizen [Tue, 3 Apr 2018 05:45:12 +0000 (07:45 +0200)]
core: Remove override hook for read-input-file.

* src/reader.c (read_input_file_env): Remove override hook for
read-input-file.

21 months agomes: Iterative recursive macro expand.
Jan Nieuwenhuizen [Sun, 4 Mar 2018 09:05:55 +0000 (10:05 +0100)]
mes: Iterative recursive macro expand.

* src/mes.c (eval_apply): Iterative recursive macro expand.
* src/posix.c (set_current_input_port): Return previous port.
* module/mes/catch.mes (%eh): Use core:display.
* module/mes/display.mes (display-cut, display-cut2): Move macro
  definitions to toplevel.

20 months agoguix: records.scm: update from upstream.
Jan Nieuwenhuizen [Wed, 4 Apr 2018 21:32:40 +0000 (23:32 +0200)]
guix: records.scm: update from upstream.

* guile/guix/records.scm: Update from upstream.

22 months agomes: Add incremental test suite.
Jan Nieuwenhuizen [Thu, 25 Jan 2018 05:58:44 +0000 (06:58 +0100)]
mes: Add incremental test suite.

* check-boot.sh: New file.
* check.sh: Invoke it.
* module/srfi/srfi-16.mes: New file.
* scaffold/boot/00-zero.scm: New file.
* scaffold/boot/01-true.scm: New file.
* scaffold/boot/02-symbol.scm: New file.
* scaffold/boot/03-string.scm: New file.
* scaffold/boot/04-cons.scm: New file.
* scaffold/boot/04-quote.scm: New file.
* scaffold/boot/05-list.scm: New file.
* scaffold/boot/06-tick.scm: New file.
* scaffold/boot/07-if.scm: New file.
* scaffold/boot/08-if-if.scm: New file.
* scaffold/boot/10-cons.scm: New file.
* scaffold/boot/11-list.scm: New file.
* scaffold/boot/12-car.scm: New file.
* scaffold/boot/13-cdr.scm: New file.
* scaffold/boot/14-exit.scm: New file.
* scaffold/boot/15-display.scm: New file.
* scaffold/boot/16-if-eq-quote.scm: New file.
* scaffold/boot/20-define-quote.scm: New file.
* scaffold/boot/20-define-quoted.scm: New file.
* scaffold/boot/20-define.scm: New file.
* scaffold/boot/21-define-procedure.scm: New file.
* scaffold/boot/22-define-procedure-2.scm: New file.
* scaffold/boot/23-begin.scm: New file.
* scaffold/boot/24-begin-define.scm: New file.
* scaffold/boot/25-begin-define-2.scm: New file.
* scaffold/boot/26-begin-define-later.scm: New file.
* scaffold/boot/26-define-define.scm: New file.
* scaffold/boot/27-lambda-define.scm: New file.
* scaffold/boot/28-define-define.scm: New file.
* scaffold/boot/29-lambda-define.scm: New file.
* scaffold/boot/2a-lambda-lambda.scm: New file.
* scaffold/boot/2b-define-lambda.scm: New file.
* scaffold/boot/2c-define-lambda-recurse.scm: New file.
* scaffold/boot/2d-define-lambda-set.scm: New file.
* scaffold/boot/2e-define-second.scm: New file.
* scaffold/boot/30-capture.scm: New file.
* scaffold/boot/31-capture-define.scm: New file.
* scaffold/boot/32-capture-modify-close.scm: New file.
* scaffold/boot/33-procedure-override-close.scm: New file.
* scaffold/boot/34-cdr-override-close.scm: New file.
* scaffold/boot/35-closure-modify.scm: New file.
* scaffold/boot/36-closure-override.scm: New file.
* scaffold/boot/37-closure-lambda.scm: New file.
* scaffold/boot/38-simple-format.scm: New file.
* scaffold/boot/40-define-macro.scm: New file.
* scaffold/boot/41-when.scm: New file.
* scaffold/boot/42-if-when.scm: New file.
* scaffold/boot/43-or.scm: New file.
* scaffold/boot/44-or-if.scm: New file.
* scaffold/boot/45-pass-if.scm: New file.
* scaffold/boot/46-report.scm: New file.
* scaffold/boot/47-pass-if-eq.scm: New file.
* scaffold/boot/48-let.scm: New file.
* scaffold/boot/49-macro-override.scm: New file.
* scaffold/boot/4a-define-macro-define-macro.scm: New file.
* scaffold/boot/4b-define-macro-define.scm: New file.
* scaffold/boot/4c-quasiquote.scm: New file.
* scaffold/boot/50-primitive-load.scm: New file.
* scaffold/boot/51-module.scm: New file.
* scaffold/boot/52-define-module.scm: New file.
* scaffold/boot/53-closure-display.scm: New file.
* scaffold/boot/60-let-syntax.scm: New file.
* scaffold/boot/closure.scm: New file.
* scaffold/boot/compose.scm: New file.
* scaffold/boot/data/bar.mes: New file.
* scaffold/boot/data/i.scm: New file.
* scaffold/boot/data/module.mes: New file.
* scaffold/boot/foo.scm: New file.
* scaffold/boot/lambda-star.scm: New file.
* scaffold/boot/vector.scm: New file.
* tests/boot.test: New file.
* tests/boot.test-guile: New file.
* tests/srfi-16.test: New file.
* tests/srfi-16.test-guile: New file.

22 months agomes: Boot from MES_BOOT, boot-0.scm.
Jan Nieuwenhuizen [Sat, 3 Feb 2018 20:43:52 +0000 (21:43 +0100)]
mes: Boot from MES_BOOT, boot-0.scm.

* src/mes.c (load_env): Softcode loading of boot-0.scm from
  environment variabl MES_BOOT.
* module/mes/boot-00.scm: New file.
* module/mes/boot-01.scm: New file.
* module/mes/boot-0.scm: Rename from read-0.mes.
* module/mes/module.mes: New file.

21 months agobuild: Add -fno-stack-protector for debian.
Jan Nieuwenhuizen [Sun, 4 Mar 2018 14:53:05 +0000 (15:53 +0100)]
build: Add -fno-stack-protector for debian.

* guile/guix/make.scm (%C32-FLAGS): Add -fno-stack-protector.

23 months agomes: reader: reader_ prefix; read/write char/string in core.
Jan Nieuwenhuizen [Sat, 6 Jan 2018 06:58:23 +0000 (07:58 +0100)]
mes: reader: reader_ prefix; read/write char/string in core.

* src/posix.c (peek_char, read_char, read_string, unread_char, write_char): New function.
* src/reader.c: Use reader_ prefix.

r# bootstrappable.org

22 months agomes: More informative error reporting for number asserts.
Jan Nieuwenhuizen [Thu, 25 Jan 2018 06:00:48 +0000 (07:00 +0100)]
mes: More informative error reporting for number asserts.

* src/math.c (assert_number): New function.  Update assert () users.

22 months agoguile: Resurrect eval/apply in scheme.
Jan Nieuwenhuizen [Sat, 27 Jan 2018 15:43:09 +0000 (16:43 +0100)]
guile: Resurrect eval/apply in scheme.

* guile/mes.mes (eval-expand): Short-circuit make-closure.
* guile/mes.scm (environment): Update.

22 months agomes: simple-format: support ~A, ~S.
Jan Nieuwenhuizen [Sat, 3 Feb 2018 19:06:38 +0000 (20:06 +0100)]
mes: simple-format: support ~A, ~S.

* module/mes/display.scm (simple-format): support ~A, ~S.

22 months agocore: Display and write string and char compliance.
Jan Nieuwenhuizen [Mon, 22 Jan 2018 22:45:46 +0000 (23:45 +0100)]
core: Display and write string and char compliance.

* src/lib.c (display_helper): Display and write char and string compliance.

22 months agomes: display: Support keyword.
Jan Nieuwenhuizen [Sat, 3 Feb 2018 20:57:30 +0000 (21:57 +0100)]
mes: display: Support keyword.

* src/lib.c (display_helper): Support keyword.

23 months agomes: display: vector.
Jan Nieuwenhuizen [Fri, 12 Jan 2018 17:24:42 +0000 (18:24 +0100)]
mes: display: vector.

* src/lib.c (display_helper): Display vector.

22 months agomes: display: closure names.
Jan Nieuwenhuizen [Sun, 14 Jan 2018 08:11:19 +0000 (09:11 +0100)]
mes: display: closure names.

* src/lib.c (display_helper): Display closure names.

23 months agomes: Rename make-vector to core:make-vector.
Jan Nieuwenhuizen [Sun, 7 Jan 2018 15:26:36 +0000 (16:26 +0100)]
mes: Rename make-vector to core:make-vector.

* src/vector.c (make_vector_): Rename from make_vector.  Update callers.

23 months agomes: Better error reporting.
Jan Nieuwenhuizen [Sun, 7 Jan 2018 15:08:11 +0000 (16:08 +0100)]
mes: Better error reporting.

* src/lib.c (write_error_): New function.
* src/mes.c (error, check_apply): Use it.
  (append2, set_car_x): Upon error, call error (WAS: assert).

23 months agoRevert "mes: un-defmacro optargs. WIP"
Jan Nieuwenhuizen [Sun, 7 Jan 2018 13:52:09 +0000 (14:52 +0100)]
Revert "mes: un-defmacro optargs.  WIP"

This reverts commit 5da527c540dc0e1481a010899233b4e806fe37da.

23 months agomes: un-defmacro optargs. WIP
Jan Nieuwenhuizen [Sat, 6 Jan 2018 08:29:11 +0000 (09:29 +0100)]
mes: un-defmacro optargs.  WIP

23 months agomes: Test optargs without pmatch.
Jan Nieuwenhuizen [Sat, 6 Jan 2018 10:18:38 +0000 (11:18 +0100)]
mes: Test optargs without pmatch.

* tests/optargs.test: Remove pmatch.

23 months agomes: Add define-macro*.
Jan Nieuwenhuizen [Sat, 6 Jan 2018 10:09:10 +0000 (11:09 +0100)]
mes: Add define-macro*.

* module/mes/optargs.mes (define-macro*): New macro.

23 months agomes: Evaluate test of COND only once.
Jan Nieuwenhuizen [Fri, 5 Jan 2018 09:01:50 +0000 (10:01 +0100)]
mes: Evaluate test of COND only once.

* module/mes/base-0.mes (cond): Evaluate test of COND only once.
  Fixes cond tests with side effects (Nyacc).
* tests/base.test ("cond side effect"): Test it.

23 months agomes: #\page is whitespace.
Jan Nieuwenhuizen [Thu, 4 Jan 2018 21:26:29 +0000 (22:26 +0100)]
mes: #\page is whitespace.

* module/srfi/srfi-14.mes (char-set:whitespace): Add #\page.

23 months agomes: #<eof> is not a character.
Jan Nieuwenhuizen [Thu, 4 Jan 2018 20:36:46 +0000 (21:36 +0100)]
mes: #<eof> is not a character.

* module/mes/display.mes (display):
* module/mes/type-0.mes (char?): -1 is not a character.
  (eof-object?): New function.
* tests/base.test ("#<eof>"): Test it.
* module/mes/scm.mes (eof-object?): Remove.
  (unread-char): Return character (WAS: integer).

23 months agomes: open-input-string: peek fix.
Jan Nieuwenhuizen [Thu, 4 Jan 2018 18:32:35 +0000 (19:32 +0100)]
mes: open-input-string: peek fix.

* module/mes/guile.mes (open-input-string): Return actual tell.
* tests/guile.test ("open-input-string peek"): Test it.

23 months agomes: with-input-from-string: peek fix.
Jan Nieuwenhuizen [Thu, 4 Jan 2018 17:35:26 +0000 (18:35 +0100)]
mes: with-input-from-string: peek fix.

* module/mes/guile.mes (with-input-from-string): Return actual tell.
* tests/guile.test ("with-input-from-string peek"): Test it.

23 months agomescc: Resurrect guile-1.8.
Jan Nieuwenhuizen [Wed, 3 Jan 2018 07:33:55 +0000 (08:33 +0100)]
mescc: Resurrect guile-1.8.

* guile/mescc.scm: Use GUILE_LOAD_COMPILED_PATH instead of -C.
  [guile]: Include syncase.
* module/language/c99/compiler.scm [guile]: Stub pretty-print-c99.
  Set stack to unlimited.
* module/language/c99/info.scm [guile]: Include (ice-9 syncase).
* module/mes/as-i386.scm [guile]: Likewise.
* module/mes/guile.scm [guile]: Add compose, export it.

23 months agomes: Add string-drop-right.
Jan Nieuwenhuizen [Wed, 3 Jan 2018 05:53:02 +0000 (06:53 +0100)]
mes: Add string-drop-right.

* module/srfi/srfi-13.mes (string-drop-right): New function.

23 months agomescc: cleanups.
Jan Nieuwenhuizen [Tue, 2 Jan 2018 20:35:55 +0000 (21:35 +0100)]
mescc: cleanups.

* guile/mescc.scm: Cleanups.
* module/language/c99/compiler.mes:
* module/language/c99/compiler.scm:
* module/language/c99/info.mes:
* module/language/c99/info.scm:
* module/mes/getopt-long.mes:
* module/mes/optargs.mes:
* module/mes/optargs.scm:
* module/mes/repl.mes:
* module/mes/scm.mes:
* scripts/mescc.mes: