Jan Nieuwenhuizen
e1e8f03735
doc: Release udpate.
...
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.9: New file.
* make.scm: Install it.
* guix.scm (mescc-tools): Bump to 0.2.
2017-07-26 15:57:38 +02:00
Jan Nieuwenhuizen
4b1de28449
build: Install and installed-run fixes.
...
* guile/mescc.scm (%datadir,%docdir,%moduledir,%version): Remove.
* scripts/mescc.mes: Likewise.
* module/language/c99/compiler.mes: Likewise.
(%prefix): Prefer environment setting.
(c99-input->full-ast): Remove unnecessary includes.
Remove unnecessary defines.
* make.scm (%scm-files): Add mes/guile.scm.
(src/mes.gcc, src/mes.mlibc-gcc, src/mes.guile): Update MODULEDIR,
add -I src.
* src/mes.c (load_env): Use temporary variable for MODULEDIR concatenation.
(bload_env): Likewise.
2017-07-26 15:57:38 +02:00
Jan Nieuwenhuizen
b7cc9d375d
mescc: Tinycc support: bugfix struct.array.
...
* module/language/c99/compiler.mes (struct-field): Update pointer
info.
(field:name,field:pointer,field:size,field:type): Rely on pointer
info.
(field:pointer): New function.
(expr->accu): Use it.
* scaffold/tests/71-struct-array.c (test): Test it.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
d2f701b825
mescc: Tinycc support: bugfix struct pointer.
...
* module/language/c99/compiler.mes (decl->info): Only set non-pointer struct to -1.
* scaffold/tests/23-pointer.c (test): Test it.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
10e65b35ce
mescc: Tinycc support: more function stack space.
...
* module/mes/as-i386.mes (function-locals): Increase local space from
64 (16 vars) to 2*1025 + 80 (20 vars).
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
7e795763f3
mescc: Tinycc support: bugfix for char **pp = *p.
...
* module/language/c99/compiler.mes (ptr-declr->pointer): Grok ***.
(decl->info): Bugfix for char **pp = *p, cleanup.
* mlibc/libc-mes.c (getenv): Update for bugfix.
* scaffold/tests/23-pointer.c (test): Test it.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
a13b2ad28c
mescc: Tinycc support: function parameters.
...
* module/language/c99/compiler.mes (.name): Handle function parameters.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
97164b473d
mescc: Tinycc support: jump 32.
...
* module/mes/as-i386.mes (i386:jump-byte-z): Use jne32 (was: jne8).
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
ee4471058f
mescc: Tinycc support: arithmetic in initializes.
...
* module/language/c99/compiler.mes (p-expr->number): Handle
bitwise-or, constants.
(initzer-data): Refactor, use p-expr->number.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
accf4159a4
mescc: Tinycc support: multi-byte [local] offsets.
...
* stage0/x86.M1: Add 32bit variants for all 8bit instructions.
* module/mes/as-i386.mes: Use them, switch on size.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
af626da19a
mescc: Naming fix.
...
* stage0/x86.M1 (je8): Rename from jne8.
* module/mes/as-i386.mes (i386:jump-byte-z): Update.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
31758dd03c
mescc: Tinycc support: remove warnings for foo (void), foo (...).
...
* module/language/c99/compiler.mes (.name, .type): Expect foo (void), foo (...).
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
4ec2532ad5
mescc: Tinycc support: multiple statements in default case.
...
* module/language/c99/compiler.mes (clause->info): Support multiple
statements in default case.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
a7a3de05f6
mescc: Tinycc support: array[<const-expr>].
...
* module/language/c99/compiler.mes (p-expr->number): New function.
(struct-field, decl->info): Use it to support const expressions in array size.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
d1a7527eaf
mescc: Use "tag" for tag namespace.
...
* module/language/c99/compiler.mes: Use "tag" for tag namespace (WAS: "struct").
Move enums to "tag" namespace.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
2756dd9071
mescc: Tinycc support: sizeof (struct.field).
...
* module/language/c99/compiler.mes (expr->accu): Support sizeof (struct.field).
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
1d996c7131
mescc: Tinycc support: struct.union.
...
* module/language/c99/compiler.mes (struct-field): Add struct tag to
struct/union types.
(field-type, field-size, field-offset, field-field, ast-type->type):
Ascertain struct tag with type.
* (expr->accu*): Do not add struct tag.
* scaffold/tests/75-struct-union.c: Test it.
* scaffold/tests/71-struct-array.c: Update.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
1c01a65d8b
mescc: Tinycc support: sizeof ("foo").
...
* module/language/c99/compiler.mes (expr->accu): Support sizeof (string).
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
ce3233f998
mescc: Tinycc support: struct foo {int bar; int baz} = {0}.
...
* module/language/c99/compiler.mes (decl->info): struct foo {int bar; int baz} = {0}.
* scaffold/tests/72-typedef-struct-def.c (test):
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
dcce4bae8a
mescc: Tinycc support: generalize neg.
...
* module/language/c99/compiler.mes (expr->accu): Generalize neg.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
fd4f4f87be
mescc: Tinycc support: >>=, <<=.
...
* module/language/c99/compiler.mes (expr->accu): Support >>= <<=.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
b44825a035
mescc: Bugfix non-char* *x x[] test.
...
* module/language/c99/compiler.mes (expr->pointer): New function.
(test-jump-label->info): Use it to fix non char* while (*x | x[i]).
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
3af652a4d0
mescc: Tinycc support: foo[i].bar.baz.
...
* module/language/c99/compiler.mes (init-declr->pointer): Use -1 for array.
(expr->accu): Implement foo[i].bar.baz.
* scaffold/tests/72-typedef-struct-def.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
137547afa7
mescc: Tinycc support: *global =.
...
* module/language/c99/compiler.mes (base->ident-address):
Support *global = ...
* scaffold/tests/74-multi-line-string.c: Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
73726b2e27
mescc: Tinycc support: anonymous union.
...
* module/language/c99/compiler.mes (field:name): New function.
(decl->info): Use it.
(struct-field): Support anonymous union.
(field:size): Update.
(field-field): Update.
(field-offset): Update.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
ef4868eb13
mescc: Tinycc support: ignore [ULL], UL, LL, L.
...
* module/language/c99/compiler.mes (cstring->number): Drop suffix.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
eff1e97cdf
mescc: Tinycc support: ~, ^=.
...
* module/mes/as-i386.mes (i386:accu-not): New function.
(i386:accu-negate): Rename from i386:accu-not.
* module/mes/as-i386.scm (mes): Export them.
* module/language/c99/compiler.mes (expr->accu): Support ~, ^=.
* scaffold/tests/60-math.c (test): Test it.
* stage0/x86.M1 (not____%eax): New define.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
cccbfe4c61
mescc: Tinycc support: struct.struct.
...
* module/language/c99/compiler.mes (expr->accu): Support &*,
bar.foo.i, p->foo.i, p->pf->i (*pp)->foo.i, [slightly modified] offsetof.
* scaffold/tests/72-typedef-struct-def.c (test): Test them.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
b87cd56376
mescc: Tinycc support: ***parameter.
...
* module/language/c99/compiler.mes (.name): Support ***parameter.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
11fb4e03dc
mescc: Tinycc support: bitwise-or initializer.
...
* module/language/c99/compiler.mes (initzer->value): New function.
(initzer->data): Use it to support bitwise-or initializer.
* scaffold/tests/74-multi-line-string.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
3687740b64
mescc: Tinycc support: char*[] in function.
...
* module/language/c99/compiler.mes (c99-input->full-ast): Add NULL.
(decl->info): Support char* [] in function scope.
* scaffold/tests/71-struct-array.c (test) Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
e8023cd2ef
mescc: Tinycc support: more list initializers.
...
* module/language/c99/compiler.mes (init-declr->name): Handle array,
pointer array.
(init-declr->pointer): Likewise.
(decl->info): Generalize list initializers, add pointer variant.
FIXME: AST-rewriting?
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
8ec7e1225b
mescc: Tinycc support: sizeof struct field.
...
* module/language/c99/compiler.mes (expr->accu): Sizeof struct field.
* scaffold/tests/72-typedef-struct-def.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
d393785381
mescc: Tinycc support: sizeof typename.
...
* module/language/c99/compiler.mes (expr->accu): Sizeof typename.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
0fa425ed5e
mescc: Tinycc support: pre/post-inc/dec more.
...
* module/language/c99/compiler.mes (expr-add): New function.
(expr->pointer): New function.
(expr->accu): Use it to support broader pre/post-inc/dec..
* scaffold/tests/72-typedef-struct-def.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
59e663021a
mescc: Tinycc support: comma operator.
...
* module/language/c99/compiler.mes (expr->accu): Handle comma operator.
* scaffold/tests/74-multi-line-string.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
3cdfdd7407
mescc: Tinycc support: assign pointer to struct field.
...
* module/language/c99/compiler.mes (expr->accu, expr->accu*): Support
pointer field selection.
* scaffold/tests/72-typedef-struct-def.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
9b66421ce8
mescc: Tinycc support: multi-line strings.
...
* module/language/c99/compiler.mes (initzer->data, expr->global):
Handle multi-line strings.
* scaffold/tests/74-multi-line-string.c: New file.
* make.scm (add-scaffold-test): Build it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
3ae27f52e4
mescc: Tinycc support: union.
...
* scaffold/tests/73-union.c: New file.
* module/language/c99/compiler.mes (union->type-entry): New
function.
(decl->info): Support unions.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
07ee1fbf4f
mescc: Tinycc support: struct.
...
* scaffold/tests/72-typedef-struct-def.c: New file.
* module/language/c99/compiler.mes (decl->info): Struct support for tinycc.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
94b3c828d3
mescc: Refactor decl.
...
* module/mes/as-i386.mes (i386:mem->base, i386:nop): New functions.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes:
* stage0/x86.M1 (nop,mov____(%edx),%edx,movzbl_(%edx),%edx): New defines.
* scaffold/tests/23-pointer.c: New file.
* scaffold/tests/t.c: New file.
* make.scm: Build them.
* module/language/c99/compiler.mes (init-declr->name): Handle array.
(init-declr->pointer): Likewise.
(ident->accu): Simplify.
(ident->base): Simplify.
(ident-address->base): Typo.
(expr->accu): Simplify.
(decl->info): Simplify.
* mlibc/libc-mes.c (getenv): Remove superfluous statement.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
69e997047a
mescc: Use records for Guile: <local>.
...
* module/language/c99/info.scm (<local>): New record.
* module/language/c99/compiler.mes (make-local-entry): Rename from
make-local. Update callers.
(local-var?): Rename from local?. Update callers.
* module/language/c99/info.mes (make-local, local:type, local:pointer,
local:id): Move from compiler.mes.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
d2650c8ebf
mescc: Use records for Guile: <global>.
...
* module/language/c99/info.scm (<global>): New record.
* module/language/c99/compiler.mes (make-global-entry): Rename from
make-global. Update callers.
* module/language/c99/info.mes (make-global, global:type,
global:pointer, global:value): Move from compiler.mes.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
c0fb6d247d
mescc: Use records for Guile: <type>.
...
* module/language/c99/info.scm (<type>): New record.
* module/language/c99/compiler.mes (make-type-entry): Rename from
make-type. Update-callers.
* module/language/c99/info.mes (make-type, type:type, type:size,
type:pointer, type:description): Move from compiler.mes.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
5d54461f67
mescc: Use records for Guile: <info>.
...
* module/language/c99/info.scm (<info>): Make immutable record.
Update users.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
52b09c5f17
mescc: Use records for Guile: preparation.
...
* module/language/c99/info.mes: New file.
* module/mes/M1.mes: Use it.
* scripts/mescc.mes: Use it.
* module/language/c99/compiler.mes: Use it. (<info>, <types>,
<constants>, <functions>, <globals>, <locals>, <function>, <text>,
<break>, <continue>, make, info?, .info, .types, .constants,
.functions, .globals, .locals, .function, .text, .break, .continue):
Remove.
* module/language/c99/info.scm: New file.
* module/language/c99/compiler.scm: Use it.
* guile/mescc.scm: Use it.
* module/mes/M1.scm: Use it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
81f3fb0ecf
mescc: Refactor decl.
...
* module/language/c99/compiler.mes (decl->info, ptr-declr->pointer):
New function.
(ast->info): Use decl->info.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
2de207076b
build: Add make install.
...
* guile/guix/make.scm (method-cp, install, install-target?): New functions.
* make.scm: Use them.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen
1bddb52c75
build: Resurrect guile-2.0. Thanks rain1!
...
* module/mes/guile.scm: New file.
* module/mes/elf.scm: Include it.
* module/mes/bytevectors.scm: : Include it.
* module/mes/as.scm: Include it.
* module/mes/as-i386.scm: Include it.
* module/mes/M1.scm: Include it.
* module/language/c99/compiler.scm: Include it.
* make.scm: Update.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen
aef03ebd39
build: Use released M0 intead of M1.
2017-07-26 11:36:07 +02:00