mes.git
3 years agomes: Bugifx for number->string radix > 10.
Jan Nieuwenhuizen [Tue, 23 May 2017 04:28:37 +0000 (06:28 +0200)]
mes: Bugifx for number->string radix > 10.

* module/mes/scm.mes (number->string): Bugfix for `10' -> hex/radix > 10.

3 years agomes: Simplify read-string.
Jan Nieuwenhuizen [Sun, 21 May 2017 10:21:07 +0000 (12:21 +0200)]
mes: Simplify read-string.

* module/mes/guile.mes (read-string): Simplify, probably fix even.

3 years agomescc: Remove LALR C frontend prototype.
Jan Nieuwenhuizen [Sun, 21 May 2017 10:38:29 +0000 (12:38 +0200)]
mescc: Remove LALR C frontend prototype.

* module/language/c/compiler.mes: Remove.
* module/language/c/lexer.mes: Remove.
* module/language/c/parser.mes: Remove.

3 years agomes: Add negate.
Jan Nieuwenhuizen [Sun, 21 May 2017 10:33:16 +0000 (12:33 +0200)]
mes: Add negate.

* module/mes/scm.mes (negate): New function.

3 years agocore: Add current-output-port, open-output-file, set-current-output-port.
Jan Nieuwenhuizen [Fri, 19 May 2017 04:56:47 +0000 (06:56 +0200)]
core: Add current-output-port, open-output-file, set-current-output-port.

* libc/include/fcntl.h: Declare it.  Add some fcntl defines.
* libc/include/stdio.h: Remove fcntl defines, Declare g_stdout.
* module/language/c99/compiler.mes (c99-input->ast): Define O_WRONLY, O_RDWR.
* module/mes/guile.mes (with-output-to-file, with-output-to-port): New functions.
* src/posix.c (current_output_port, open_output_file,
  set_current_output_port): New functions.
* libc/mlibc.c (open): Add optional mode parameter.
* module/mes/libc-i386.mes (i386:open): Forward third parameter.
* scaffold/mini-mes.c (main): Init g_stdout.
* src/mes.c (main): Likewise.

3 years agomes: Support octal numbers in reader.
Jan Nieuwenhuizen [Fri, 19 May 2017 19:10:08 +0000 (21:10 +0200)]
mes: Support octal numbers in reader.

* module/mes/read-0.mes (read-octal): New function.
  (read-word): Use it.
* tests/read.test: Test it.

3 years agomes: Add getopt-long.
Jan Nieuwenhuizen [Thu, 18 May 2017 20:03:02 +0000 (22:03 +0200)]
mes: Add getopt-long.

* module/mes/getopt-long.scm: New file, imported from Guile-1.8,
* module/mes/getopt-long.mes: Include it.
* AUTHORS: Mention it.

3 years agomes: Add string-rindex.
Jan Nieuwenhuizen [Thu, 18 May 2017 22:41:01 +0000 (00:41 +0200)]
mes: Add string-rindex.

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

3 years agomes: Support predicate with string-index.
Jan Nieuwenhuizen [Thu, 18 May 2017 22:51:23 +0000 (00:51 +0200)]
mes: Support predicate with string-index.

* module/srfi/srfi-13.mes (string-index): Support predicate.

3 years agomes: Add string-suffix?
Jan Nieuwenhuizen [Thu, 18 May 2017 22:23:13 +0000 (00:23 +0200)]
mes: Add string-suffix?

* module/mes/scm.mes (string-prefix?): Refactor.
  (string-suffix?): New function.

3 years agoPurging binary blobs
Jeremiah Orians [Sat, 27 May 2017 04:56:06 +0000 (00:56 -0400)]
Purging binary blobs

* mes.mes: Remove.
* module/mes/read-0-32.mo: Remove.

3 years agodoc: Update.
Jan Nieuwenhuizen [Mon, 15 May 2017 05:01:01 +0000 (07:01 +0200)]
doc: Update.

* AUTHORS: Remove module/nyacc.

3 years agodoc: typo
Jan Nieuwenhuizen [Sun, 14 May 2017 16:09:22 +0000 (18:09 +0200)]
doc: typo

3 years agoguix hash: 0qqywk3siyhf08v7xac08lqldklrqfndlp495wgy6ii9fn93197k
Jan Nieuwenhuizen [Sun, 14 May 2017 16:00:38 +0000 (18:00 +0200)]
guix hash: 0qqywk3siyhf08v7xac08lqldklrqfndlp495wgy6ii9fn93197k

3 years agoRelease 0.6. v0.6
Jan Nieuwenhuizen [Sun, 25 Dec 2016 14:51:53 +0000 (15:51 +0100)]
Release 0.6.

* configure (VERSION): Bump.

3 years agodoc: Release update.
Jan Nieuwenhuizen [Sat, 6 May 2017 15:46:41 +0000 (17:46 +0200)]
doc: Release update.

* NEWS: Update.

3 years agotest: Run 33/55 tests of ../tinycc/tests/test2 if avaiable.
Jan Nieuwenhuizen [Thu, 4 May 2017 17:41:45 +0000 (19:41 +0200)]
test: Run 33/55 tests of ../tinycc/tests/test2 if avaiable.

* make/check-tinycc.make: New file.
* tinycc/tinycc.make: New file.
* GNUmakefile (SUBDIRS): Add tinycc.

3 years agobuild: Support i686, support development for arm.
Jan Nieuwenhuizen [Sun, 14 May 2017 07:03:06 +0000 (09:03 +0200)]
build: Support i686, support development for arm.

* configure (CC32): Accept arm-* as 32 bit compiler.
  (check-compile-header-c, check-header-c): New functions.
  (parse-opts): New option: --with-courage.
  (main): Check for platform, stdio.h, limits.h.

3 years agomescc: Minimal support for short.
Jan Nieuwenhuizen [Mon, 8 May 2017 19:34:08 +0000 (21:34 +0200)]
mescc: Minimal support for short.

* module/language/c99/compiler.mes (i386:type-alist): Add short.

3 years agomescc: Add strcpy.
Jan Nieuwenhuizen [Mon, 8 May 2017 19:15:53 +0000 (21:15 +0200)]
mescc: Add strcpy.

* libc/include/string.h (strcpy): Declare.
* libc/mlibc.c (strcpy): New function.
* module/mes/libc.mes (strcpy): New function.
  (libc): Add it.
* scaffold/t.c (string_test): Test it.

3 years agomescc: Enhance sizeof support.
Jan Nieuwenhuizen [Mon, 8 May 2017 19:32:32 +0000 (21:32 +0200)]
mescc: Enhance sizeof support.

* module/language/c99/compiler.mes (expr->accu): Support sizeof (simple-type),
  sizeof (var).

3 years agomescc: Support void return.
Jan Nieuwenhuizen [Mon, 8 May 2017 18:06:20 +0000 (20:06 +0200)]
mescc: Support void return.

* module/language/c99/compiler.mes (ast-info): Support `return'.

3 years agonyacc: Unbundle.
Jan Nieuwenhuizen [Sun, 7 May 2017 08:04:32 +0000 (10:04 +0200)]
nyacc: Unbundle.

* configure (check-version): Use keyword parameters, add #:command
  parameter.
  (main): Check for Nyacc.
* INSTALL: Mention Nyacc as dependency.
* make/guile.make (all-go): Compile in guile dir.
* module/module.make (SCM_FILES): Remove Nyacc filters.
* module/nyacc/BUGS: Remove.
* module/nyacc/ChangeLog: Remove.
* module/nyacc/README: Remove.
* module/nyacc/README.nyacc: Remove.
* module/nyacc/bison.scm: Remove.
* module/nyacc/export.scm: Remove.
* module/nyacc/import.scm: Remove.
* module/nyacc/lalr.scm: Remove.
* module/nyacc/lalr2.scm: Remove.
* module/nyacc/lang/c99/README: Remove.
* module/nyacc/lang/c99/body.scm: Remove.
* module/nyacc/lang/c99/cpp.scm: Remove.
* module/nyacc/lang/c99/cppmach.scm: Remove.
* module/nyacc/lang/c99/mach.d/c99act.scm: Remove.
* module/nyacc/lang/c99/mach.d/c99tab.scm: Remove.
* module/nyacc/lang/c99/mach.d/c99xact.scm: Remove.
* module/nyacc/lang/c99/mach.d/c99xtab.scm: Remove.
* module/nyacc/lang/c99/mach.d/cppact.scm: Remove.
* module/nyacc/lang/c99/mach.d/cpptab.scm: Remove.
* module/nyacc/lang/c99/mach.scm: Remove.
* module/nyacc/lang/c99/parser.scm: Remove.
* module/nyacc/lang/c99/pprint.scm: Remove.
* module/nyacc/lang/c99/util1.scm: Remove.
* module/nyacc/lang/c99/util2.scm: Remove.
* module/nyacc/lang/c99/xparser.scm: Remove.
* module/nyacc/lang/calc/parser.scm: Remove.
* module/nyacc/lang/util.scm: Remove.
* module/nyacc/lex.scm: Remove.
* module/nyacc/parse.scm: Remove.
* module/nyacc/util.scm: Remove.

3 years agomes: Consider GUILE_LOAD_PATH for include-from-path.
Jan Nieuwenhuizen [Sun, 7 May 2017 06:23:20 +0000 (08:23 +0200)]
mes: Consider GUILE_LOAD_PATH for include-from-path.

* module/mes/guile.scm (include-from-path): New macro.

3 years agomescc: Bugfixes for local char[].
Jan Nieuwenhuizen [Sun, 7 May 2017 05:36:44 +0000 (07:36 +0200)]
mescc: Bugfixes for local char[].

* module/language/c99/compiler.mes (push-ident): Cater for local arrays.
  (expr->accu): Avoid post-inc/post-dec twice on rhs of assignment.
  Fix size lookup for local char arrayns.

3 years agonyacc: Update to 0.78.
Jan Nieuwenhuizen [Sat, 6 May 2017 20:35:46 +0000 (22:35 +0200)]
nyacc: Update to 0.78.

3 years agomes: Add srfi-16 to Nyacc Guile support.
Jan Nieuwenhuizen [Sat, 6 May 2017 20:47:45 +0000 (22:47 +0200)]
mes: Add srfi-16 to Nyacc Guile support.

* module/mes/guile.mes: Include srfi-16 for Nyacc.

3 years agomes: Basic support for string-index.
Jan Nieuwenhuizen [Sat, 6 May 2017 21:00:27 +0000 (23:00 +0200)]
mes: Basic support for string-index.

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

3 years agomes: Support #\cr short form in reader.
Jan Nieuwenhuizen [Sat, 6 May 2017 20:49:08 +0000 (22:49 +0200)]
mes: Support #\cr short form in reader.

* module/mes/read-0.mes (read-character): Support #\cr short form for #\return.
* module/mes/read-0-32.mo: Regenerate.

3 years agomes: Support case-lambda.
Jan Nieuwenhuizen [Sat, 6 May 2017 20:42:21 +0000 (22:42 +0200)]
mes: Support case-lambda.

* module/srfi/srfi-16.scm: New file.
* AUTHORS: Mention it.
* module/srfi/srfi-16.mes: New file.

3 years agomescc: Enhance enum support.
Jan Nieuwenhuizen [Sat, 6 May 2017 17:31:00 +0000 (19:31 +0200)]
mescc: Enhance enum support.

* module/language/c99/compiler.mes (ast->info): Support enum variable
  declaration.  Respect field value overrides.

3 years agomescc: Support binary constants.
Jan Nieuwenhuizen [Sat, 6 May 2017 16:16:24 +0000 (18:16 +0200)]
mescc: Support binary constants.

* module/language/c99/compiler.mes (cstring->number): Support binary 0bxxx values.
* scaffold/t.c (math_test): Test it.

3 years agomescc: Support ==, != as expression value.
Jan Nieuwenhuizen [Sat, 6 May 2017 15:30:14 +0000 (17:30 +0200)]
mescc: Support ==, != as expression value.

* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (expr->accu): Set accu to 0/1 for eq, ne.
* module/mes/as-i386.mes (i386:nz->accu, i386:z->accu,
  i386:accu<->stack): New functions.
* scaffold/t.c (math_test): Test it.

3 years agomescc: Support &, ^.
Jan Nieuwenhuizen [Sat, 6 May 2017 12:57:39 +0000 (14:57 +0200)]
mescc: Support &, ^.

* module/mes/as-i386.mes (i386:accu-and-base, i386:accu-xor-base): New functions.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (expr->accu): Support bitwise-and, bitwise-xor.

3 years agomescc: Support struct pointers.
Jan Nieuwenhuizen [Sat, 6 May 2017 09:01:58 +0000 (11:01 +0200)]
mescc: Support struct pointers.

* module/language/c99/compiler.mes (expr->accu): Support
  &struct.field, struct->field.
  (ast->info): Support struct *foo = &bar;
* scaffold/t.c (struct_test): Test it.

3 years agomescc: Support struct definition with variable declaration.
Jan Nieuwenhuizen [Sat, 6 May 2017 07:27:28 +0000 (09:27 +0200)]
mescc: Support struct definition with variable declaration.

* module/language/c99/compiler.mes (ast->info): Support `struct foo {} bar;'.

3 years agomescc: Support void functions.
Jan Nieuwenhuizen [Sat, 6 May 2017 07:11:42 +0000 (09:11 +0200)]
mescc: Support void functions.

* module/language/c99/compiler.mes (function->info): Add return if
  missing.  Fixes calling void functions (and functions where return
  is missing).
* scaffold/t.c (void_func): Test it.

3 years agomescc: Bugfix for break in switch not in compound.
Jan Nieuwenhuizen [Sat, 6 May 2017 06:39:04 +0000 (08:39 +0200)]
mescc: Bugfix for break in switch not in compound.

* module/language/c99/compiler.mes (clause->jump-info): Rename from
  case->jump-info.
  (statements->clauses): New function.
  (ast->info): Use it.  Fixes switch statement with break in a case
  outside of a compound.
* scaffold/t.c (swits): Test it.

3 years agomescc: Enhance [int/pointer] array support.
Jan Nieuwenhuizen [Fri, 5 May 2017 07:24:19 +0000 (09:24 +0200)]
mescc: Enhance [int/pointer] array support.

* module/language/c99/compiler.mes (p-expr->type): Handle array-ref
  with any index.
  (ast->info): Support plain array declerations.
  (expr->accu): For size == 4, assume value in accu.  Fixes int/pointer arrays.
* scaffold/t.c: Test it.

3 years agomescc: Enhance struct support.
Jan Nieuwenhuizen [Thu, 4 May 2017 17:39:23 +0000 (19:39 +0200)]
mescc: Enhance struct support.

* module/language/c99/compiler.mes (expr->accu): Remove struct scm
  hardcoding.
  (p-expr->type): New function.
  (ast->info): Support struct variable declaration without
  initializer.  Set struct type for all struct declarations.

3 years agomescc: Fix itoa for negative numbers, using workaround.
Jan Nieuwenhuizen [Wed, 3 May 2017 21:01:49 +0000 (23:01 +0200)]
mescc: Fix itoa for negative numbers, using workaround.

* module/mes/libc.mes (itoa): Avoid `sign = x < 0;' FIXME, todo.
* scaffold/t.c (test): Test it.

3 years agomescc: Support regular C99 compile, headers + mlibc.
Jan Nieuwenhuizen [Tue, 2 May 2017 21:30:46 +0000 (23:30 +0200)]
mescc: Support regular C99 compile, headers + mlibc.

* libc/include/assert.h: New file.
* libc/include/ctype.h: New file.
* libc/include/errno.h: New file.
* libc/include/fcntl.h: New file.
* libc/include/limits.h: New file.
* libc/include/mlibc.h: New file.
* libc/include/stdio.h: New file.
* libc/include/stdlib: New file.
* libc/include/string.h: New file.
* libc/include/unistd.h: New file.
* libc/mlibc.c: Remove declarations.
* make/bin.make (INCLUDES): Factor out standard includes.
* make/bin-mlibc.make: New file.
* scaffold/scaffold.make: Use it.
* src/src.make: Use it.
* module/language/c99/compiler.mes (ast-info): Handle more function declarations.
* scaffold/cons-mes.c: Remove mlibc definitionsa and mlibc.c include.
  Instead include <mlibc.h>.
* scaffold/hello.c: Likewise.
* scaffold/m.c: Likewise.
* scaffold/malloc.c: Likewise.
* scaffold/micro-mes.c: Likewise.
* scaffold/mini-mes.c: Likewise.
* scaffold/t.c: Likewise.
* scaffold/tiny-mes.c: Likewise.
* src/gc.c: Likewise.
* src/lib.c: Likewise.
* src/math.c: Likewise.
* src/mes.c: Likewise.
* src/posix.c: Likewise.
* src/reader.c: Likewise.

3 years agomescc: Support list of initializers.
Jan Nieuwenhuizen [Wed, 3 May 2017 06:09:19 +0000 (08:09 +0200)]
mescc: Support list of initializers.

* module/language/c99/compiler.mes (ast->info): Support list of initializers.

3 years agomescc: Basic printf support.
Jan Nieuwenhuizen [Tue, 2 May 2017 15:00:07 +0000 (17:00 +0200)]
mescc: Basic printf support.

* module/mes/libc-i386.mes (i386:va-arg): New function.
* module/mes/libc-i386.scm (mes): Export it.
* module/mes/libc.mes (printf): New function.
  (libc): Add it.
* libc/include/stdio.h: New file.
* module/language/c99/compiler.mes (c99-input->ast): Add libc/include
  to include path.
  (ast-info): Handle (skip) ellipsis in function declaration.

3 years agoguix: Update from Guix.
Jan Nieuwenhuizen [Tue, 2 May 2017 14:58:56 +0000 (16:58 +0200)]
guix: Update from Guix.

* guix.scm: Use version from Guix.
* make/install.make (update-hash): Update version for new Guix meme.

3 years agomake: Recompile .go too when included mes is touched.
Jan Nieuwenhuizen [Tue, 2 May 2017 14:56:14 +0000 (16:56 +0200)]
make: Recompile .go too when included mes is touched.

* build-aux/compile-all.scm (scm->mes): New function.
  (file-needs-compilation?): Use it to hackishly respect (include-[from-path] "<>.mes")

3 years agobuild: Resolve MODULEDIR confusion. Fixes mes installation.
Jan Nieuwenhuizen [Fri, 5 May 2017 20:13:01 +0000 (22:13 +0200)]
build: Resolve MODULEDIR confusion.  Fixes mes installation.

* make/install.make (GUILEDIR): New variable.  Was MODULEDIR.
  (MODULEDIR): Mes' module dir.
* guile/mescc.scm: Update.
* src/mes.c (load_env, bload_env): Update.

3 years agoguix hash: 01m8n7zk4f1ryd61dj589zarx09vbi7fc5f8m1x5zfk6r7l0zja2
Jan Nieuwenhuizen [Tue, 2 May 2017 12:08:59 +0000 (14:08 +0200)]
guix hash: 01m8n7zk4f1ryd61dj589zarx09vbi7fc5f8m1x5zfk6r7l0zja2

3 years agoguix.scm: Remove erroneous system restriction.
Jan Nieuwenhuizen [Thu, 27 Apr 2017 12:04:51 +0000 (14:04 +0200)]
guix.scm: Remove erroneous system restriction.

* guix.scm (mes): Remove second erroneous system restriction.

3 years agoRelease 0.5. v0.5
Jan Nieuwenhuizen [Sun, 25 Dec 2016 14:51:53 +0000 (15:51 +0100)]
Release 0.5.

* configure (VERSION): Bump.

3 years agobootstrap: Regenerate.
Jan Nieuwenhuizen [Thu, 27 Apr 2017 10:07:26 +0000 (12:07 +0200)]
bootstrap: Regenerate.

* module/mes/read-0-32.mo: Regenerate.

3 years agodoc: Release update.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 15:01:29 +0000 (17:01 +0200)]
doc: Release update.

* AUTHORS: Mention Nyacc and GuixSD.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.5 New file.
* HACKING: Add pointers, update TODO/DONE.

3 years agobootstrap: Regenerate.
Jan Nieuwenhuizen [Tue, 25 Apr 2017 18:20:10 +0000 (20:20 +0200)]
bootstrap: Regenerate.

* mes.mes: Regenerate.

3 years agomescc: Parse mlibc early, show progress.
Jan Nieuwenhuizen [Mon, 24 Apr 2017 17:09:54 +0000 (19:09 +0200)]
mescc: Parse mlibc early, show progress.

* module/mes/libc.mes (_start, strlen, getchar, assert_fail, ungetc,
  putchar, fputc, eputs, fputs, puts, strcmp, itoa, isdigit, atoi,
  malloc, realloc, strncmp, c:getenv): Change to function, add
  progress.  Update callers.
* module/language/c99/compiler.mes (c99-input->info): Compile libc separately.
* guile/mescc.scm: Update progress.
* scripts/mescc.mes: Update progress.

3 years agobootstrap: Regenerate.
Jan Nieuwenhuizen [Tue, 25 Apr 2017 04:43:20 +0000 (06:43 +0200)]
bootstrap: Regenerate.

* mes.mes: Regenerate.

3 years agocore: Set argv for mescc too.
Jan Nieuwenhuizen [Mon, 24 Apr 2017 05:22:04 +0000 (07:22 +0200)]
core: Set argv for mescc too.

* src/mes.c (main)[!__MESC__]: Remove branch.

3 years agobootstrap: Regenerate.
Jan Nieuwenhuizen [Mon, 24 Apr 2017 05:16:18 +0000 (07:16 +0200)]
bootstrap: Regenerate.

* mes.mes: Regenerate.

3 years agomescc: Avoid duplication of globals.
Jan Nieuwenhuizen [Sun, 23 Apr 2017 11:53:36 +0000 (13:53 +0200)]
mescc: Avoid duplication of globals.

* module/language/c99/compiler.mes (globals:add-string): New function.
  (expr->arg): Use it to avoid globals duplication.
  (expr->accu): Do not pre-add globals.

3 years agomescc: Fix global creation in AND/OR clause.
Jan Nieuwenhuizen [Sun, 23 Apr 2017 11:53:08 +0000 (13:53 +0200)]
mescc: Fix global creation in AND/OR clause.

* module/language/c99/compiler.mes (test->jump->info): Retain globals
  created in AND/OR test.

3 years agocore: Move some debugging to MES_DEBUG=2.
Jan Nieuwenhuizen [Mon, 17 Apr 2017 21:32:02 +0000 (23:32 +0200)]
core: Move some debugging to MES_DEBUG=2.

* module/mes/base-0.mes (load): Add ;;;.
* src/gc.c (gc_flip): Test on g_debug > 1.
  (gc): Likewise.
* src/mes.c (mes_builtins): Likewise.
  (main): Likewise.
* src/reader.c (dump): Likewise.

3 years agomescc: Add atoi.
Jan Nieuwenhuizen [Mon, 17 Apr 2017 21:29:54 +0000 (23:29 +0200)]
mescc: Add atoi.

* libc/mlibc.c (atoi): New function.
* module/mes/libc.mes (atoi): New function.
  (libc): Add it.

3 years agomescc: Add getenv.
Jan Nieuwenhuizen [Mon, 17 Apr 2017 00:24:20 +0000 (02:24 +0200)]
mescc: Add getenv.

* module/mes/libc-i386.mes (i386:_start): Push environment pointer.
* module/mes/libc.mes (g_environment): New global.
  (_env): New function.
  (_start): Use it to set g_environment.
  (getenv): New function.
* lib/mlibc.c (strncmp): New function.
  (getenv): Implement.
* lib/mstart.c (_start): Set g_environment.
* module/mes/libc.mes (strncmp): New function.
  (libc): Add it.
* scaffold/t.c: (array_ref): Test it.

3 years agomescc: Support pointer arrays and some arithmetic.
Jan Nieuwenhuizen [Mon, 17 Apr 2017 00:15:11 +0000 (02:15 +0200)]
mescc: Support pointer arrays and some arithmetic.

* module/language/c99/compiler.mes (.name): Support **; handle type size.
  (.statements): Likewise.
  (push-local-de-ref): Likewise.
  (push-ident-de-ref): Likewise.
  (expr->arg): Likewise.
  (ident->accu):  Likewise.
  (base->ident-address):  Likewise.
  (ident-add): Likewise.
  (expr->accu):  Likewise.
  (decl->type):  Likewise.
  (formal->text):  Likewise.
  (int->global, ident-address->accu, ident-address->base): New functions.
  (ast->info): Support *, *[] ** declarations.
  (push-local-de-de-ref,  push-ident-de-de-ref): New functions.
* module/mes/as-i386.mes (i386:push-byte-local-de-ref): Rename from
  i386:push-local-de-ref.  Update callers.
  (i386:push-local-de-ref, i386:push-byte-local-de-de-ref,
  i386:accu-mem-add): New functions.
* module/mes/as-i386.scm (mes): Export them.
* scaffold/t.c (array_test): Test it.

3 years agobootstrap: Regenerate.
Jan Nieuwenhuizen [Tue, 25 Apr 2017 21:18:29 +0000 (23:18 +0200)]
bootstrap: Regenerate.

* mes.mes: Regenerate.
* module/mes/read-0-32.mo: Regenerate.

3 years agoAdd access?
Jan Nieuwenhuizen [Sun, 16 Apr 2017 07:51:45 +0000 (09:51 +0200)]
Add access?

* libc/mlibc.c (access): New function.
* module/mes/libc-i386.mes (i386:access): New function.
  (i386:libc): Add it.
* src/posix.c (access_p): New function.
* module/mes/posix.mes: New file.
* module/mes/base-0.mes (mes): Include it.
* module/mes/read-0-32.mo: Regenerate.

3 years agobootstrap: Regenerate
Jan Nieuwenhuizen [Tue, 25 Apr 2017 21:44:23 +0000 (23:44 +0200)]
bootstrap: Regenerate

* module/mes/read-0-32.mo: Regenerate.

3 years agobuild: Refactor.
Jan Nieuwenhuizen [Wed, 12 Apr 2017 19:27:59 +0000 (21:27 +0200)]
build: Refactor.

* GNUmakefile (OUT,QUIET,SUBDIRS): New variables.
  include make/common.make
* .gitignore: Remove toplevel targets.
* build-aux/compile-all.scm: Import from GNU Guix.
* configure (gulp-pipe): Check exit status.  Actually test for CC,
  CC32.
* make/bin.make: New file.
* make/check.make: New file.
* make/clean.make: New file.
* make/common.make: New file.
* make/compile.make: New file.
* make/guile.make: New file.
* make/mescc-guile.make: New file.
* make/mescc-mes.make: New file.
* make/reset.make: New file.
* lib/mlibc.c: Rename from top.
* lib/start.c: Rename from top.
* module/module.make: New file.
* scaffold/scaffold.make: New file.
* scripts/scripts.make: New file.
* src/mes.c: Rename from top.
* src/src.make: New file.
* src/mes.c: Rename from top.
* src/gc..c: Rename from top.
* src/lib.c: Rename from top.
* src/posix.c: Rename from top.
* src/reader.c: Rename from top.
* src/vector.c: Rename from top.
* tests/tests.make: New file.

3 years agoRemove gc scaffolding.
Jan Nieuwenhuizen [Sat, 15 Apr 2017 14:50:03 +0000 (16:50 +0200)]
Remove gc scaffolding.

* tests/gc-0.test: Remove.
* tests/gc-1.test: Remove.
* tests/gc-2.test: Remove.
* tests/gc-2a.test: Remove.
* tests/gc-3.test: Remove.
* tests/gc-4.test: Remove.
* tests/gc-5.test: Remove.
* tests/gc-6.test: Remove.
* tests/gc.test:Remove.

3 years agomescc: Add fsync.
Jan Nieuwenhuizen [Sat, 15 Apr 2017 13:13:38 +0000 (15:13 +0200)]
mescc: Add fsync.

* module/mes/libc-i386.mes (i386:fsync): New function.
  (i386:libc): Export it.
* mlibc.c (fsync): New function.

3 years agocore/mini-mes: Merge merge mes.c and mini-mes.c.
Jan Nieuwenhuizen [Mon, 10 Apr 2017 17:13:20 +0000 (19:13 +0200)]
core/mini-mes: Merge merge mes.c and mini-mes.c.

* mes.c:
* scaffold/mini-mes.c:
* gc.c:
* GNUmakefile:

3 years agomescc: Allow usage of const by ignoring.
Jan Nieuwenhuizen [Mon, 10 Apr 2017 06:06:33 +0000 (08:06 +0200)]
mescc: Allow usage of const by ignoring.

* module/language/c99/compiler.mes (ast->info): Support const
  declarations (by ignoring them).
* lib.c (display_helper)[!__GNUC__]: Remove branch.
* posix.c (write_byte)[!__GNUC__]: Likewise.

3 years agoHACKING: Removed __MESC__ workarounds.
Jan Nieuwenhuizen [Mon, 10 Apr 2017 05:54:38 +0000 (07:54 +0200)]
HACKING: Removed __MESC__ workarounds.

* HACKING: Update pointer.

3 years agomescc: Support break in while.
Jan Nieuwenhuizen [Mon, 10 Apr 2017 04:59:50 +0000 (06:59 +0200)]
mescc: Support break in while.

* module/language/c99/compiler.mes (make): Add break field.
  (.break): New function.
  (clone): Support break field.
  (ast->info): Support break.
* scaffold/t.c (test): Test it.
* scaffold/mini-mes.c (lookup_symbol_): Use it; remove goto workaround.

3 years agomescc: Refactor switch.
Jan Nieuwenhuizen [Sun, 9 Apr 2017 04:52:39 +0000 (06:52 +0200)]
mescc: Refactor switch.

* module/language/c99/compiler.mes (case->jump-info): Refactor.
  Support multiple case statements.
* scaffold/t.c (swits): Test it.
* lib.c (display_helper)[__NYACC__]: Remove branch.

3 years agomini-mes: Merge with mes.c: lib.c, math.c, posix.c.
Jan Nieuwenhuizen [Sat, 8 Apr 2017 13:01:24 +0000 (15:01 +0200)]
mini-mes: Merge with mes.c: lib.c, math.c, posix.c.

* mes.c: Include math.c after posix.c.
  (assert_defined, check_formals, check_apply, load_env,
  bload_env): Move from lib.c
* scaffold/mini-mes.c: Include mini-lib.h, lib.c., mini-math.h,
  math.c, mini-posix.h, posix.c.
  (greater_p, less_p, is_p, minus, plus, divide, modulo, multiply,
  logior, ash): Remove.
  (ungetchar, peekchar, peek_byte, read_byte, write_byte,
  string_to_cstring, getenv_, open_input_file, current_input_port,
  set_current_input_port, force_output): Remove.
  (mes_builtins): include mini-lib.i, mini-lib.environment.i.
  mini-math.i, mini-math.environment.i mini-posix.i,
  mini-posix.environment.i.
* GNUmakefile (guile-mini-mes): Add dependencies.

3 years agomescc: Refactor assignment.
Jan Nieuwenhuizen [Sat, 8 Apr 2017 04:31:12 +0000 (06:31 +0200)]
mescc: Refactor assignment.

* module/language/c99/compiler.mes (expr->accu): Refactor assignment.
  Support multiple operators.
* scaffold/t.c (math_test): Test it.
* scaffold/mini-mes.c (minus, divide, modulo, multiply,
  logior)[!__GNUC__]: Remove branch.

3 years agomescc: Factor-out array-ref.
Jan Nieuwenhuizen [Fri, 7 Apr 2017 21:06:09 +0000 (23:06 +0200)]
mescc: Factor-out array-ref.

* module/language/c99/compiler.mes: Factor-out array-ref.

3 years agomescc: Refactor expr->base.
Jan Nieuwenhuizen [Fri, 7 Apr 2017 12:41:47 +0000 (14:41 +0200)]
mescc: Refactor expr->base.

* module/language/c99/compiler.mes (expr->base): Rename from
  expr->+base.  Use throughout.

3 years agomescc: Refactor binary operators.
Jan Nieuwenhuizen [Fri, 7 Apr 2017 12:31:35 +0000 (14:31 +0200)]
mescc: Refactor binary operators.

* module/language/c99/compiler.mes (binop->accu): Rename from
  compare->accu.  Update callers.
  (expr->accu): Use it for binary operators.
* scaffold/t.c (math_test): Test it.

3 years agomescc: Factor-out append-text.
Jan Nieuwenhuizen [Fri, 7 Apr 2017 07:53:56 +0000 (09:53 +0200)]
mescc: Factor-out append-text.

* module/language/c99/compiler.mes: Use append-text throughout.

3 years agomescc: Factor-out wrap-as.
Jan Nieuwenhuizen [Fri, 7 Apr 2017 07:36:30 +0000 (09:36 +0200)]
mescc: Factor-out wrap-as.

* module/language/c99/compiler.mes (wrap-as): Rename from wrap.  Use throughout.

3 years agomescc: Refactor comparisons.
Jan Nieuwenhuizen [Fri, 7 Apr 2017 05:06:35 +0000 (07:06 +0200)]
mescc: Refactor comparisons.

* module/language/c99/compiler.mes (compare->accu, append-text, wrap):
  New functions.
  (expr->accu): Use them to implement construct like 1 == inc (0).
* scaffold/t.c (math_test): Test them.

3 years agoHACKING: Removed gc.c, vector.c mescc workarounds.
Jan Nieuwenhuizen [Thu, 6 Apr 2017 21:15:59 +0000 (23:15 +0200)]
HACKING: Removed gc.c, vector.c mescc workarounds.

* HACKING: Update pointer and recipe.

3 years agomescc: Refactor array ref.
Jan Nieuwenhuizen [Thu, 6 Apr 2017 21:05:44 +0000 (23:05 +0200)]
mescc: Refactor array ref.

* module/language/c99/compiler.mes (expr->accu, expr->accu*): Remove
  duplication, use expression as array index.
* scaffold/t.c (struct_test): Test it.
* vector.c (vector_length, list_to_vector)[!__GNUC__]: Remove branch.

3 years agomescc: Refactor expressions.
Jan Nieuwenhuizen [Thu, 6 Apr 2017 07:12:50 +0000 (09:12 +0200)]
mescc: Refactor expressions.

* module/language/c99/compiler.mes (expr->accu, ast->info): Remove
  duplication, separate concerns.

3 years agomescc: Refactor pre/post inc/dec.
Jan Nieuwenhuizen [Wed, 5 Apr 2017 21:05:16 +0000 (23:05 +0200)]
mescc: Refactor pre/post inc/dec.

* module/language/c99/compiler.mes: Refactor pre/post inc/dec.

3 years agobootstrap: Regenerate.
Jan Nieuwenhuizen [Wed, 5 Apr 2017 20:43:41 +0000 (22:43 +0200)]
bootstrap: Regenerate.

* mes-mini-mes: Regenerate.
* module/mes/read-0-32.mes: Regenerate.

3 years agomescc: function call.
Jan Nieuwenhuizen [Wed, 5 Apr 2017 18:11:13 +0000 (20:11 +0200)]
mescc: function call.

* module/language/c99/compiler.mes (expr->accu): Move function call
  from ast->info.

3 years agomescc: Support expression as lhs array index.
Jan Nieuwenhuizen [Wed, 5 Apr 2017 12:24:34 +0000 (14:24 +0200)]
mescc: Support expression as lhs array index.

* module/language/c99/compiler.mes (expr->accu): Treat array index as expression.
* scaffold/t.c (struct_test): Test it.
* gc.c (gc_copy)[!__GNUC__]: Remove branch.
* vector.c (list_to_vector)[!__GNUC__]: Likewise.

3 years agomescc: Remove duplication.
Jan Nieuwenhuizen [Tue, 4 Apr 2017 12:37:17 +0000 (14:37 +0200)]
mescc: Remove duplication.

* module/language/c99/compiler.mes (expr->arg): Use expr->accu for
  most expressions.

3 years agoscripts: Support --help, --version.
Jan Nieuwenhuizen [Tue, 4 Apr 2017 07:53:05 +0000 (09:53 +0200)]
scripts: Support --help, --version.

* guile/mescc.scm: Support --help, --version.
* scripts/mescc.mes: Likewise.
* scripts/repl.mes: Likewise.

3 years agoscm: Do not quote list of strings.
Jan Nieuwenhuizen [Mon, 3 Apr 2017 05:19:38 +0000 (07:19 +0200)]
scm: Do not quote list of strings.

* module/mes/display.mes (display): Check value of write?, fixes
  quoting display string.

3 years agomescc: Do not return ELF text.
Jan Nieuwenhuizen [Mon, 3 Apr 2017 05:09:03 +0000 (07:09 +0200)]
mescc: Do not return ELF text.

* module/language/c99/compiler.mes (info->exe): Do not return ELF text.

3 years agobuild: Update Guix build and install.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 16:50:07 +0000 (18:50 +0200)]
build: Update Guix build and install.

* guix.scm (%source-dir): New variable.
  (git-file?): New function.
  (mes): Use them to simplify building/installing from git.
* make/install.make (READMES): Add INSTALL, README.
* (install): Install mescc.scm and read-0-32.mo.

3 years agobootstrap: Regenerate.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 10:41:33 +0000 (12:41 +0200)]
bootstrap: Regenerate.

* mes-mini-mes: First self-hosting binary.

3 years agoHACKING: scripts/mescc.mes scaffold/mini-mes runs.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 11:27:00 +0000 (13:27 +0200)]
HACKING: scripts/mescc.mes scaffold/mini-mes runs.

* HACKING: Update pointer and recipe.

3 years agomini-mes: Fix for assq.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 11:18:22 +0000 (13:18 +0200)]
mini-mes: Fix for assq.

* scaffold/mini-mes.c (assq): Use eq_p iso ==.  Fixes
  tests/display.test ("write alarm").

3 years agocore: Use 0.25% safety region.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 10:58:18 +0000 (12:58 +0200)]
core: Use 0.25% safety region.

* gc.c (gc_up_arena): Up GC_SAFETY too.
* scripts/repl.mes: Remove MES_ARENA override.

3 years agobootstrap: Regenerate.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 11:21:01 +0000 (13:21 +0200)]
bootstrap: Regenerate.

* module/mes/read-0-32.mo: Regenerate.

3 years agocore: Remove append.
Jan Nieuwenhuizen [Sun, 2 Apr 2017 06:05:55 +0000 (08:05 +0200)]
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.