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
209f9cc599
mescc: Tinycc support: Update some tests.
2018-05-14 21:18:08 +02:00
Jan Nieuwenhuizen
8c6e41d92d
mescc: Tinycc support: Add __lshrdi3, __ashldi3, __ashrdi3.
...
* lib/libc+tcc-gcc.c (__lshrdi3, __ashldi3, __ashrdi3): New function.
2018-05-14 22:36:14 +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
c4abd50a53
core: Add logxor.
...
* src/math.c (logxor): New function.
* tests/math.test ("logxor"): Test it.
2018-05-16 22:30:08 +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
04860cca6b
core: reader: Support binary #b101.
...
* src/reader.c (reader_read_binary): New function.
(reader_read_hash): Use it.
* tests/scm.test ("binary"): Test it.
2018-05-16 22:32:59 +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
7603ee1f31
build: Do not assume /bin/sh, basename/dirname.
...
* install.sh: Do not assume /bin/sh, basename/dirname.
* scripts/diff.scm: Likewise.
2018-05-23 20:32:37 +02:00
Jan Nieuwenhuizen
0ba240a4e0
build: Build mini-libc and libc+tcc-gcc too.
...
* include/getopt.h[__GNUC__ && POSIX]: Only use include_next.
* lib/libc+tcc-gcc.c[POSIX](longjmp, setjmp, __udivdi3, __umoddi3):
Remove.
* build-aux/build-cc.sh: Build mini-libc-gcc and libc+tcc-gcc too.
* build-aux/build-mlibc.sh: Build mini-libc-gcc too.
2018-05-23 18:41:57 +02:00
Jan Nieuwenhuizen
6ab7d2cee7
boot: Bugfix for diff on mes.
...
* scripts/diff.scm (diff-files): Rename from diff; Avoids name clash
with module to allow using -e '(<module>)' hack.
2018-05-23 18:41:57 +02:00
Jan Nieuwenhuizen
a4110e55bb
build: Install naive diff.
...
* scripts/diff.scm: Move from build-aux.
* install.sh: Install it.
* build-aux/tests.sh: Update location.
2018-05-23 18:41:57 +02:00
Jan Nieuwenhuizen
c6d666bd67
build: Update configure.
...
* configure: Update.
2018-05-21 00:06:39 +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
a1a5145a1a
build: Use ../mes-seed/refresh.sh, ../tinycc-seed/refresh.sh.
...
* GNUmakefile (seed): Use ../mes-seed/refresh.sh, ../tinycc-seed/refresh.sh.
2018-05-10 16:35:49 +02:00
Jan Nieuwenhuizen
62bd70cfb6
mescc: Guile fixes.
...
* scripts/mescc: Set GODIR. Add module as expression to Mes
invokation. Remove explicit (second) call to main.
2018-05-04 10:12:34 +02:00
Jan Nieuwenhuizen
95fdfb2261
test: Use diff -ub for tinycc tests.
...
* build-aux/diff.scm: Support -b.
* build-aux/test.sh: Use it.
2018-05-18 18:34:58 +02:00
Jan Nieuwenhuizen
cac2ba7b06
check: Also test with i686-unknown-linux-gnu-gcc.
...
* check.sh (CC32): New variable.
* build-aux/test.sh: Also test with CC32.o
2018-05-04 21:24:39 +02:00
Jan Nieuwenhuizen
aa7cca0032
build: configure: Handle VAR=VALUE. Update help.
...
* configure: Handle VAR=VALUE. Update help.
2018-05-06 08:46:32 +02:00