mes.git
5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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):

5 years 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.

5 years 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.

5 years 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.

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

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 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.

5 years 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.

5 years 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.

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

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

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

5 years 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.

5 years 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.

5 years 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.

5 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>.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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).

5 years 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.

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

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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).

5 years 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.

5 years 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.

5 years 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.

5 years 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.

5 years 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:

5 years agonyacc cpp-debugging, tests
Jan Nieuwenhuizen [Tue, 2 Jan 2018 19:41:59 +0000 (20:41 +0100)]
nyacc cpp-debugging, tests

5 years agomes: getopt-long: fix multi-opt and unclumping.
Jan Nieuwenhuizen [Tue, 2 Jan 2018 06:05:41 +0000 (07:05 +0100)]
mes: getopt-long: fix multi-opt and unclumping.

* module/mes/getopt-long.scm (remove-if-not): Remove.
  (option-spec): Add value field.  Update users.
  (expand-clumped-singles): Simplify, fix.
  (process-options): To get an option's value, use value instead of
  value-policy.  Fixes multi-opt.
* tests/getopt-long.test: New file.
* make.scm (mes-tests): Add it.
* check.sh (tests): Add it.
* tests/getopt-long.test-guile: New symlink.

5 years agoguix: back to 0.80.41 for tinycc.
Jan Nieuwenhuizen [Tue, 2 Jan 2018 06:05:22 +0000 (07:05 +0100)]
guix: back to 0.80.41 for tinycc.

guix.scm (nyacc): New variable.

5 years agomes: Support equal? with arbitrary number of arguments.
Jan Nieuwenhuizen [Mon, 1 Jan 2018 22:00:01 +0000 (23:00 +0100)]
mes: Support equal? with arbitrary number of arguments.

* module/mes/base.mes (equal2?): Rename from equal?.
  (equal?): Implement.

5 years agomescc: Use records for mes too.
Jan Nieuwenhuizen [Mon, 1 Jan 2018 21:21:15 +0000 (22:21 +0100)]
mescc: Use records for mes too.

* module/language/c99/info.mes: Use info.scm records, remove
  simplistic list data structures.

5 years agomescc.mes: Use write for preprocessing output.
Jan Nieuwenhuizen [Mon, 1 Jan 2018 20:13:46 +0000 (21:13 +0100)]
mescc.mes: Use write for preprocessing output.

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

5 years agomes: Add write, core:write.
Jan Nieuwenhuizen [Mon, 1 Jan 2018 20:10:15 +0000 (21:10 +0100)]
mes: Add write, core:write.

* src/lib.c (display_helper, fdisplay_): Add parameter, write_p.
  Update callers.  When write_p: write quoted strings.
  (write_, write_port_): New function.
* module/mes/read-0.mes (write): New function.

5 years agomes: gc_safety.
Jan Nieuwenhuizen [Mon, 1 Jan 2018 19:00:06 +0000 (20:00 +0100)]
mes: gc_safety.

5 years agocheck-mescc.sh: run with mes.
Jan Nieuwenhuizen [Mon, 1 Jan 2018 15:55:07 +0000 (16:55 +0100)]
check-mescc.sh: run with mes.

* src/build.sh:
* src/check-mescc.sh: Run with mes.

5 years agomes: Add string-null?.
Jan Nieuwenhuizen [Mon, 1 Jan 2018 15:41:15 +0000 (16:41 +0100)]
mes: Add string-null?.

* module/srfi/srfi-13.mes (string-null?): New function.

5 years agomes: Add dirname.
Jan Nieuwenhuizen [Mon, 1 Jan 2018 15:40:23 +0000 (16:40 +0100)]
mes: Add dirname.

* module/mes/guile.mes (dirname): New function.

5 years agotest: Add syntax tests.
Jan Nieuwenhuizen [Mon, 1 Jan 2018 14:53:13 +0000 (15:53 +0100)]
test: Add syntax tests.

* tests/syntax.test: New file.
* tests/syntax.test-guile: New file.

fixup: 1b0696f9 (Jan Nieuwenhuizen 2018-01-01 15:53:13 +0100 40) ,        (lambda ()

5 years agoRevert "mes: use array-based stack. WIP: will not survice gc."
Jan Nieuwenhuizen [Sun, 17 Dec 2017 06:42:49 +0000 (07:42 +0100)]
Revert "mes: use array-based stack. WIP: will not survice gc."

This reverts commit 7fb653f68c2dbf8bc83cce4bd138439c600b538f.

5 years agomes: use array-based stack. WIP: will not survice gc.
Jan Nieuwenhuizen [Thu, 14 Dec 2017 06:05:53 +0000 (07:05 +0100)]
mes: use array-based stack. WIP: will not survice gc.

* src/mes.c (STACK_SIZE)[MES_ARRAY_STACK]: New variable.
  (g_stack_array): New variable.
  (g_stack): Change type to SCM*.
* (gc_push_frame)[MES_ARRAY_STACK]: Use g_stack_array, g_stack.
  (gc_peek_frame): Likewise.
  (gc_pop_frame): Likewise.
* src/gc.c (gc_check): Likewise.
  (gc): Likewise.

5 years agomes: Fix assq to improve performance.
Jan Nieuwenhuizen [Tue, 12 Dec 2017 19:25:48 +0000 (20:25 +0100)]
mes: Fix assq to improve performance.

* src/mes.c (assq): Special case eq_p to improve performance.

5 years agomes: Reimplement records.
Jan Nieuwenhuizen [Mon, 11 Dec 2017 23:12:42 +0000 (00:12 +0100)]
mes: Reimplement records.

* module/srfi/srfi-9.mes (define-record-type): New macro.
* AUTHORS: Update.
* module/mes/record-0.mes: Remove.
* module/mes/record.mes: Remove.
* module/srfi/srfi-9-psyntax.mes: Remove.
* module/srfi/srfi-9.scm: Remove.
* make.scm: Remove them.

5 years agomes: Fix display of closure.
Jan Nieuwenhuizen [Mon, 11 Dec 2017 06:06:21 +0000 (07:06 +0100)]
mes: Fix display of closure.

* module/mes/display.mes (display): Drop extra ( at start of *closure*, *circ*.
* src/lib.c (display_helper): Likewise.

5 years agomes: Resurrect define, define-macro in C core.
Jan Nieuwenhuizen [Sat, 9 Dec 2017 07:24:38 +0000 (08:24 +0100)]
mes: Resurrect define, define-macro in C core.

* make.scm (bin.gcc, bin.mescc): Use MES_C_READER=1.
* src/mes.c (scm_symbol_define, scm_symbol_define_macro): New symbol.
  (scm_vm_eval_define): New special.
  (scm_symbol_c_define): New symbol.
  (MAKE_MACRO): New define.
  (eval_apply)[MES_C_DEFINE]: Handle define, define-macro.
  (mes_symbols): Define %c-define for use in read-0.mes.
* module/mes/read-0.mes: Do not implement full scheme define if %c-define.
* module/mes/quasiquote.mes (sexp:define, env:define, env:macro): New function.
  (define-macro): New macro.  FIXME
* module/mes/psyntax.mes (define): New macro.  FIXME

5 years agomes: Fix initial display.
Jan Nieuwenhuizen [Sun, 10 Dec 2017 14:51:35 +0000 (15:51 +0100)]
mes: Fix initial display.

* module/mes/read-0.mes (display): Fix.

5 years agomes: Fix compile warning in reader.
Jan Nieuwenhuizen [Mon, 11 Dec 2017 03:52:00 +0000 (04:52 +0100)]
mes: Fix compile warning in reader.

* src/reader.c[MES_C_READER]: Declare read_block_comment, read_hash.
  Fixes compile warning.

5 years agomescc: Allow invoking git mescc.mes from elsewhere.
Jan Nieuwenhuizen [Sat, 9 Dec 2017 21:38:51 +0000 (22:38 +0100)]
mescc: Allow invoking git mescc.mes from elsewhere.

* src/mes.c (load_env): Look in MES_PREFIX too.  Add debug printing.
* scripts/mescc.mes: Consider MES_PREFIX.
* guile/mescc.scm (%prefix): Consider MES_PREFIX.
* module/mes/base-0.mes (string->list): New function, move from type-0.mes.
  (%moduledir): Consider MES_PREFIX.
* module/mes/type-0.mes (string->list): Remove.

5 years agomescc: Output performance hacks: use core:display.
Jan Nieuwenhuizen [Sat, 9 Dec 2017 19:10:57 +0000 (20:10 +0100)]
mescc: Output performance hacks: use core:display.

* src/lib.c (display_): Write to g_stdout (WAS: STDOUT).
* module/mes/guile.scm (guile): Declare and export core:display core:display-error.
* module/mes/M1.mes (object->M1): Use core:display and string-append
  instead of format.
* module/mes/guile.mes (with-input-from-string): Add debugging.
  (open-input-string): Likewise.
  (read-string): Likewise.  Re-implement.
  (drain-input): Use read-string.

5 years agomes: Nyacc support: substring/copy, substring/shared.
Jan Nieuwenhuizen [Sat, 9 Dec 2017 21:45:38 +0000 (22:45 +0100)]
mes: Nyacc support: substring/copy, substring/shared.

* module/srfi/srfi-13.mes (substring/copy, substring/shared): Define
  to substring.

5 years agomes: Nyacc support: Read old characters.
Jan Nieuwenhuizen [Sat, 9 Dec 2017 21:36:53 +0000 (22:36 +0100)]
mes: Nyacc support: Read old characters.

* src/reader.c (read_character)[MES_C_READER]: Support reading old
  characters: #\bel, #\bs, #\vt.

5 years agomes: resurrect running MesCC: handle \t in strings.
Jan Nieuwenhuizen [Sat, 9 Dec 2017 18:33:10 +0000 (19:33 +0100)]
mes: resurrect running MesCC: handle \t in strings.

* src/reader.c (read-string): Handle \t.  Fixex M1 output.

5 years agomescc: Use small, bootstrappable syntax rather than huge psyntax seed.
Jan Nieuwenhuizen [Sat, 9 Dec 2017 09:55:46 +0000 (10:55 +0100)]
mescc: Use small, bootstrappable syntax rather than huge psyntax seed.

* module/nyacc/lex.mes (mes): Use syntax (WAS: psyntax).
* module/mes/pmatch.mes (mes): Likewise.
* module/nyacc/lang/c99/parser.mes (srfi-9): Use syntax (WAS: srfi-9-psyntax).

5 years agomes: Fix for pmatch on bootstrappable syntax-rules.
Jan Nieuwenhuizen [Sat, 9 Dec 2017 14:04:32 +0000 (15:04 +0100)]
mes: Fix for pmatch on bootstrappable syntax-rules.

* module/mes/pmatch.scm (ppat): Do not use let.
* tests/pmatch.test ("pmatch nyacc minimal", "pmatch nyacc"): Test it.

5 years agomlibc: M4 support: robustify headers, add sys/signal.h.
Jan Nieuwenhuizen [Tue, 5 Dec 2017 18:49:37 +0000 (19:49 +0100)]
mlibc: M4 support: robustify headers, add sys/signal.h.

* include/errno.h (ERANGE): New define.
* include/stdarg.h (size_t): Undefine before typedef.
* include/stdint.h: Likewise.
* include/stdio.h: Likewise.
* include/stdlib.h: Likewise.
* include/sys/types.h: Likewise.
* include/string.h: Likewise.
  (ssize_t): Undefine before typedef.
* include/unistd.h: Likewise.
  (off_t): Undefine before typedef.
* include/sys/stat.h (struct stat): New stub.
* include/sys/signal.h: New file.