mes.git
2 years agoscm: Support test failure expectation.
Jan Nieuwenhuizen [Sat, 1 Apr 2017 13:01:59 +0000 (15:01 +0200)]
scm: Support test failure expectation.

* module/mes/test.mes (result): Take second argument to mean expected
  failure count.

2 years agoscm: Evaluate arguments of OR only once.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 14:47:22 +0000 (16:47 +0200)]
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.

2 years agoscm: Have char-set-contains? strictly return boolean.
Jan Nieuwenhuizen [Sat, 1 Apr 2017 07:36:34 +0000 (09:36 +0200)]
scm: Have char-set-contains? strictly return boolean.

* module/srfi/srfi-14.mes (char-set-contains?): Return #t rather than
  memq result.

2 years agoscm: Fix bug in assq-set!
Jan Nieuwenhuizen [Sat, 1 Apr 2017 05:23:10 +0000 (07:23 +0200)]
scm: Fix bug in assq-set!

* module/mes/scm.mes (assq-set!): Bugfix.

2 years agoscm: Add c????r.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 07:35:47 +0000 (09:35 +0200)]
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.

2 years agoscm: Add access?
Jan Nieuwenhuizen [Fri, 31 Mar 2017 19:41:32 +0000 (21:41 +0200)]
scm: Add access?

* module/mes/guile.mes (access?): New dummy function.  Fixes Nyacc's #include.

3 years agodoc: Add Roamdmap.
Jan Nieuwenhuizen [Wed, 29 Mar 2017 06:05:18 +0000 (08:05 +0200)]
doc: Add Roamdmap.

* HACKING: Add roadmap.

2 years agoscm: Add open-input-string, read-string.
Jan Nieuwenhuizen [Sat, 1 Apr 2017 10:51:35 +0000 (12:51 +0200)]
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.

2 years agobuild: Cleanup, use gcc-specific snarfing.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 15:01:22 +0000 (17:01 +0200)]
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.

3 years agocore: Fix error message when macro is missing.
Jan Nieuwenhuizen [Mon, 27 Mar 2017 18:14:48 +0000 (20:14 +0200)]
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.

3 years agotest: Add pmatch tests.
Jan Nieuwenhuizen [Wed, 29 Mar 2017 06:07:51 +0000 (08:07 +0200)]
test: Add pmatch tests.

* tests/pmatch.test: New file.
* GNUmakefile (TESTS): Add it.

3 years agonyacc: prefix globals.
Jan Nieuwenhuizen [Tue, 28 Mar 2017 18:26:16 +0000 (20:26 +0200)]
nyacc: prefix globals.

3 years agoscm: Bugfix display of named characters: add port.
Jan Nieuwenhuizen [Mon, 27 Mar 2017 19:41:44 +0000 (21:41 +0200)]
scm: Bugfix display of named characters: add port.

* module/mes/display.mes (display): Typo, add port.

3 years agonyacc: Add missing (mes pmatch) include.
Jan Nieuwenhuizen [Mon, 27 Mar 2017 19:01:22 +0000 (21:01 +0200)]
nyacc: Add missing (mes pmatch) include.

* module/nyacc/lang/c99/cpp.mes (mes): Include (mes pmatch).

2 years agonyacc: Use pmatch rather than match for cpp.
Jan Nieuwenhuizen [Sat, 1 Apr 2017 10:16:09 +0000 (12:16 +0200)]
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.

3 years agoscm: Bugfix drain-input.
Jan Nieuwenhuizen [Mon, 27 Mar 2017 19:00:49 +0000 (21:00 +0200)]
scm: Bugfix drain-input.

* module/mes/guile.mes (drain-input): Bugfix: return string.

3 years agoscm: Add assoc-set!
Jan Nieuwenhuizen [Mon, 27 Mar 2017 05:01:15 +0000 (07:01 +0200)]
scm: Add assoc-set!

* module/mes/scm.mes (assoc-set!): New function.
* tests/scm.test ("assoc-set!", "assoc-set! new"): New tests.

3 years agoscm: Add compose.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 22:35:36 +0000 (00:35 +0200)]
scm: Add compose.

* module/mes/scm.mes (compose): New function.
* tests/scm.test ("compose"): New test.

3 years agoscm: Support reading negative hex numbers.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 22:11:05 +0000 (00:11 +0200)]
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.

3 years agoscm: Support map4.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 21:48:15 +0000 (23:48 +0200)]
scm: Support map4.

* module/mes/base-0.mes (map): Remove.  Update callers.
* module/mes/base.mes (map): Support map4.

3 years agonyacc: Add simple split-cppdef for Mes.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 21:09:44 +0000 (23:09 +0200)]
nyacc: Add simple split-cppdef for Mes.

* module/nyacc/lang/c99/body.scm: Add non-regexp split-cppdef for Mes.

3 years agoscm: Add with-throw-handler hack.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 21:09:11 +0000 (23:09 +0200)]
scm: Add with-throw-handler hack.

* module/mes/catch.mes (with-throw-handler): Add hack for Nyacc 0.75

3 years agoscm: Add list->char-set.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 20:33:51 +0000 (22:33 +0200)]
scm: Add list->char-set.

* module/srfi/srfi-14.mes (list->char-set): New function.
* tests/srfi-14.test ("list->char-set!"): Test it.

3 years agomini-mes: Debugging to stderr.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 20:12:24 +0000 (22:12 +0200)]
mini-mes: Debugging to stderr.

* scaffold/mini-mes.c (error, bload_env, main): Send debug info to
  stderr.

throw/catch dinges: URG

3 years agoscripts: Allow running with any mes.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 20:09:24 +0000 (22:09 +0200)]
scripts: Allow running with any mes.

* scripts/mescc.mes: Run $MES if set, default to ../scripts/mes.
* scripts/repl.mes: Likewise.

3 years agomini-mes: Include and enable gc.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 14:03:41 +0000 (16:03 +0200)]
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.

2 years agomini-mes: Workarounds for gc.c.
Jan Nieuwenhuizen [Sat, 1 Apr 2017 21:30:45 +0000 (23:30 +0200)]
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.

3 years agocore: Prepare gc.c for mescc, non-POSIX_SOURCE.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 13:55:12 +0000 (15:55 +0200)]
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.

3 years agomescc: Bugfix for realloc.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 13:49:45 +0000 (15:49 +0200)]
mescc: Bugfix for realloc.

* module/mes/libc.mes (realloc): Thinko.

3 years agomescc: Bugfix for neg.
Jan Nieuwenhuizen [Sat, 25 Mar 2017 18:03:03 +0000 (19:03 +0100)]
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.

3 years agomescc: Support rshift, have guile-mini-mes pass math test.
Jan Nieuwenhuizen [Sat, 25 Mar 2017 17:48:40 +0000 (18:48 +0100)]
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.

3 years agotest: Enable vector read test.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 14:47:18 +0000 (16:47 +0200)]
test: Enable vector read test.

* tests/read.test: Enable vector read test.

3 years agomini-mes: Support vectors.
Jan Nieuwenhuizen [Sat, 25 Mar 2017 13:05:17 +0000 (14:05 +0100)]
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.

3 years agomini-mes: Workarounds for vector.c.
Jan Nieuwenhuizen [Sat, 25 Mar 2017 16:15:07 +0000 (17:15 +0100)]
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.

3 years agocore: prepare vector.c for mescc.
Jan Nieuwenhuizen [Sat, 25 Mar 2017 13:04:48 +0000 (14:04 +0100)]
core: prepare vector.c for mescc.

* vector.c (make_vector, vector_set_x, vector_to_list): Use REF, VALUE
  rather than .ref, .value.

3 years agomini-mes: Fully remove reader from core.
Jan Nieuwenhuizen [Sat, 25 Mar 2017 14:58:44 +0000 (15:58 +0100)]
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.

3 years agomescc: Support bitwise or.
Jan Nieuwenhuizen [Fri, 24 Mar 2017 22:15:01 +0000 (23:15 +0100)]
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.

3 years agomescc: Lshift support non-fixed shift value.
Jan Nieuwenhuizen [Fri, 24 Mar 2017 21:32:02 +0000 (22:32 +0100)]
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.

3 years agomescc: Use signed integer comparison.
Jan Nieuwenhuizen [Fri, 24 Mar 2017 20:45:19 +0000 (21:45 +0100)]
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.

3 years agomescc: Run module/base-0.mes.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 19:13:01 +0000 (21:13 +0200)]
mescc: Run module/base-0.mes.

* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
  read_input_file.
  (getenv_, open_input_file, current_input_port,
  set_current_input_port force_output, exit_, values, arity_, xassq,
  is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
  (mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.

3 years agotest: Allow running with any mes.
Jan Nieuwenhuizen [Sun, 26 Mar 2017 19:06:19 +0000 (21:06 +0200)]
test: Allow running with any mes.

* test/base.test: Run $MES if set, default to ../scripts/mes.
* tests/base.test: Likewise.
* tests/catch.test: Likewise.
* tests/closure.test: Likewise.
* tests/cwv.test: Likewise.
* tests/display.test: Likewise.
* tests/fluids.test: Likewise.
* tests/gc-0.test: Likewise.
* tests/gc-1.test: Likewise.
* tests/gc-2.test: Likewise.
* tests/gc-2a.test: Likewise.
* tests/gc-3.test: Likewise.
* tests/gc-4.test: Likewise.
* tests/gc-5.test: Likewise.
* tests/gc-6.test: Likewise.
* tests/gc.test: Likewise.
* tests/let-syntax.test: Likewise.
* tests/let.test: Likewise.
* tests/match.test: Likewise.
* tests/math.test: Likewise.
* tests/module.test: Likewise.
* tests/optargs.test: Likewise.
* tests/peg.test: Likewise.
* tests/psyntax.test: Likewise.
* tests/quasiquote.test: Likewise.
* tests/read.test: Likewise.
* tests/record.test: Likewise.
* tests/scm.test: Likewise.
* tests/srfi-1.test: Likewise.
* tests/srfi-13.test: Likewise.
* tests/srfi-14.test: Likewise.
* tests/vector.test: Likewise.

2 years agoscm+test: Factor-out math and vector.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 09:34:40 +0000 (11:34 +0200)]
scm+test: Factor-out math and vector.

* module/mes/base-0.mes (quotient): Remove.
* module/mes/scm.mes (quotient): Add.
* tests/scm.test: Remove arithmetic/math tests.
* tests/math.test: New file.
* GNUmakefile (TESTS): Add it

3 years agomescc: Have ungetc remember 2 positions.
Jan Nieuwenhuizen [Thu, 23 Mar 2017 17:57:06 +0000 (18:57 +0100)]
mescc: Have ungetc remember 2 positions.

* doc/examples/t.c (read_test): Test it.
* doc/examples/mini-mes.c:
* mlibc.c (getchar, ungetc): Support 2 ungetc positions.
* module/mes/libc.mes (getchar, ungetc): Likewise.

2 years agomescc: Add brk, naive malloc.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 10:31:15 +0000 (12:31 +0200)]
mescc: Add brk, naive malloc.

* scaffold/mini-mes.c (gc_init_cells): Use malloc to init g_cells.
* scaffold/malloc.c: New file.
* GNUmakefile (malloc, guile-malloc): New targets.
* module/mes/libc-i386.mes (i386:brk): New function.
  (i386:libc): Add it.
* mlibc.c (brk): New function.
  (malloc): Use it.
  (realloc): New function.
* module/mes/libc.mes (malloc, realloc): New functions.

3 years agomescc: Struct fixes.
Jan Nieuwenhuizen [Thu, 23 Mar 2017 17:48:19 +0000 (18:48 +0100)]
mescc: Struct fixes.

* module/language/c99/compiler.mes (expr->arg, expr->accu, ast->info):
  Fixes for struct assignment.

3 years agomescc: Add missing defines.
Jan Nieuwenhuizen [Wed, 22 Mar 2017 06:54:45 +0000 (07:54 +0100)]
mescc: Add missing defines.

* module/language/c99/compiler.mes (mescc): Set STDIN, STDOUT, STDERR,
  INT_MIN, INT_MAX.

3 years agomini-mes: Update display_.
Jan Nieuwenhuizen [Wed, 22 Mar 2017 06:09:58 +0000 (07:09 +0100)]
mini-mes: Update display_.

* doc/examples/mini-mes.c (display_): Add separator, nicer recursion.
* mes.c (display_): Update.

3 years agomescc: Struct by value assignment fixes.
Jan Nieuwenhuizen [Wed, 22 Mar 2017 06:13:34 +0000 (07:13 +0100)]
mescc: Struct by value assignment fixes.

* module/language/c99/compiler.mes (ast->info): Remove g_function
  hardcoding, fix struct assignment.
* doc/examples/t.c (struct_test): Test it.

3 years agomescc: Fix struct field comparison.
Jan Nieuwenhuizen [Wed, 22 Mar 2017 06:10:54 +0000 (07:10 +0100)]
mescc: Fix struct field comparison.

* module/language/c99/compiler.mes (expr->accu, ast->info): Some
  push/pop fixes, fixes struct field comparisons.
* doc/examples/t.c (struct_test): Test it.

3 years agomescc: Run full scheme reader read-0.mes.
Jan Nieuwenhuizen [Wed, 22 Mar 2017 05:59:50 +0000 (06:59 +0100)]
mescc: Run full scheme reader read-0.mes.

* lib.c (load_env)[MINI_MES]: Load full reader, module/mes/read-0.mes.
* GNUmakefile (module/mes/read-0-32.mo): Update dependency.
* module/mes/mini-0.mes: Remove.
* doc/examples/t.c (struct_test):
* module/mes/read-0-32.mo: New file: bootstrap binary reader.

3 years agomescc: Mini-mes (gcc-compiled) runs read-0.mes.
Jan Nieuwenhuizen [Wed, 22 Mar 2017 05:39:24 +0000 (06:39 +0100)]
mescc: Mini-mes (gcc-compiled) runs read-0.mes.

* module/language/c99/compiler.mes (expr->accu): Add mul.
  (test->jump->info): Add le, ge.
  (ast->info): Support int and char* initialization at top level.
* module/mes/as-i386.mes (i386:accu*base, i386:Xjump-cz,
  i386:Xjump-ncz): New function.
* module/mes/as-i386.scm: Export them.
* doc/examples/t.c (test): Test them.
* module/mes/libc.mes (ungetc): New function.
  (getchar): Support it.
  (assert_fail, isdigit): New functions.
  (libc): Export them.
* module/mes/mini-0.mes: Load full reader.
* mlibc.c (ungetc): New function.
  (getchar): Support it.
  (assert_fail, isdigit): New functions.
* mes.c (list length error lookup_ getchar ungetchar peekchar
  peek_byte read_byte unread_byte greater_p less_p): Move functions
  needed to run read-0.mes into core.
* doc/examples/mini-mes.c: Likewise.
* lib.c (length, error): Comment-out.
* math.c (greater_p, less_p): Comment-out.
* posix.c: (getchar, ungetchar, peekchar, peek_byte, read_byte,
  unread_byte): Comment-out.
* reader.c (lookup_): Comment-out.

3 years agomescc: Cleanup mini-mes build and test.
Jan Nieuwenhuizen [Sun, 19 Mar 2017 12:41:56 +0000 (13:41 +0100)]
mescc: Cleanup mini-mes build and test.

* GNUmakefile (guile-cons-mes guile-m guile-main guile-micro-mes
  guile-mini-mes guile-t guile-tiny-mes): New targets.
  (clean): Clean them.
* .gitignore: Ignore them.
* HACKING: Update.
* scaffold/tiny-mes.c (bload_env): Read module/mes/tiny-0-32.mo.
* scaffold/cons-mes.c (simple_bload_env): Likewise.
* lib.c (dump)[MES_TINY]: Write crafted dump: module/mes/tiny-0-32.mo.
  (load_env): Read module/mes/mini-0.mes.
  (bload_env): Read module/mes/read-0-32.mo.
* module/mes/mini-0.mes: New file.
* module/mes/tiny-0.mes : New file.

2 years agomescc: Refactor libc.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 10:29:09 +0000 (12:29 +0200)]
mescc: Refactor libc.

* GNUmakefile (mini-mes): Add include.
* mlibc.c: New file: libc bits for GNUC -nostdlib.
* mstart.c: New file: _start for GNUC -nostdlib.
* scaffold/cons-mes.c: Remove GNUC libc bits.
* scaffold/m.c: Likewise.
* scaffold/mini-mes.c: Likewise.
* scaffold/t.c: Likewise.
* scaffold/tiny-mes.c: Litkewise.
* module/language/c99/compiler.mes (libc, i386:libc): Remove.
* module/language/c99/compiler.scm
* module/mes/libc-i386.mes: Remove assembly bits.
  (_start): New function.
* module/mes/libc-i386.scm: Export it, remove assembly exports.
* module/mes/as-i386.mes: New file: assembly bits from libc-i386.mes.
* module/mes/as-i386.scm: New file: export them.
* module/mes/libc.mes (libc,_start): New functions from compiler.mes.
* module/mes/libc.scm: Export them.

3 years agomescc: Refactor ret.
Jan Nieuwenhuizen [Sun, 19 Mar 2017 09:27:18 +0000 (10:27 +0100)]
mescc: Refactor ret.

* module/mes/libc-i386.mes (i386:ret): Refactor.
* module/language/c99/compiler.mes (ast->info): Use it.

3 years agomescc: Cache text generation.
Jan Nieuwenhuizen [Sat, 18 Mar 2017 22:00:04 +0000 (23:00 +0100)]
mescc: Cache text generation.

* module/mes/elf-util.mes (functions->text): Add cache.

3 years agomescc: Refactor function-offset.
Jan Nieuwenhuizen [Sat, 18 Mar 2017 18:12:25 +0000 (19:12 +0100)]
mescc: Refactor function-offset.

* module/mes/elf-util.mes (function-offset): Recurse down.  Factor 5
  speedup on mini-mes.c.

3 years agomescc: Cache data-offset too.
Jan Nieuwenhuizen [Sat, 18 Mar 2017 07:58:15 +0000 (08:58 +0100)]
mescc: Cache data-offset too.

* module/mes/elf-util.mes (data-offset): Add cache.

3 years agomescc: Support assignment with comparison.
Jan Nieuwenhuizen [Sat, 18 Mar 2017 07:25:15 +0000 (08:25 +0100)]
mescc: Support assignment with comparison.

* module/language/c99/compiler.mes (expr->accu): Handle assignment -> accu.
* doc/examples/t.c (test): Test it.
* doc/examples/mini-mes.c (eval_apply): Use it.

3 years agomescc: Support assignment test.
Jan Nieuwenhuizen [Sat, 18 Mar 2017 07:17:18 +0000 (08:17 +0100)]
mescc: Support assignment test.

* module/language/c99/compiler.mes (test->jump->info): Handle assignment.
* doc/examples/t.c (test): Test it.

3 years agomescc: Fix simple value tests.
Jan Nieuwenhuizen [Fri, 17 Mar 2017 22:49:29 +0000 (23:49 +0100)]
mescc: Fix simple value tests.

* module/language/c99/compiler.mes (test->jump->info): Test accu
  before jumping.  Fixes simple value tests.

3 years agomescc: Struct by value.
Jan Nieuwenhuizen [Fri, 17 Mar 2017 21:45:48 +0000 (22:45 +0100)]
mescc: Struct by value.

* build-aux/mes-snarf.scm (symbol->names, function->header,
  function->environment): Remove struct by value assignment
  workarounds.
* module/language/c99/compiler.mes (ast->info): Remove struct by value
  assignment debug printing.

3 years agomescc: Support generic initializer.
Jan Nieuwenhuizen [Fri, 17 Mar 2017 16:54:37 +0000 (17:54 +0100)]
mescc: Support generic initializer.

* module/language/c99/compiler.mes (ast->info): Support generic
  declaration using initializer.  Supports struct field initializer.
* doc/examples/t.c (struct_test): Test it.
* doc/examples/mini-mes.c (call_lambda, eval_apply, write_byte,
  display_): Use it.  (call_lambda): (eval_apply,
  list_of_char_equal_p): Use it.

3 years agomescc: Remove last hardcodings for identifiers.
Jan Nieuwenhuizen [Fri, 17 Mar 2017 16:32:23 +0000 (17:32 +0100)]
mescc: Remove last hardcodings for identifiers.

* module/language/c99/compiler.mes (ident->accu, ident->base):
  Use local:ptr, type->size to remove hard coding of functionx, c1.
  (expr->accu): Use type->size to remove hard coding of size byte.
  (decl->type): Also handle typename, bail out if type not found.
  (type->size): Print identifier and and bail out if type not found.
  (formal:ptr): New function.
  (formals->locals): Use it to set pointer value of parameter.  WAS: 0.
  (ast->info): Remove functionx hardcoding.
  (getchar): Rename c1 to c.
* doc/examples/t.c: Test it.

3 years agomescc: Support function call with enum value.
Jan Nieuwenhuizen [Fri, 17 Mar 2017 07:37:45 +0000 (08:37 +0100)]
mescc: Support function call with enum value.

* doc/examples/mini-mes.c: Remove debug printing.
* module/language/c99/compiler.mes (push-global, push-local,
  push-global-address, push-local-address, push-local-de-ref): Return
  list of lambda.
  (push-ident): Support push constant.  Fixes mini-mes,
  cstring_to_list.
* doc/examples/t.c (test): Test it.

3 years agomescc: Fix d-sel comparisons.
Jan Nieuwenhuizen [Mon, 13 Mar 2017 23:15:13 +0000 (00:15 +0100)]
mescc: Fix d-sel comparisons.

* module/language/c99/compiler.mes (ast->info): Save base while
computing accu. Fix comparison using d-sel in second argument.
* doc/examples/t.c: Test it.
* doc/examples/mini-mes.c (assq): Use it.

3 years agomescc: Fix for character array s[0].
Jan Nieuwenhuizen [Mon, 13 Mar 2017 18:38:38 +0000 (19:38 +0100)]
mescc: Fix for character array s[0].

* module/language/c99/compiler.mes (expr->arg, expr->accu, ast->info):
  Use type size to calculate index.
* doc/examples/t.c: Test it.
* doc/examples/mini-mes.c (cstring_to_list): Simplify.

3 years agomescc: Support mini-mes running scheme program with builtins.
Jan Nieuwenhuizen [Sun, 12 Mar 2017 11:02:12 +0000 (12:02 +0100)]
mescc: Support mini-mes running scheme program with builtins.

Mini-mes, compiled with either gcc or mescc, now runs a memory dump of
this mini-0.mes program

(begin
  (write-byte (make-cell 0 0 65))
  (write-byte (make-cell 0 0 66))
          (write-byte (make-cell 0 0 67))
    (write-byte (make-cell 0 0 10))
  #f)

when read and dumped by (gcc-compiled) mes-32.

* build-aux/mes-snarf.scm: FIXES ..collapse?
* module/language/c99/compiler.mes (ast->info): Bail out on unhandled
  declarations.  Was: verbosely skip.

3 years agomescc: Support [for] itoa.
Jan Nieuwenhuizen [Sun, 12 Mar 2017 10:05:20 +0000 (11:05 +0100)]
mescc: Support [for] itoa.

* module/mes/libc-i386.mes (i386:accu%base): New function.
* module/mes/libc-i386.scm: Export it.
* module/language/c99/compiler.mes (expr->accu): Use it to support mod.
* doc/examples/t.c (itoa): New function.
  (test): Test it.
* doc/examples/mini-mes.c (itoa)[!__GNUC__]: New function.

3 years agomescc: Support do .. while.
Jan Nieuwenhuizen [Sun, 12 Mar 2017 10:05:00 +0000 (11:05 +0100)]
mescc: Support do .. while.

* module/language/c99/compiler.mes (ast->info): Support do-while.
* doc/examples/t.c (test): Test it.

3 years agocore+mini-mes: Replace manual snippets by snarfed includes.
Jan Nieuwenhuizen [Fri, 10 Mar 2017 19:56:18 +0000 (20:56 +0100)]
core+mini-mes: Replace manual snippets by snarfed includes.

* build-aux/mes-snarf.scm (symbol->source, function->header,
  function->source, function->environment): Add workarounds to
  avoid struct-copy initializers.
* GNUmakefile (mini-mes): Snarf symbols and functions.
* scaffold/mini-mes.c: Include mini-mes.h, mini-mes.symbols.h,
  mini-mes.symbols.i, mini-mes.i, mini-mes.environment.i.
  Add snarfable symbol/special definitions.
  (type_t): Prefix all types with `T', update users.
  (assert_defined, gc_push_frame, gc_peek_frame, gc_init_cells): Mark
  as internal.
* mes.c (type_t): Prefix all types with `T', update users.
* scaffold/mini-mes.c (eq_p, type_, car_, cdr_,
  list_of_char_equal_p, lookup_macro, write_byte): New functions (from
  mes.c).
  (assq): Add debugging, workaround.

3 years agonyacc: removed start from lalr-spec -- not needed
Matt Wette [Sun, 5 Mar 2017 21:22:51 +0000 (13:22 -0800)]
nyacc: removed start from lalr-spec -- not needed

3 years agonyacc: working javascript interpreter in guile
Matt Wette [Sat, 4 Mar 2017 01:07:29 +0000 (17:07 -0800)]
nyacc: working javascript interpreter in guile

3 years agonyacc: lex fixes for char-lit
Matt Wette [Fri, 3 Mar 2017 00:23:44 +0000 (16:23 -0800)]
nyacc: lex fixes for char-lit

3 years agonyacc: cleaned up documentation
Matt Wette [Thu, 2 Mar 2017 02:11:40 +0000 (18:11 -0800)]
nyacc: cleaned up documentation

3 years agonyacc: working on C99 UG as a memo
Matt Wette [Wed, 1 Mar 2017 01:19:48 +0000 (17:19 -0800)]
nyacc: working on C99 UG as a memo

3 years agonyacc: new release 0.76.5
Matt Wette [Tue, 28 Feb 2017 17:57:49 +0000 (09:57 -0800)]
nyacc: new release 0.76.5

3 years agonyacc: fixed bug in pretty-print-c99 wrt i-sel
Matt Wette [Tue, 28 Feb 2017 17:53:41 +0000 (09:53 -0800)]
nyacc: fixed bug in pretty-print-c99 wrt i-sel

3 years agonyacc: merge from 0.76.4
Matt Wette [Sat, 25 Feb 2017 15:36:57 +0000 (07:36 -0800)]
nyacc: merge from 0.76.4

3 years agonyacc: new release 0.76.4
Matt Wette [Fri, 24 Feb 2017 01:31:24 +0000 (17:31 -0800)]
nyacc: new release 0.76.4

3 years agonyacc: new release 0.76.3
Matt Wette [Thu, 23 Feb 2017 13:38:49 +0000 (05:38 -0800)]
nyacc: new release 0.76.3

3 years agonyacc: more bugs in cpp tokl->string
Matt Wette [Thu, 23 Feb 2017 13:37:25 +0000 (05:37 -0800)]
nyacc: more bugs in cpp tokl->string

3 years agonyacc: new release 0.76.2
Matt Wette [Thu, 23 Feb 2017 01:14:07 +0000 (17:14 -0800)]
nyacc: new release 0.76.2

3 years agonyacc: fixed more CPP issues
Matt Wette [Thu, 23 Feb 2017 01:12:32 +0000 (17:12 -0800)]
nyacc: fixed more CPP issues

3 years agonyacc: new release 0.76.1
Matt Wette [Wed, 22 Feb 2017 16:26:40 +0000 (08:26 -0800)]
nyacc: new release 0.76.1

3 years agonyacc: fixed C99 CPP to deal with numbers correctly
Matt Wette [Wed, 22 Feb 2017 16:23:27 +0000 (08:23 -0800)]
nyacc: fixed C99 CPP to deal with numbers correctly

3 years agonyacc: merge master 0.76.0
Matt Wette [Mon, 20 Feb 2017 21:45:45 +0000 (13:45 -0800)]
nyacc: merge master 0.76.0

3 years agonyacc: new release 0.76.0
Matt Wette [Sun, 19 Feb 2017 16:28:25 +0000 (08:28 -0800)]
nyacc: new release 0.76.0

3 years agonyacc: worked c99/util2.scm udecl->mspec
Matt Wette [Sun, 19 Feb 2017 16:26:30 +0000 (08:26 -0800)]
nyacc: worked c99/util2.scm udecl->mspec

3 years agonyacc: new release 0.75.6
Matt Wette [Sun, 19 Feb 2017 01:11:12 +0000 (17:11 -0800)]
nyacc: new release 0.75.6

3 years agonyacc: fixed some c99/util2 items
Matt Wette [Sun, 19 Feb 2017 01:06:50 +0000 (17:06 -0800)]
nyacc: fixed some c99/util2 items

3 years agonyacc: merged in 0.75.5 from master and inc version
Matt Wette [Fri, 17 Feb 2017 18:21:52 +0000 (10:21 -0800)]
nyacc: merged in 0.75.5 from master and inc version

3 years agonyacc: new release 0.75.5
Matt Wette [Fri, 17 Feb 2017 16:30:20 +0000 (08:30 -0800)]
nyacc: new release 0.75.5

3 years agonyacc: new release 0.74.4
Matt Wette [Fri, 17 Feb 2017 00:14:42 +0000 (16:14 -0800)]
nyacc: new release 0.74.4

3 years agonyacc: minor cpp fixes
Matt Wette [Fri, 17 Feb 2017 00:12:40 +0000 (16:12 -0800)]
nyacc: minor cpp fixes

3 years agonyacc: merge from 0.75.3
Matt Wette [Thu, 16 Feb 2017 19:03:11 +0000 (11:03 -0800)]
nyacc: merge from 0.75.3

3 years agonyacc: new release 0.75.3
Matt Wette [Thu, 16 Feb 2017 14:26:10 +0000 (06:26 -0800)]
nyacc: new release 0.75.3

3 years agonyacc: new release 0.75.2
Matt Wette [Thu, 16 Feb 2017 14:24:56 +0000 (06:24 -0800)]
nyacc: new release 0.75.2

3 years agonyacc: new release 0.75.1
Matt Wette [Thu, 16 Feb 2017 14:12:32 +0000 (06:12 -0800)]
nyacc: new release 0.75.1

3 years agonyacc: new release 0.74.0
Matt Wette [Thu, 16 Feb 2017 04:49:07 +0000 (20:49 -0800)]
nyacc: new release 0.74.0

3 years agonyacc: I think cpp is working now
Matt Wette [Thu, 16 Feb 2017 03:58:29 +0000 (19:58 -0800)]
nyacc: I think cpp is working now