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
3429f103a4
scaffold: Add proper includes.
...
* scaffold/argv.c: Add proper includes.
* scaffold/malloc.c: Likewise.
* scaffold/micro-mes.c: Likewise.
* scaffold/mini-mes.c: Likewise.
* scaffold/tiny-mes.c: Likewise.
2018-07-21 10:47:05 +02:00
Jan Nieuwenhuizen
ad135d3752
doc: Release udpate.
...
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.12: New file.
* throughout: (janneke) coming out.
2017-11-21 19:22:26 +01:00
Jan Nieuwenhuizen
1263d6e278
mescc: Write object files in hex2 or hex3 format.
...
* stage0/elf32.hex2: New file.
* module/mes/hex2.mes: New file.
* module/mes/hex2.scm: New file.
* module/language/c99/compiler.mes: Eradicate object lamdas.
(current-eval, dec-xhex, function:-object->text, object->elf,
object->objects, merge-objects, alist-add): Remove.
* module/mes/elf.mes (object->elf): New function, move from compiler.mes.
* module/mes/elf.scm: Export it.
* guile/mescc.scm (parse-opts): Add -g.
(main): Use it.
* scripts/mescc.mes: Likewise.
* scripts/mescc-guile.make (MESCC.scm, MESLD.scm): Add -g flag.
* scripts/mescc-mes.make (MESCC.mes, MESLD.mes): Likewise.
* scaffold/m.c: Add proper includes.
* scaffold/argv.c: New file.
* scaffold/hello.c: Simplify.
* scaffold/micro-mes.c: Add proper includes.
* scaffold/t.c: Add proper includes.
2017-06-11 13:11:40 +02:00
Jan Nieuwenhuizen
fe727301c5
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.
2017-05-02 23:30:46 +02:00
Jan Nieuwenhuizen
996c449a81
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.
2017-04-17 02:24:20 +02:00
Jan Nieuwenhuizen
38d30a3e42
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.
2017-04-12 21:27:59 +02:00
Jan Nieuwenhuizen
091c1ccd31
doc: Add Roamdmap.
...
* HACKING: Add roadmap.
2017-03-29 08:05:18 +02:00
Jan Nieuwenhuizen
30743ce141
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.
2017-03-25 15:58:44 +01:00
Jan Nieuwenhuizen
4e12e14b85
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.
2017-04-02 12:29:09 +02:00
Jan Nieuwenhuizen
6ffca4bf61
mescc: Add open/read C-tests.
...
* scaffold/m.c: New file.
* scaffold/tiny-mes.c: New file.
* GNUmakefile (m, tiny-mes): New targets.
* scaffold/micro-mes.c: Update gcc-libc bits.
* scaffold/mini-mes.c: Likewise.
2017-04-02 12:10:38 +02:00
Jan Nieuwenhuizen
b98a2dda6e
mescc: Handle && in if and while.
...
* scaffold/t.c (test): Add strcmp tests.
* module/language/c99/compiler.mes (expr->arg):
(test->jump->info): New function.
(ast->info): Use it.
* module/mes/libc-i386.mes (i386:global->accu):
(i386:base-mem->accu): Rename from i386:mem->accu.
(i386:byte-base-mem->accu): Rename from i386:base-mem->accu.
(i386:accu-not, i386:global->accu, i386:xor-accu): New functions.
* module/mes/libc-i386.scm: Export them.
2017-01-08 17:51:40 +01:00
Jan Nieuwenhuizen
c83ef66265
mescc: Beginning of expression and test template.
...
* scaffold/t.c: New file.
* GNUmakefile (mescc-check, t-check): New targets.
* module/language/c99/compiler.mes (write-any): Catch weirdness.
(make): Add <function> slot.
(.function): New accessor.
(clone): Handle it.
(function->info): Set it.
(ast->info): Make tests generic in if, for, while. Add goto, label,
!, ==, !=, -, &&.
* module/mes/elf-util.mes (lambda/label->list): New function.
(text->list): Use it.
(functions->text, function-prefix): New function.
(function-offset): Use it.
(label-offset): New function.
* module/mes/elf-util.scm (mes): Export them.
* module/mes/elf.mes (make-elf): Use text->list.
* module/mes/libc-i386.mes (eputs, puts): Remove.
(i386:byte-base-sub): Rename from sub-byte-base.
(i386:byte-jump-z): Rename from i386:Xjump-byte-z.
(i386:byte-mem->accu): Rename from i386:Xmem-byte->accu.
(i386:byte-mem->base): Rename from i386:Xmem-byte->base.
(i386:accu->local, i386:accu-non-zero?, i386:accu-zero?,
i386:base-sub, i386:byte-sub-base, i386:jump-c, i386:jump-cz,
i386:jump-nc, i386:jump-ncz, i386:byte-mem->base, i386:sub-base,
i386:test-accu, i386:test-base, i386:test-jump-z, i386:value->base,
i386:xor-zf): New functions.
2017-04-02 12:23:00 +02:00
Jan Nieuwenhuizen
8d1e001ab2
mescc: Have micro-mes use strcmp to print help.
...
* doc/examples/micro-mes.c (main): Add --help.
* module/language/c99/compiler.mes (info?): New function.
(expr->accu): Handle function call and sub.
(ast->info): Handle if not, and, de-ref, eq, sub, return f ().
* module/mes/libc-i386.mes (i386:accu-zero?, i386:Xmem-byte->accu,
i386:Xmem-byte->base, i386:jump-byte-nz, i386:jump-byte-z,
i386:test-byte-base, i386:Xjump-byte-z, i386:sub-byte-base): New
functions.
* module/mes/libc-i386.scm: Export them.
2017-01-06 00:20:05 +01:00
Jan Nieuwenhuizen
38dc229a01
mescc: Have micro-mes use if not to segfault.
...
* module/language/c99/compiler.mes (write-any): Check explicitly on
number?, report error otherwise.
(statement->text+symbols+locals): Remove statement-offset.
Handle compounds. Handle very specific if.
(function->symbols): Remove unused text-offset.
* doc/examples/micro-mes.c (main): If argc > 1 print argv1. Fixes
segfault :-)
* module/mes/elf-util.mes (symbols->text): Loop rather than map,
feed text-offset.
* module/mes/libc-i386.mes (i386:local-test, i386:jump-le): New
functions.
* module/mes/libc-i386.scm: Export them.
2017-01-03 18:22:56 +01:00
Jan Nieuwenhuizen
296449c615
mescc: Have micro-mes print argv.
...
* module/language/c99/compiler.mes (expr->arg): Bugfix argv: Use
size=4 (int).
(statement->text+symbols+locals): Bugfixes: array-ref, initialize with
immediate, initialize with local.
(formals->locals): Bugfix: formals counted down from -1 [WAS: down to
-1].
* module/mes/libc-i386.mes (i386:call): Reverse args pushes to match
formals index changes.
(i386:write): Update for changed formals push order.
(i386:mem->accu, i386:value->accu): New functions.
* module/mes/libc-i386.scm (mes): Export them.
* doc/examples/micro-mes.c (eputs, puts, fputs): Make identical with
mescc's implementations.
(main): Print argv[0] and (unconditionally; crash if not given) argv[1].
2017-01-03 12:33:34 +01:00
Jan Nieuwenhuizen
01177f7324
mescc: Have micro-mes print argc.
...
* module/language/c99/compiler.mes (accu->ident): New function.
(statement->text+symbols+locals): Use it to implement initialization
with immediate, local.
(_start): Call main with argc,argv [WAS: 0,0].
* module/mes/libc-i386.mes (i386:push-accu, i386:accu->local): New
functions.
* module/mes/libc-i386.scm: Export them.
* doc/examples/micro-mes.c (main): Return argc as exit status.
2017-01-03 12:52:59 +01:00
Jan Nieuwenhuizen
109cbdd1e7
mescc: Formals, local variables.
...
* module/language/c99/compiler.mes (statement->text+symbols+locals):
Rename from statement->text+symbols. Handle locals.
(formals->text): Add proper function preamble.
(formals->locals): Add formals as locals.
(expr->accu, ident->accu, ident->base, ident-ref, global-ref): New
functions.
(strlen, eputs, fputs, puts): New functions.
(libc): New variable.
(i386:libc): Rename from libc. Remove eputs and puts.
* module/mes/libc-i386.mes (i386:eputs, i386:puts: Remove.
(i386:call, i386:ret): Handle locals as argument.
(i386:function-locals, i386:function-preamble, i386:jump,
i386:local->accu, i386:local-add, i386:local-assign,
i386:local->base, i386:ref-global, i386:ref-local, i386:ret-local,
i386:mem-byte->accu, i386:test-jump, i386:write): New functions.
* module/mes/libc-i386.scm: Export them.
2017-01-02 23:21:33 +01:00
Jan Nieuwenhuizen
8989dab8b0
mescc: Scaffolding of Nyacc compile experiments.
...
* scaffold/micro-mes.c: New file.
* scaffold/mini-mes.c: New file.
* GNUmakefile (mini-mes, micro-mes): New targets.
* .gitignore: Ignore them.
2017-04-02 12:01:33 +02:00