Jan Nieuwenhuizen
25c4acef82
mescc: Support -l none (linking without libc).
...
* module/mescc/mescc.scm (mescc:link): Support -l none.
2018-08-15 17:46:03 +02:00
Jan Nieuwenhuizen
7318e9079e
mescc: Support -o-.
...
* module/mescc/mescc.scm (GUILE-with-output-to-file): New variable.
(with-output-to-file): Use it in redefined function.
2018-08-14 10:58:02 +02:00
Jan Nieuwenhuizen
56cd6d58ca
check: Fix 4f-string-split.scm for Guile.
...
* module/mes/guile.scm (core:car, core:make-cell): New function.
Fixes scaffold/boot/4f-string-split.scm.
2018-08-09 09:44:54 +02:00
Jan Nieuwenhuizen
f18e1fea36
build: Make build more autotools-like.
...
* build-aux/build.sh.in: Move from ./build.sh
* build-aux/check.sh.in: Likewise.
* build-aux/GNUmakefile.in: Likewise.
* build-aux/install.sh.in: Likewise.
* build-aux/uninstall.sh.in: Likewise.
* configure: Substitute them.
* configure.sh: Likewise.
* build-aux/build-cc.sh: Update: use ${srcdest} instead of ${top_builddest}.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* build-aux/check-boot.sh: Likewise.
* build-aux/check-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/config.sh: Likewise.
* build-aux/export.make: Likewise.
* build-aux/mes-snarf.scm: Likewise.
* build-aux/pre-inst-env.in: Likewise.
* build-aux/test.sh: Likewise.
* build-aux/trace.sh: Likewise.
* module/mescc/mescc.scm: Likewise.
* scripts/mescc.in: Likewise.
* src/mes.c: Likewise.
* .gitignore: Likewise.
2018-07-25 08:14:13 +02:00
Jan Nieuwenhuizen
a2d54958ff
Relicense some taken-from-GNU Guile LGPLv2+ files to GPLv3+.
...
* mes/module/mes/pretty-print.scm: Relicense to GPLv3+.
* mes/module/mes/psyntax.ss: Likewise.
* mes/module/srfi/srfi-1.scm: Likewise.
* mes/module/srfi/srfi-16.scm: Likewise.
* mes/module/srfi/srfi-26.scm: Likewise.
* module/mes/getopt-long.scm: Likewise.
2018-07-23 19:11:45 +02:00
Jan Nieuwenhuizen
72cb975213
GNU Mes.
...
Throughout, make these changes
Copyright headers: GNU Mes
First mention of name: GNU Mes
Website: https://www.gnu.org/software/mes
Git: git://git.savannah.gnu.org/mes.git
2018-07-22 14:24:36 +02:00
Jan Nieuwenhuizen
53c0941937
guix: Refactor package setup.
...
Next to the convenient environment setup and package build from git
guix environment -l .guix.scm
guix build -f .guix.scm
we can now also build other included packages
GUIX_PACKAGE_PATH=guix guix build mes@0.17
GUIX_PACKAGE_PATH=guix guix build nyacc@0.80.42
* guix/git/mes.scm: Move from .guix.scm, make a module.
* .guix.scm: Move from guix.scm, use it.
* build-aux/manifest.scm: Update location.
* build-aux/pre-inst-env.in: Support it.
* configure: Check for guix.
* build-aux/export.make: Export GUIX.
* GNUmakefile (update-hash): New target.
2018-07-22 08:41:48 +02:00
Jan Nieuwenhuizen
4203a427d0
build: Support --srcdir build.
...
* build-aux/config.sh: New file.
* build-aux/trace.sh: New file.
* build-aux/GNUmakefile.in: New file.
* configure: Support srcdir configure.
* GNUmakefile: Support srcdir build.
* build-aux/build-cc.sh: Likewise.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* build-aux/check-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/export.make: Likewise.
* build-aux/mes-snarf.scm: Likewise.
* build-aux/pre-inst-env.in: Likewise.
* build-aux/test.sh: Likewise.
* build.sh: Likewise.
* check.sh: Likewise.
* install.sh: Likewise.
* module/mescc/mescc.scm: Likewise.
* scripts/mescc.in: Likewise.
* src/mes.c: Likewise.
2018-07-22 00:43:39 +02:00
Jan Nieuwenhuizen
87269a16f6
core: Document number->string INT-MIN failure with gcc-x86.
...
* src/mes.c (scm_symbol_arch, scm_symbol_compiler): New symbol.
(mes_symbols, bload_env): Add them.
(scm_symbol_gnuc, scm_symbol_mesc): Remove.
* scaffold/mini-mes.c: Likewise.
* module/mes/mes-0.scm (%arch, %compiler): New public variable.
* tests/srfi-13.test: Expect number->string INT-MIN to fail for
gcc-x86.
* HACKING (Bugs): Add it.
2018-07-21 15:20:01 +02:00
Jan Nieuwenhuizen
4f2c685753
build: Refactor mes tests.
...
* build-aux/check-mes.sh: New file.
* check.sh: Invoke it for Guile and Mes.
* .gitignore: Ignore new guile logs.
* mes/module/mes/boot-0.scm: Ignore some standard Guile options.
* module/mes/test.scm: Make a module.
* tests/base.test: Use it. Make a module, support invoking with Guile
or Mes alike.
* tests/boot.test: Likewise.
* tests/catch.test: Likewise.
* tests/closure.test: Likewise.
* tests/cwv.test: Likewise.
* tests/display.test: Likewise.
* tests/fluids.test: Likewise.
* tests/getopt-long.test: Likewise.
* tests/guile.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/pmatch.test: Likewise.
* tests/psyntax.test: Likewise.
* tests/quasiquote.test: Likewise.
* tests/read.test: Likewise.
* tests/scm.test: Likewise.
* tests/srfi-13.test: Likewise.
* tests/srfi-14.test: Likewise.
* tests/srfi-16.test: Likewise.
* tests/srfi-1.test: Likewise.
* tests/srfi-43.test: Likewise.
* tests/srfi-9.test: Likewise.
* tests/syntax.test: Likewise.
* tests/vector.test: Likewise.
* tests/base.test-guile: Remove.
* tests/boot.test-guile: Remove.
* tests/catch.test-guile: Remove.
* tests/closure.test-guile: Remove.
* tests/cwv.test-guile: Remove.
* tests/display.test-guile: Remove.
* tests/fluids.test-guile: Remove.
* tests/getopt-long.test-guile: Remove.
* tests/guile.test-guile: Remove.
* tests/let-syntax.test-guile: Remove.
* tests/let.test-guile: Remove.
* tests/match.test-guile: Remove.
* tests/math.test-guile: Remove.
* tests/module.test-guile: Remove.
* tests/optargs.test-guile: Remove.
* tests/peg.test-guile: Remove.
* tests/pmatch.test-guile: Remove.
* tests/psyntax.test-guile: Remove.
* tests/quasiquote.test-guile: Remove.
* tests/read.test-guile: Remove.
* tests/scm.test-guile: Remove.
* tests/srfi-13.test-guile: Remove.
* tests/srfi-14.test-guile: Remove.
* tests/srfi-16.test-guile: Remove.
* tests/srfi-1.test-guile: Remove.
* tests/srfi-43.test-guile: Remove.
* tests/srfi-9.test-guile: Remove.
* tests/syntax.test-guile: Remove.
* tests/vector.test-guile: Remove.
2018-07-21 13:48:50 +02:00
Jan Nieuwenhuizen
d9df00290c
mescc: Support verbose int types.
...
* module/mescc/compile.scm (i386:type-alist): Support verbose int types.
2018-07-21 12:02:16 +02:00
Jan Nieuwenhuizen
542289a3c6
build: Separate Mes and Guile modules.
...
* scaffold/gc.scm: Move from guile/gc.scm.
* guile/: Remove.
* module/language/paren.mes: Remove.
* mes/module/mes/base.mes: Move from module/mes/.
* mes/module/mes/boot-0.scm: Likewise.
* mes/module/mes/boot-00.scm: Likewise.
* mes/module/mes/boot-01.scm: Likewise.
* mes/module/mes/boot-02.scm: Likewise.
* mes/module/mes/catch.mes: Likewise.
* mes/module/mes/display.mes: Likewise.
* mes/module/mes/fluids.mes: Likewise.
* mes/module/mes/getopt-long.mes: Likewise.
* mes/module/mes/guile.mes: Likewise.
* mes/module/mes/lalr.mes: Likewise.
* mes/module/mes/lalr.scm: Likewise.
* mes/module/mes/let.mes: Likewise.
* mes/module/mes/match.mes: Likewise.
* mes/module/mes/match.scm: Likewise.
* mes/module/mes/mescc.mes: Likewise.
* mes/module/mes/misc.mes: Likewise.
* mes/module/mes/module.mes: Likewise.
* mes/module/mes/optargs.mes: Likewise.
* mes/module/mes/optargs.scm: Likewise.
* mes/module/mes/peg.mes: Likewise.
* mes/module/mes/peg/cache.scm: Likewise.
* mes/module/mes/peg/codegen.scm: Likewise.
* mes/module/mes/peg/simplify-tree.scm: Likewise.
* mes/module/mes/peg/string-peg.scm: Likewise.
* mes/module/mes/peg/using-parsers.scm: Likewise.
* mes/module/mes/pmatch.mes: Likewise.
* mes/module/mes/pmatch.scm: Likewise.
* mes/module/mes/posix.mes: Likewise.
* mes/module/mes/pretty-print.mes: Likewise.
* mes/module/mes/pretty-print.scm: Likewise.
* mes/module/mes/psyntax-0.mes: Likewise.
* mes/module/mes/psyntax-1.mes: Likewise.
* mes/module/mes/psyntax.mes: Likewise.
* mes/module/mes/psyntax.pp: Likewise.
* mes/module/mes/psyntax.ss: Likewise.
* mes/module/mes/quasiquote.mes: Likewise.
* mes/module/mes/quasisyntax.mes: Likewise.
* mes/module/mes/quasisyntax.scm: Likewise.
* mes/module/mes/repl.mes: Likewise.
* mes/module/mes/scm.mes: Likewise.
* mes/module/mes/syntax.mes: Likewise.
* mes/module/mes/syntax.scm: Likewise.
* mes/module/mes/test.mes: Likewise.
* mes/module/mes/tiny-0.mes: Likewise.
* mes/module/mes/type-0.mes: Likewise.
* mes/module/mescc/M1.mes: Likewise.
* mes/module/mescc/as.mes: Likewise.
* mes/module/mescc/bytevectors.mes: Likewise.
* mes/module/mescc/compile.mes: Likewise.
* mes/module/mescc/i386/as.mes: Likewise.
* mes/module/mescc/info.mes: Likewise.
* mes/module/mescc/mescc.mes: Likewise.
* mes/module/mescc/preprocess.mes: Likewise.
* mes/module/nyacc/lalr.mes: Likewise.
* mes/module/nyacc/lang/c99/cpp.mes: Likewise.
* mes/module/nyacc/lang/c99/parser.mes: Likewise.
* mes/module/nyacc/lang/c99/pprint.mes: Likewise.
* mes/module/nyacc/lang/calc/parser.mes: Likewise.
* mes/module/nyacc/lang/util.mes: Likewise.
* mes/module/nyacc/lex.mes: Likewise.
* mes/module/nyacc/parse.mes: Likewise.
* mes/module/nyacc/util.mes: Likewise.
* mes/module/rnrs/arithmetic/bitwise.mes: Likewise.
* mes/module/srfi/srfi-0.mes: Likewise.
* mes/module/srfi/srfi-1.mes: Likewise.
* mes/module/srfi/srfi-1.scm: Likewise.
* mes/module/srfi/srfi-13.mes: Likewise.
* mes/module/srfi/srfi-14.mes: Likewise.
* mes/module/srfi/srfi-16.mes: Likewise.
* mes/module/srfi/srfi-16.scm: Likewise.
* mes/module/srfi/srfi-26.mes: Likewise.
* mes/module/srfi/srfi-26.scm: Likewise.
* mes/module/srfi/srfi-43.mes: Likewise.
* mes/module/srfi/srfi-8.mes: Likewise.
* mes/module/srfi/srfi-9.mes: Likewise.
* mes/module/srfi/srfi-9/gnu.mes: Likewise.
* mes/module/sxml/xpath.mes: Likewise.
* mes/module/sxml/xpath.scm: Likewise.
* module/mes/mes-0.scm: Likewise.
* build-aux/build-guile.sh: Update for new layout.
* build-aux/build-mes.sh: Likewise.
* build-aux/check-boot.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* install.sh: Likewise.
* scaffold/boot/51-module.scm: Likewise.
* scaffold/boot/52-define-module.scm: Likewise.
* scripts/mescc: Likewise.
* src/mes.c: Likewise.
* tests/base.test-guile: Likewise.
* tests/boot.test: Likewise.
* tests/srfi-9.test: Likewise.
* mes/include: New symlink.
* mes/lib: New symlink.
* AUTHORS: Update file names.
2018-07-21 07:15:52 +02:00
Jan Nieuwenhuizen
69813a6da3
build: Support Debian build, install.
...
* scripts/mescc: Support Debian build, install.
* lib/libmes.c (fdgetc): Allow Nyacc/ungetc conflict.
* build-aux/export.make (ARCH): Export.
* build-aux/build-mes.sh: Disable full build for non-bootstrap
x86-only.
* check.sh (total): Use bash to invoke build-aux/check-mescc.sh.
* build-aux/build-guile.sh (SCM_FILES): Support guile-2.0.
* module/mes/guile.scm (guile-2.0): Support guile-2.0.
* build-aux/build-mes.sh: Use bash.
* build-aux/setup-mes.sh: New file.
2018-07-12 22:29:59 +02:00
Jan Nieuwenhuizen
a25653e7f1
mescc: Be sure to exit upon system* failure.
...
* module/mescc/mescc.scm (assert-system*): New function.
(M1->hex2, hex2->elf, M1->blood-elf): Use it.
2018-07-12 22:29:59 +02:00
Jan Nieuwenhuizen
a27770389e
Update for mescc-tools-0.5.
...
* build-aux/build-mes.sh (HEX2FLAGS): Remove = from flags.
* build.sh (HEX2FLAGS): Likewise.
* module/mescc/mescc.scm (hex2->elf): Likewise.
2018-06-16 06:38:05 +02:00
Jan Nieuwenhuizen
f1efaa0e93
mescc: Support binutils-2.5.1.
...
* include/stdint.h: #undef types before typedef'ing them.
* include/sys/types.h: Likewise.
* include/string.h (NULL): New define.
* include/stdio.h (BUFSIZ): New define.
2018-05-30 21:55:39 +02:00
Jan Nieuwenhuizen
272b522962
build: Use arch-dir.
...
* lib/x86-mes: Move from stage0.
* build-aux/build-cc.sh: Create libraries in lib/gcc. Update users.
* build-aux/build-mes.sh: Create libraries in lib/x86-mes. Update users.
* build-aux/build-mes-gcc.sh: Rename from build-mlibc.sh. Create
libraries in lib/x86-mes-gcc. Update callers.
* build-aux/cc-mes-gcc.sh: Rename from cc-mlibc.sh. Update callers.
2018-05-29 20:07:46 +02:00
Jan Nieuwenhuizen
a10c48735d
mescc: Posixify interface.
...
* module/mescc/compile.mes: Move from language/c99/compiler.mes.
* module/mescc: New module..
* module/mescc/M1.scm: Move from mes/M1.mes.
* module/mescc/as.scm: Likewise.
* module/mescc/bytevectors.scm: Likewise.
* module/mescc/mescc.scm: New file.
* scripts/mescc: Update to new layout and posixy interface.
* GNUmakefile: Likewise.
* build-aux/build-cc.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-mlibc.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc-mlibc.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/test.sh: Likewise.
* build.sh: Likewise.
* .gitignore: Update for posixy extensions.
2018-05-25 08:05:02 +02:00
Jan Nieuwenhuizen
2748992551
mes: Add drop, drop-right.
...
* module/srfi/srfi-1.mes (drop, drop-right): New function.
2018-05-26 20:47:33 +02:00
Jan Nieuwenhuizen
e4d0298d1b
core: Support fork, waitpid, execve.
...
* stage0/x86.M1 (SYS_fork, SYS_waitpid, SYS_execve): New define.
* lib/linux-gcc.c (fork, waitpid, execve): New function.
* lib/linux-mes.c (fork, waitpid, execve): New function.
* lib/libc.c (wait): New function.
* include/unistd.h (fork, execve): Declare.
* include/sys/wait.h (waitpid, wait): Declare.
* module/mes/posix.mes (search-path, execlp, system*, waitpid): New function.
* src/posix.c (primitive_fork, execl): New function.
2018-05-24 19:54:42 +02:00
Jan Nieuwenhuizen
2d97595147
mescc: Oops, alignment.
...
* module/mes/M1.mes (object->M1): Oops, alignment: only add alignment
when not aligned.
2018-05-27 08:20:00 +02:00
Jan Nieuwenhuizen
d717355b6c
build: Remove function declarations from M1.
...
* module/language/c99/compiler.mes (info->object): Remove function
declarations.
2018-05-27 07:12:33 +02:00
Jan Nieuwenhuizen
932b38980e
mescc: Tinycc support: Handle short struct initializer.
...
* module/language/c99/compiler.mes (array-init-element->data): Handle
short struct initializer.
2018-05-22 18:24:32 +02:00
Jan Nieuwenhuizen
029c000840
mescc: Align global data.
...
* module/mes/M1.mes (object->M1): Align globals.
2018-05-21 21:54:54 +02:00
Jan Nieuwenhuizen
f8f0aacb61
mescc: Tinycc support: workaround for tcc; this breaks: Structured type with char or short on heap.
...
* module/language/c99/compiler.mes (int->bv): Always use 32bit byte
vector.
2018-05-20 08:58:44 +02:00
Jan Nieuwenhuizen
def730d74a
mescc: Tinycc support: Structured type with char or short on heap.
...
* module/language/c99/compiler.mes (int->bv): New function.
(init->data): Use it. Add parameter. Update callers.
(array-init->data): Add type parmeter.
(array-init-element->data): Likewise.
* module/mes/bytevectors.mes (bytevector-u8-set!): New function.
* module/mes/bytevectors.scm (mes): Export it.
* module/mes/as.mes (int->bv8): New function.
2018-05-19 14:53:05 +02:00
Jan Nieuwenhuizen
bbfe7de3da
mescc: Fix size ERROR message.
...
* module/language/c99/compiler.mes (expr->accu): Fix size ERROR message.
2018-05-20 08:51:15 +02:00
Jan Nieuwenhuizen
03ba0e18df
mescc: Tinycc support: Export nested struct definitions.
...
* module/language/c99/compiler.mes (struct-field): Support nested,
named and anonymous enums.
(field->info): New function.
(type->info): Use it to reap nestedly defined enums, structs, unions.
(decl->info): Likewise.
* scaffold/tests/t.c: Test it.
2018-05-19 20:49:56 +02:00
Jan Nieuwenhuizen
b4d1c40aa8
mescc: Tinycc support: Unsigned comparison.
...
* stage0/x86.M1 (ja32, jae32, jb32, jbe32): New macro.
* module/mes/as-i386.mes (i386:jump-a, i386:jump-ae, i386:jump-b,
i386:jump-be): Use it in new function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (test-jump-label->info): Use them to
support unsigned comparison.
* scaffold/tests/7s-unsigned-compare.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-19 11:41:53 +02:00
Jan Nieuwenhuizen
4faeece057
mescc: Tinycc support: Char and short sign extend.
...
* module/mes/as-i386.mes (i386:accu*n->local, i386:byte-accu->local+n,
i386:word-accu->local+n): Remove.
(i386:byte-accu, i386:signed-byte-accu, i386:word-accu,
i386:signed-word-accu): New function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (accu->local+n-text): Simplify.
(mem->accu, convert-accu): New function.
(expr->accu): Use them.
* stage0/x86.M1 (mov____%al,0x32(%ebp), mov____%al,0x8(%ebp),
mov____%ax,0x32(%ebp), mov____%ax,0x8(%ebp), movzbl_0x32(%ebp),%eax,
movzbl_0x8(%ebp),%eax, movzwl_0x32(%ebp),%eax,
movzwl_0x8(%ebp),%eax): Deprecate.
* scaffold/tests/7r-sign-extend.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-18 23:58:10 +02:00
Jan Nieuwenhuizen
7f712e4555
mes: string->number: Support upper case hex.
...
* module/mes/scm.mes (string->number): Support upper case hex.
2018-05-21 06:51:21 +02:00
Jan Nieuwenhuizen
cfda148e1e
mescc: Tinycc support: Minimal float support.
...
* lib/libc+tcc.c (ldexp, strtod, strtof, strtold): New stub.
* include/math.h (ldexp): Declare.
* include/stdlib.h (strtod, strtof, strtold): Declare.
* module/mes/scm.mes (string->number): Minimal float support.
(inexact->exact): New function.
* tests/math.test ("string->number"): Test it.
* module/language/c99/compiler.mes (ast->type): Handle float type.
(type->info): Likewise.
(cstring->int): Rename from cstring->number. Update callers.
(cstring->float): New function.
(expr->accu): Use it.
2018-05-18 15:28:05 +02:00
Jan Nieuwenhuizen
7dfc88e22c
mescc: Tinycc support: Switch with heterogeneous body, non-last default.
...
* module/language/c99/compiler.mes (switch->info): New function.
(ast->info): Use it for switch.
(clause->info, statements->clauses): Remove.
* scaffold/tests/44-switch.c (default_first): Test it.
2018-05-17 07:40:01 +02:00
Jan Nieuwenhuizen
8f8a4be83d
mes: Support fold 3.
...
* module/srfi/srfi-1.mes (fold): Support fold 3.
2018-05-20 23:20:27 +02:00
Jan Nieuwenhuizen
345d0d8413
mescc: Tinycc support: Compound strings as function argument.
...
* module/language/c99/compiler.mes (expr->accu): Handle compound
strings as function argument.
* module/mes/M1.mes (object->M1): Call error when string not found.
* scaffold/tests/t.c: Test it.
2018-05-14 22:37:53 +02:00
Jan Nieuwenhuizen
010ab2032f
mescc: Tinycc support: Fix sizeof interesting expressions.
...
* module/language/c99/compiler.mes (ast->type): Return type for
sizeof-expr, sizeof-type.
* scaffold/tests/85-sizeof.c: Test it.
2018-05-14 20:14:42 +02:00
Jan Nieuwenhuizen
0f87473105
mescc: Tinycc support: Support bit-fields.
...
* module/language/c99/compiler.mes (struct->fields): Support bit-fields.
(ast->type):
(field-field):
(field-offset):
(expr->accu*):
(expr->accu):
(struct-field):
(->size):
* module/language/c99/info.scm (<bit-field>): New type.
* stage0/x86.M1 (and____$i32,%eax, and____(%edx),%eax,
mov____(%edx),%eax, or____(%edx),%eax): New macro.
* module/mes/as-i386.mes (i386:base-mem->accu): Use
it.
(i386:accu-and, i386:accu-and-base-mem, i386:accu-or-base-mem): New
function.
* module/mes/as-i386.scm: Export them.
* scaffold/tests/7q-bit-field.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-13 17:05:28 +02:00
Jan Nieuwenhuizen
dae4a30417
mescc: Tinycc support: Anonymous string array.
...
* module/language/c99/compiler.mes (global->info): Anonymous string
array.
(local->info): Likewise.
(array-init->string): Support array of char.
(init-local): Likewise.
(->size): Fix for array.
* scaffold/tests/4a-char-array.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-12 12:03:01 +02:00
Jan Nieuwenhuizen
e8969af4ca
mescc: Tinycc support: sizeof: Bugfix for c-array.
...
* module/language/c99/compiler.mes (->size): Bugfix for c-array.
* scaffold/tests/85-sizeof.c: Test it.
2018-05-12 11:25:35 +02:00
Jan Nieuwenhuizen
ad9f171c49
mescc: Tinycc support: Implement ((struct foo*)p)->bar.
...
* module/language/c99/compiler.mes (expr->accu*):
* scaffold/tests/7p-struct-cast.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-12 00:20:51 +02:00
Jan Nieuwenhuizen
057607ca0a
mescc: Tinycc support: Implement (foo--)->bar and permutations.
...
* module/language/c99/info.scm (clone): Add post field.
(make): Handle post parameter.
* module/language/c99/compiler.mes (clone): Handle post parameter.
(expr->accu*): Set it to support foo--/foo--.
(expr->accu): Read it to support foo--/foo--.
* scaffold/tests/7o-struct-pre-post.c: Test it.
* build-aux/check-mescc.sh: Run it.
2018-05-13 13:50:32 +02:00
Jan Nieuwenhuizen
330404125e
mescc: Tinycc support: Function addresses.
2018-05-11 19:46:26 +02:00
Jan Nieuwenhuizen
b254f12d5e
mescc: Tinycc support: Numeric constant expressions.
2018-05-11 19:27:33 +02:00
Jan Nieuwenhuizen
ec13ccc19f
mescc: Tinycc support: Function variables.
2018-05-11 18:53:54 +02:00
Jan Nieuwenhuizen
8cc406c9ff
mescc: Tinycc support: Pointer typedefs.
2018-05-11 18:36:35 +02:00
Jan Nieuwenhuizen
b42ecbd928
mescc: Tinycc support: Array typedefs.
2018-05-11 18:26:01 +02:00
Jan Nieuwenhuizen
6bcc9a91e3
mescc: Tinycc support: Sizeof struct destruct.
2018-05-11 17:13:07 +02:00
Jan Nieuwenhuizen
07e73b8f9a
mescc: Tinycc support: Anonymous union initialization.
2018-05-11 15:52:30 +02:00
Jan Nieuwenhuizen
e3a8316184
mescc: Tinycc support: Fix for ?-operator.
2018-05-11 15:13:55 +02:00
Jan Nieuwenhuizen
70cb56025f
mescc: Tinycc support: Valued function assign.
2018-05-11 13:34:45 +02:00
Jan Nieuwenhuizen
a1862f749f
mescc: Refactor type system: WIP
...
* module/language/c99/compiler.mes (): WIP
* module/language/c99/info.scm (): WIP
2018-05-10 12:40:07 +02:00
Jan Nieuwenhuizen
1b4a994b6d
mescc: Refactor type system: struct/enum fields: (name . <type>).
...
* module/language/c99/compiler.mes (struct-field): Refactor.
(field:name): Update.
(field:pointer): Update.
(field:size): Update.
(field:type): Remove.
(->size): New function.
2018-05-10 17:11:21 +02:00
Jan Nieuwenhuizen
b75dd7eca2
mescc: Refactor type system: introduce <array>, <pointer>, <var>.
...
* module/language/c99/info.scm (<array>, <pointer>, <var>): New type.
* module/language/c99/compiler.mes (ast-><type>): New function.
(ast-type): Use it.
2018-05-09 21:31:23 +02:00
Jan Nieuwenhuizen
c9ba7a619b
mescc: Refactor variable declaration.
...
* module/language/c99/compiler.mes (decl->info): Refactor.
2018-05-05 12:30:06 +02:00
Jan Nieuwenhuizen
1b8d59fd0f
mescc: Handle sizeof expression.
...
* module/language/c99/compiler.mes (expr->accu): Handle sizeof
expression.
* scaffold/tests/85-sizeof.c: Test it.
2018-05-05 00:59:31 +02:00
Jan Nieuwenhuizen
2311b8bd20
mescc: Handle struct field lists.
...
* module/language/c99/compiler.mes (struct-field): Return list of
fields. Update callers.
* scaffold/tests/84-struct-field-list.c: Test it.
* build-aux/check-mescc.sh (tests): Add it.
2018-05-05 00:14:47 +02:00
Jan Nieuwenhuizen
13edbaf4d8
mescc: Support heterogeneous variable init.
...
* module/language/c99/compiler.mes (decl->info): Support heterogeneous
variable init.
* scaffold/tests/83-heterogenoous-init.c: Test it.
* build-aux/check-mescc.sh (tests): Add it.
2018-05-04 22:38:01 +02:00
Jan Nieuwenhuizen
5fba6d1a70
mescc: Handle (Skip) global static.
...
* module/language/c99/compiler.mes (decl->info): Handle (Skip) global
static.
* scaffold/tests/48-global-static.c: Test it.
2018-05-04 20:40:04 +02:00
Jan Nieuwenhuizen
e53f55f002
mescc: Support functions in expression.
...
* module/language/c99/info.scm (<function>): New type.
* module/language/c99/compiler.mes (ast->type): Support function.
(expr->type-size): Likewise.
(expr->type): Likewise.
(expr->accu*): Likewise.
(function->info): Create <function>.
* module/mes/M1.mes (object->M1): Grok <function>.
* scaffold/tests/47-function-expression.c: Test it.
* build-aux/check-mescc.sh: Add it.
2018-05-04 13:58:27 +02:00
Jan Nieuwenhuizen
be60b3e49b
mescc: Support function-static variables.
...
* module/language/c99/info.scm (make): Add statics field.
(<global>): Add name and function fields. Update callers.
(global->string): New function.
* module/mes/M1.mes (object->M1): Update.
* module/language/c99/compiler.mes (clone): Add statics field.
(ident->accu): For <global>, use global in text (WAS: name).
(ident-address->accu): Likewise.
(ident-address->base): Likewise.
(decl-local->info): New function.
(decl->info): New function.
(ast->info): Use them.
(function->info): Keep globals in object (WAS: global:value only).
* scaffold/tests/46-function-static.c: Test it.
2018-05-04 20:45:27 +02:00
Jan Nieuwenhuizen
1cd97f1172
mes: Add unfold.
...
* module/srfi/srfi-1.mes (unfold): New function.
2018-05-20 13:04:20 +02:00
Jan Nieuwenhuizen
479a5ef7f1
mes: Add const.
...
* module/mes/scm.mes (const): New function.
* tests/scm.test ("const"): Test it.
2018-05-20 13:18:36 +02:00
Jan Nieuwenhuizen
7f0af1b46a
mes: string-join: Support optional delimiter, support grammar.
...
* module/srfi/srfi-13.mes (string-join): Support optional infix and
grammar.
* tests/srfi-13.test ("string-join"): Test it.
2018-05-16 23:31:39 +02:00
Jan Nieuwenhuizen
10bd43d222
mes: Support srfi-9-gnu.
...
* module/srfi/srfi-9/gnu.mes: New file. Support srfi-9-gnu.
* tests/srfi-9.test: Test it.
* tests/srfi-9.test-guile:
2018-05-04 12:44:05 +02:00
Jan Nieuwenhuizen
7b476693c2
core: Have core:eval expand macros.
...
* src/mes.c (core:eval-expand): Remove
(core:eval-expanded): New variable.
(eval_apply): Have core:eval expand macros; core:eval-expanded evals
expanded sexps.
2018-04-28 18:31:10 +02:00
Jan Nieuwenhuizen
1400489a94
Revert "core: Remove pmatch-car, pmatch-cdr hack."
...
This reverts commit be1e84624ea4a158173f34af923e3c4a3793412a.
2018-04-29 07:46:40 +02:00
Jan Nieuwenhuizen
c03449ac5a
core: Remove pmatch-car, pmatch-cdr hack.
...
* src/mes.c (scm_vm_eval_pmatch_car, scm_vm_eval_pmatch_cdr): Remove
(eval_apply): Remove cell_vm_eval_pmatch_car,
cell_vm_eval_pmatch_cdr hack.
(mes_symbols): Remove cell_symbol_pmatch_car, cell_symbol_pmatch_cdr.
* scaffold/mini-mes.c: Likewise.
* module/mes/guile.scm (mes): Remove pmatch-car, pmatch-cdr.
* module/mes/pmatch.scm (ppat): Use plain car, cdr.
2018-04-28 12:19:40 +02:00
Jan Nieuwenhuizen
98ccaceb25
mes: Remove debugging.
...
* module/mes/module.mes (mes-load-module-env): Remove debugging.
2018-05-02 22:52:31 +02:00
Jan Nieuwenhuizen
81ed6564cf
mescc: Use file-name as global prefix.
...
* module/mes/M1.mes (object->M1): Add file-name parameter.
2018-05-03 09:01:00 +02:00
Jan Nieuwenhuizen
f8eaebf713
mescc: Fix dumping of strings > M1_STRING_MAX.
...
* module/mes/M1.mes (object->M1): Skip opening quote.
2018-05-02 15:53:37 +02:00
Jan Nieuwenhuizen
a937d18c38
build: Simplify, drop make.scm experiment.
...
* build.sh: Rewrite.
* build-aux/build-cc.sh: New file.
* build-aux/build-mes.sh: New file.
* build-aux/build-mlibc.sh: New file.
* build-aux/cc.sh: New file.
* build-aux/cc-mes.sh: New file.
* build-aux/cc-mlibc.sh: New file.
* install.sh: Update.
* make.scm: Remove.
* guile/guix/make.scm: Remove.
* guile/guix/records.scm: Remove.
* guile/guix/shell-utilsg.scm: Remove.
2018-04-29 18:38:57 +02:00
Jan Nieuwenhuizen
1b0089111f
mes: Support -C and -L for Guile compatibility.
...
* module/mes/boot-0.scm): Support -C and -L for Guile compatibility.
Signed-off-by: Jan Nieuwenhuizen <janneke@gnu.org>
2018-04-29 19:06:11 +02:00
Jan Nieuwenhuizen
4ca4e9a6ff
mes: Support -e,--main option.
...
* module/mes/boot-0.scm: Support -e,--main option.
2018-04-29 18:37:00 +02:00
Jan Nieuwenhuizen
08d6c24263
mes: Upgrade Guile module support.
...
* module/mes/boot-0.scm (define-module): New macro with minimal Guile support.
(use-modules): New macro.
2018-04-29 18:35:22 +02:00
Jan Nieuwenhuizen
a2e9a6925c
mes: Add srfi-8.
...
* module/srfi/srfi-8.mes: New file.
2018-04-29 23:31:22 +02:00
Jan Nieuwenhuizen
8d866b6441
mes: string-join: Handle empty list.
...
* module/mes/boot-0.scm (string-join): Handle empty list.
2018-04-29 18:34:21 +02:00
Jan Nieuwenhuizen
b209378fca
mes: Add basename.
...
* module/mes/posix.mes (basename): New function.
2018-04-29 18:33:14 +02:00
Jan Nieuwenhuizen
4dfe6e00cc
mes: Add delete-duplicates.
...
* module/srfi/srfi-1.mes (delete-duplicates): New function.
2018-04-29 18:32:35 +02:00
Jan Nieuwenhuizen
75db8bed91
mes: filter-map: Handle two lists.
...
* module/srfi/srfi-1.mes (filter-map): Handle two lists, add error
when called with three or more.
2018-04-29 18:29:26 +02:00
Jan Nieuwenhuizen
56ef2f3f2d
mes: Add string-replace.
...
* module/srfi/srfi-13.mes (string-replace): New function.
* tests/srfi-13.test ("string-replace"): Test it.
2018-04-29 18:27:29 +02:00
Jan Nieuwenhuizen
563d1d92f9
mes: Add string-map.
...
* module/srfi/srfi-13.mes (string-map): New function.
* tests/srfi-13.test ("string-map"): Test it.
2018-04-29 18:26:46 +02:00
Jan Nieuwenhuizen
59d4d90a90
mes: Add string-trim, string-trim-right, string-trim-both.
...
* module/srfi/srfi-13.mes (string-trim, string-trimn-right,
string-trim-both): New function.
* tests/srfi-13.test ("string-trim"): Test it.
("string-trim-right"):
("string-trim-both"):
2018-04-29 18:24:29 +02:00
Jan Nieuwenhuizen
3c9b5f433d
mes: Add string-contains.
...
* module/srfi/srfi-13.mes (string-contains): New function.
* tests/srfi-13.test ("string-contains"): Test it.
("string-contains not"):
2018-04-29 18:21:52 +02:00
Jan Nieuwenhuizen
1f216444f6
mes: string-drop: Error on negative droppings.
...
* module/srfi/srfi-13.mes (string-drop, string-take,
string-drop-right): Error on negative droppings.
* tests/srfi-13.test ("string-drop"): Test it.
2018-04-29 18:15:04 +02:00
Jan Nieuwenhuizen
dc24a7f76f
core: Add string ports.
...
* src/mes.c (type_t): Add TPORT.
(scm_type_port): New symbol.
(PORT): New macro.
(MAKE_STRING_PORT): New macro.
(eval_apply): Handle string ports in primitive-load.
(mes_symbols): Add scm_type_port.
* src/posix.c (peekchar): Handle string ports.
(readchar): New function. Replace all getchar callers.
(unreadchar): Likewise.
* module/mes/type-0 (port?): New function.
* module/mes/guile.mes (with-input-from-file): Rewrite.
(open-input-string): Remove.
* module/mes/guile.scm (guile): Update cell types.
* src/gc.c (gc_loop): Support TPORT.
* src/lib.c (display_helper): Support TPORT.
* module/mes/display.mes (display): Support TPORT.
2018-04-29 17:48:38 +02:00
Jan Nieuwenhuizen
c20ef52f6f
mes: assq, assoc-ref: Handle non-A-LISTs.
...
* src/mes.c (assq): Return #f if A-LIST is not a list.
* module/mes/scm.mes (assoc): Likewise.
2018-04-29 16:17:07 +02:00
Jan Nieuwenhuizen
8911af4aa8
core: Use single definition rule for cell-type.
...
* src/mes.c (scm_type_char, scm_type_closure, scm_type_continuation,
scm_type_function, scm_type_keyword, scm_type_macro,
scm_type_number, scm_type_pair, scm_type_ref, scm_type_special,
scm_type_string, scm_type_symbol, scm_type_values,
scm_type_variable, scm_type_vector): New symbol.
(mes_symbols): Add them.
* module/mes/type-0.mes (<cell:char>, <cell:char>, <cell:closure>,
<cell:continuation>, <cell:function>, <cell:keyword>, <cell:macro>,
<cell:number>, <cell:pair>, <cell:ref>, <cell:special>,
<cell:string>, <cell:symbol>, <cell:values>, <cell:variable>,
<cell:vector>, <cell:broken-heart): Remove.
* module/mes/boot-0.scm: Likewise.
* module/mes/boot-01.scm: Likewise.
* module/mes/boot-02.scm: Likewise.
* scaffold/boot/20-define-quote.scm: Likewise.
* scaffold/boot/37-closure-lambda.scm: Likewise.
* scaffold/boot/38-simple-format.scm: Likewise.
* scaffold/boot/4c-quasiquote.scm:
* scaffold/boot/4e-string-split.scm: Likewise.
* scaffold/boot/51-module.scm: Likewise.
* scaffold/boot/52-define-module.scm: Likewise.
* scaffold/boot/60-let-syntax.scm: Likewise.
* module/mes/guile.scm: Add some of them.
2018-04-29 13:22:02 +02:00
Jan Nieuwenhuizen
e628b311d6
mescc: Create less garbage when dumping M1.
...
* module/mes/M1.mes (display-join): New function.
* (object->M1): Use it.
2018-04-24 07:26:27 +02:00
Jan Nieuwenhuizen
18d143aa62
core: last_pair: Move to core.
...
* src/lib.c (last_pair): New function.
* module/mes/scm.mes (last-pair): Remove.
2018-04-24 07:00:35 +02:00
Jan Nieuwenhuizen
9936aa383b
mescc: Use display for dumping M1.
...
* module/mes/M1.mes (object->M1): Use display for dumping M1.
2018-04-23 06:56:35 +02:00
Jan Nieuwenhuizen
630718f134
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.
2018-04-22 11:51:28 +02:00
Jan Nieuwenhuizen
a26eae418b
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.
2018-04-22 11:49:30 +02:00
Jan Nieuwenhuizen
d3f962c376
mes: display: Display escaped characters.
...
* module/mes/display.mes (display): Display escaped characters.
2018-04-22 20:08:38 +02:00
Jan Nieuwenhuizen
7ecec93a88
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.
2018-04-21 17:30:14 +02:00
Jan Nieuwenhuizen
0be441446e
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.
2018-04-21 13:19:54 +02:00
Jan Nieuwenhuizen
4b6d11e990
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.
2018-04-20 14:38:24 +02:00
Jan Nieuwenhuizen
3330948a90
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.
2018-04-20 13:06:00 +02:00
Jan Nieuwenhuizen
d052876f85
mes: Add char-whitespace?
...
* module/srfi/srfi-14.mes (char-whitespace?): New function.
2018-04-15 08:04:09 +02:00
Jan Nieuwenhuizen
0d0c7a415b
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.
2018-04-14 22:06:28 +02:00
Jan Nieuwenhuizen
b65e57be31
core: Tune debug printing.
...
* src/mes.c: Tune debug printing.
* src/gc.c: Likewise.
* module/mes/guile.mes: Likewise.
* HACKING: Describe it.
2018-04-09 07:12:38 +02:00