Jan Nieuwenhuizen
bade7d5519
mescc: Support typedef and many TCC declaration variants.
...
* module/language/c99/compiler.mes (ast->info): Register typedefs in types.
(enum-def-list->constants): Support addition and substraction in
enum field values.
(get-type): New function. Use throughout.
2017-05-25 07:32:29 +02:00
Jan Nieuwenhuizen
3b4e7cd8a8
mescc: Handle comments anywhere.
...
* module/language/c99/compiler.mes (c99-input->full-ast): Rename from c99-input->full-ast.
(ast-strip-comment, c99-input->ast): New functions.
(ast->info): Remove comment exceptions.
2017-05-25 19:48:26 +02:00
Jan Nieuwenhuizen
92a330ff07
mescc: Support anonymous enums.
...
* module/language/c99/compiler.mes (enum-def-list->constants): New function.
(ast->info): Support anonymous enum.
2017-05-25 07:57:26 +02:00
Jan Nieuwenhuizen
6af7556d51
mescc: C99 header files and declaraions.
...
* libc/include/assert.h (assert_fail):
* libc/include/stdio.h:
+int eputs (char const* s);
+int fputs (char const* s);
+int puts (char const* s);
+int putchar (int c);
+int fputc (int c, int fd);
+int getchar ();
* libc/include/stdlib.h:
+char* getenv (char const* s)
+int atoi (char const *s);
+int *malloc (size_t);
+int *realloc (int *p, int size);
* libc/include/unistd.h (access):
* src/lib.c (display_helper):
* src/mes.c (read_input_file_env):
* src/posix.c: Include unistd.h.
2017-05-23 07:16:08 +02:00
Jan Nieuwenhuizen
cf51f3f5bd
mescc: support -E.
...
* guile/mescc.scm (parse-opts): Add -E.
(source->ast): New function.
(main): Use it.
* scripts/mescc.mes (parse-opts): Add -E.
(source->ast): New function.
(main): Use it.
2017-05-22 19:22:18 +02:00
Jan Nieuwenhuizen
3c880bbb56
mescc: Refactor mlibc compilation.
...
* libc/libc-mes.c: New file. Contents from module/mes/libc.mes, module/mes/libc-i386.mes.
* libc/libc-gcc.c: Rename from libc/mlibc.c, include libc/mstart.c
* libc/mstart.c: Remove.
* module/mes/libc-i386.mes: Remove.
* module/mes/libc-i386.scm: Remove.
* module/mes/libc.mes: Remove.
* module/mes/libc.scm: Remove.
* GNUmakefile (CFLAGS): Include libc-gcc.c (WAS: mlibc.c).
* make/bin-mlibc.make (C_FLAGS): Remove start.c include.
* make/mescc-guile.make: Rewrite using compile, link.
* make/mescc-mes.make: Likewise.
* scaffold/m.c: Update.
2017-05-21 22:25:02 +02:00
Jan Nieuwenhuizen
2027754a59
mescc: support -c, -o.
...
* module/language/c99/compiler.mes: Throughout: quote lambda's.
(current-eval): New function.
Thanks Andy!
(object->list): New function. Update callers.
(c99-input->info): Dump a.o.
(initzer->non-const, function:object->list): New functions.
(info:object->list): New function.
(c99-input->elf): Call it.
* module/mes/as-i386: Throughout: quote lambda's.
* scripts/mescc.mes (main): Rewrite.
* guile/mescc.scm (main): Likewise.
2017-05-17 13:56:25 +02:00
Jan Nieuwenhuizen
bdd160241b
mes: Bugifx for number->string radix > 10.
...
* module/mes/scm.mes (number->string): Bugfix for `10' -> hex/radix > 10.
2017-05-23 06:28:37 +02:00
Jan Nieuwenhuizen
21aff4c7ad
mes: Simplify read-string.
...
* module/mes/guile.mes (read-string): Simplify, probably fix even.
2017-05-21 12:21:07 +02:00
Jan Nieuwenhuizen
78a066ff3f
mescc: Remove LALR C frontend prototype.
...
* module/language/c/compiler.mes: Remove.
* module/language/c/lexer.mes: Remove.
* module/language/c/parser.mes: Remove.
2017-05-21 12:38:29 +02:00
Jan Nieuwenhuizen
11311bcaa7
mes: Add negate.
...
* module/mes/scm.mes (negate): New function.
2017-05-21 12:33:16 +02:00
Jan Nieuwenhuizen
45ce77df85
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.
2017-05-19 06:56:47 +02:00
Jan Nieuwenhuizen
44c8f26bf0
mes: Support octal numbers in reader.
...
* module/mes/read-0.mes (read-octal): New function.
(read-word): Use it.
* tests/read.test: Test it.
2017-05-19 21:10:08 +02:00
Jan Nieuwenhuizen
8dc593ab18
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.
2017-05-18 22:03:02 +02:00
Jan Nieuwenhuizen
dda7a7cd62
mes: Add string-rindex.
...
* module/srfi/srfi-13.mes (string-rindex): New function.
2017-05-19 00:41:01 +02:00
Jan Nieuwenhuizen
20b3c349bf
mes: Support predicate with string-index.
...
* module/srfi/srfi-13.mes (string-index): Support predicate.
2017-05-19 00:51:23 +02:00
Jan Nieuwenhuizen
8f4b64fda7
mes: Add string-suffix?
...
* module/mes/scm.mes (string-prefix?): Refactor.
(string-suffix?): New function.
2017-05-19 00:23:13 +02:00
Jeremiah Orians
cd5c16cf74
Purging binary blobs
...
* mes.mes: Remove.
* module/mes/read-0-32.mo: Remove.
2017-05-27 07:29:20 +02:00
Jan Nieuwenhuizen
7241756945
mescc: Minimal support for short.
...
* module/language/c99/compiler.mes (i386:type-alist): Add short.
2017-05-08 21:34:08 +02:00
Jan Nieuwenhuizen
ae7a42671a
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.
2017-05-08 21:15:53 +02:00
Jan Nieuwenhuizen
5d0202bbf7
mescc: Enhance sizeof support.
...
* module/language/c99/compiler.mes (expr->accu): Support sizeof (simple-type),
sizeof (var).
2017-05-08 21:32:32 +02:00
Jan Nieuwenhuizen
ed3aa5be35
mescc: Support void return.
...
* module/language/c99/compiler.mes (ast-info): Support `return'.
2017-05-08 20:06:20 +02:00
Jan Nieuwenhuizen
c64691797b
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.
2017-05-07 10:04:32 +02:00
Jan Nieuwenhuizen
ec935e5667
mes: Consider GUILE_LOAD_PATH for include-from-path.
...
* module/mes/guile.scm (include-from-path): New macro.
2017-05-07 08:23:20 +02:00
Jan Nieuwenhuizen
df878c59d9
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.
2017-05-07 07:36:44 +02:00
Jan Nieuwenhuizen
d1cacdc91e
nyacc: Update to 0.78.
2017-05-06 22:35:46 +02:00
Jan Nieuwenhuizen
92c363701b
mes: Add srfi-16 to Nyacc Guile support.
...
* module/mes/guile.mes: Include srfi-16 for Nyacc.
2017-05-06 22:47:45 +02:00
Jan Nieuwenhuizen
c84f95beee
mes: Basic support for string-index.
...
* module/srfi/srfi-13.mes (string-index): New function.
* tests/srfi-13.test ("string-index"): Test it.
2017-05-06 23:00:27 +02:00
Jan Nieuwenhuizen
529ab8caa1
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.
2017-05-06 22:49:08 +02:00
Jan Nieuwenhuizen
073f886203
mes: Support case-lambda.
...
* module/srfi/srfi-16.scm: New file.
* AUTHORS: Mention it.
* module/srfi/srfi-16.mes: New file.
2017-05-06 22:42:21 +02:00
Jan Nieuwenhuizen
0bc2c05dba
mescc: Enhance enum support.
...
* module/language/c99/compiler.mes (ast->info): Support enum variable
declaration. Respect field value overrides.
2017-05-06 19:31:00 +02:00
Jan Nieuwenhuizen
390059a42d
mescc: Support binary constants.
...
* module/language/c99/compiler.mes (cstring->number): Support binary 0bxxx values.
* scaffold/t.c (math_test): Test it.
2017-05-06 18:16:24 +02:00
Jan Nieuwenhuizen
2eae07de72
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.
2017-05-06 17:30:14 +02:00
Jan Nieuwenhuizen
be6e30a8fa
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.
2017-05-06 14:57:39 +02:00
Jan Nieuwenhuizen
6272356959
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.
2017-05-06 11:01:58 +02:00
Jan Nieuwenhuizen
5246de5e39
mescc: Support struct definition with variable declaration.
...
* module/language/c99/compiler.mes (ast->info): Support `struct foo {} bar;'.
2017-05-06 09:27:28 +02:00
Jan Nieuwenhuizen
68528219cb
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.
2017-05-06 09:11:42 +02:00
Jan Nieuwenhuizen
6dc19bd040
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.
2017-05-06 08:39:04 +02:00
Jan Nieuwenhuizen
f5372bdeff
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.
2017-05-05 09:24:19 +02:00
Jan Nieuwenhuizen
03211ee91d
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.
2017-05-04 19:39:23 +02:00
Jan Nieuwenhuizen
0077c9aed6
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.
2017-05-03 23:01:49 +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
d9780e66cd
mescc: Support list of initializers.
...
* module/language/c99/compiler.mes (ast->info): Support list of initializers.
2017-05-03 08:09:19 +02:00
Jan Nieuwenhuizen
4e0042cae6
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.
2017-05-02 17:00:07 +02:00
Jan Nieuwenhuizen
243d358b03
bootstrap: Regenerate.
...
* module/mes/read-0-32.mo: Regenerate.
2017-04-27 12:08:16 +02:00
Jan Nieuwenhuizen
d9e5e2d21f
doc: Release update.
...
* AUTHORS: Mention Nyacc and GuixSD.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.5 New file.
* HACKING: Add pointers, update TODO/DONE.
2017-04-27 12:08:16 +02:00
Jan Nieuwenhuizen
26dcf7136b
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.
2017-04-24 19:09:54 +02:00
Jan Nieuwenhuizen
777fbc9d70
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.
2017-04-23 13:53:36 +02:00
Jan Nieuwenhuizen
7f3e44e361
mescc: Fix global creation in AND/OR clause.
...
* module/language/c99/compiler.mes (test->jump->info): Retain globals
created in AND/OR test.
2017-04-23 13:53:08 +02:00
Jan Nieuwenhuizen
e0a0a3798a
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.
2017-04-17 23:32:02 +02:00
Jan Nieuwenhuizen
707c3a31cd
mescc: Add atoi.
...
* libc/mlibc.c (atoi): New function.
* module/mes/libc.mes (atoi): New function.
(libc): Add it.
2017-04-17 23:29:54 +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
d47f0f65c5
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.
2017-04-17 02:15:11 +02:00
Jan Nieuwenhuizen
9918ffab92
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.
2017-04-16 09:51:45 +02:00
Jan Nieuwenhuizen
133772d992
bootstrap: Regenerate
...
* module/mes/read-0-32.mo: Regenerate.
2017-04-25 23:44:23 +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
8460c4ab52
mescc: Add fsync.
...
* module/mes/libc-i386.mes (i386:fsync): New function.
(i386:libc): Export it.
* mlibc.c (fsync): New function.
2017-04-15 15:13:38 +02:00
Jan Nieuwenhuizen
b41e35cf6f
core/mini-mes: Merge merge mes.c and mini-mes.c.
...
* mes.c:
* scaffold/mini-mes.c:
* gc.c:
* GNUmakefile:
2017-04-10 19:13:20 +02:00
Jan Nieuwenhuizen
c4b14d66d3
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.
2017-04-10 08:06:33 +02:00
Jan Nieuwenhuizen
39d334d51b
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.
2017-04-10 06:59:50 +02:00
Jan Nieuwenhuizen
6009cf95fe
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.
2017-04-09 06:52:39 +02:00
Jan Nieuwenhuizen
2deca502ed
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.
2017-04-08 06:31:12 +02:00
Jan Nieuwenhuizen
da931b4faa
mescc: Factor-out array-ref.
...
* module/language/c99/compiler.mes: Factor-out array-ref.
2017-04-07 23:06:09 +02:00
Jan Nieuwenhuizen
1eeec4a327
mescc: Refactor expr->base.
...
* module/language/c99/compiler.mes (expr->base): Rename from
expr->+base. Use throughout.
2017-04-07 14:41:47 +02:00
Jan Nieuwenhuizen
c4697b0e9d
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.
2017-04-07 14:31:35 +02:00
Jan Nieuwenhuizen
68d90aa645
mescc: Factor-out append-text.
...
* module/language/c99/compiler.mes: Use append-text throughout.
2017-04-07 09:53:56 +02:00
Jan Nieuwenhuizen
7ccbc00047
mescc: Factor-out wrap-as.
...
* module/language/c99/compiler.mes (wrap-as): Rename from wrap. Use throughout.
2017-04-07 09:36:30 +02:00
Jan Nieuwenhuizen
a2b6830ecb
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.
2017-04-07 07:06:35 +02:00
Jan Nieuwenhuizen
25a02752f5
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.
2017-04-06 23:05:44 +02:00
Jan Nieuwenhuizen
6b4e604441
mescc: Refactor expressions.
...
* module/language/c99/compiler.mes (expr->accu, ast->info): Remove
duplication, separate concerns.
2017-04-06 09:12:50 +02:00
Jan Nieuwenhuizen
b13cd87700
mescc: Refactor pre/post inc/dec.
...
* module/language/c99/compiler.mes: Refactor pre/post inc/dec.
2017-04-05 23:05:16 +02:00
Jan Nieuwenhuizen
61a536406d
bootstrap: Regenerate.
...
* mes-mini-mes: Regenerate.
* module/mes/read-0-32.mes: Regenerate.
2017-04-05 22:43:41 +02:00
Jan Nieuwenhuizen
ab25c53e6e
mescc: function call.
...
* module/language/c99/compiler.mes (expr->accu): Move function call
from ast->info.
2017-04-05 20:11:13 +02:00
Jan Nieuwenhuizen
c4fe8d8239
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.
2017-04-05 14:24:34 +02:00
Jan Nieuwenhuizen
71da0bfb78
mescc: Remove duplication.
...
* module/language/c99/compiler.mes (expr->arg): Use expr->accu for
most expressions.
2017-04-04 14:37:17 +02:00
Jan Nieuwenhuizen
0f27e12672
scm: Do not quote list of strings.
...
* module/mes/display.mes (display): Check value of write?, fixes
quoting display string.
2017-04-03 07:19:38 +02:00
Jan Nieuwenhuizen
56b19c76ff
mescc: Do not return ELF text.
...
* module/language/c99/compiler.mes (info->exe): Do not return ELF text.
2017-04-03 07:09:03 +02:00
Jan Nieuwenhuizen
b4a4e39050
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.
2017-04-02 18:50:07 +02:00
Jan Nieuwenhuizen
f9aedd1466
bootstrap: Regenerate.
...
* module/mes/read-0-32.mo: Regenerate.
2017-04-02 13:21:01 +02:00
Jan Nieuwenhuizen
05cae56813
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.
2017-04-02 08:05:55 +02:00
Jan Nieuwenhuizen
e9ac52dfda
mescc: Fix by value assignment from array-of struct entry.
...
* module/language/c99/compiler.mes (expr->accu): Fix by value
assignment from array-of struct entry.
* scaffold/t.c (struct_test): Test it.
* vector.c (make_vector, list_to_vector, vector_to_list): Use it;
remove workarounds.
* gc.c (gc_copy): Likewise.
2017-04-01 23:12:37 +02:00
Jan Nieuwenhuizen
3b527affa3
scm: Support test failure expectation.
...
* module/mes/test.mes (result): Take second argument to mean expected
failure count.
2017-04-01 15:01:59 +02:00
Jan Nieuwenhuizen
08c04ff845
scm: Evaluate arguments of OR only once.
...
* module/mes/base.mes (or): Evaluate arguments only once.
* module/mes/read-0.mes (or): Likewise.
* tests/base.test ("or only once"): Test it.
* module/mes/read-0-32.mo: Regenerate.
2017-04-02 16:47:22 +02:00
Jan Nieuwenhuizen
232e87bd9d
scm: Have char-set-contains? strictly return boolean.
...
* module/srfi/srfi-14.mes (char-set-contains?): Return #t rather than
memq result.
2017-04-01 09:36:34 +02:00
Jan Nieuwenhuizen
a8587b6453
scm: Fix bug in assq-set!
...
* module/mes/scm.mes (assq-set!): Bugfix.
2017-04-01 07:23:10 +02:00
Jan Nieuwenhuizen
4d933001d5
scm: Add c????r.
...
* module/mes/base-0.mes (caar, cadr, cdar, cddr, map): Remove. Update callers.
* module/mes/base.mes (): Remove.
* module/mes/base.mes (cadadr, cddadr, cdddar): New function.
2017-04-02 09:35:47 +02:00
Jan Nieuwenhuizen
2c25f45678
scm: Add access?
...
* module/mes/guile.mes (access?): New dummy function. Fixes Nyacc's #include.
2017-03-31 21:41:32 +02:00
Jan Nieuwenhuizen
d938b38d5e
scm: Add open-input-string, read-string.
...
* module/mes/guile.mes (open-input-string, read-string): New functions.
* tests/guile.test: New file.
* GNUmakefile (TESTS): Add it.
2017-04-01 12:51:35 +02:00
Jan Nieuwenhuizen
fc263de433
build: Cleanup, use gcc-specific snarfing.
...
* .gitignore: Ignore *.o-32, mes-mini-mes.
* scripts/nyacc-calc.mes: Remove.
* scripts/nyacc.mes: Remove.
* scripts/paren.mes: Remove.
* make/install.make (install): Remove them.
p* module/mes/mes-0.mes: Remove.
* module/mes/loop-0.mes: Remove.
* build-aux/mes-snarf.scm (main): Add --mini option.
* GNUmakefile (mini-mes): Use it.
2017-04-02 17:01:22 +02:00
Jan Nieuwenhuizen
b99f756367
core: Fix error message when macro is missing.
...
* mes.c (scm_vm_eval_check_func): New symbol.
(eval_apply): In eval, evaluate car before evlis. Fixes error
message when macro match is missing in (match ... (car x)).
(mes_symbols): Add cell_call_with_values, cell_current_module to environment.
* scaffold/mini-mes.c (eval_apply): Likewise.
2017-03-27 20:14:48 +02:00
Jan Nieuwenhuizen
b45d7b599f
nyacc: prefix globals.
2017-03-28 20:26:16 +02:00
Jan Nieuwenhuizen
1f1b850640
scm: Bugfix display of named characters: add port.
...
* module/mes/display.mes (display): Typo, add port.
2017-03-27 21:41:44 +02:00
Jan Nieuwenhuizen
4d4c793018
nyacc: Add missing (mes pmatch) include.
...
* module/nyacc/lang/c99/cpp.mes (mes): Include (mes pmatch).
2017-03-27 21:01:22 +02:00
Jan Nieuwenhuizen
2e007d3727
nyacc: Use pmatch rather than match for cpp.
...
* module/nyacc/lang/c99/cpp.scm (nyacc lang c99 cpp): Import (system
base pmatch) rather than (ice-9 match).
(rtokl->string): Rewrite using pmatch.
2017-04-01 12:16:09 +02:00
Jan Nieuwenhuizen
945fb39d18
scm: Bugfix drain-input.
...
* module/mes/guile.mes (drain-input): Bugfix: return string.
2017-03-27 21:00:49 +02:00
Jan Nieuwenhuizen
a53e878435
scm: Add assoc-set!
...
* module/mes/scm.mes (assoc-set!): New function.
* tests/scm.test ("assoc-set!", "assoc-set! new"): New tests.
2017-03-27 07:01:15 +02:00
Jan Nieuwenhuizen
58dfe0b7bd
scm: Add compose.
...
* module/mes/scm.mes (compose): New function.
* tests/scm.test ("compose"): New test.
2017-03-27 00:35:36 +02:00
Jan Nieuwenhuizen
22880ac831
scm: Support reading negative hex numbers.
...
* module/mes/read-0.mes (read-hex): Support negative hex numbers.
* tests/math.test ("#x-10"): New test.
* tests/read.test: Add test.
2017-03-27 00:11:05 +02:00
Jan Nieuwenhuizen
44755ceff2
scm: Support map4.
...
* module/mes/base-0.mes (map): Remove. Update callers.
* module/mes/base.mes (map): Support map4.
2017-03-26 23:48:15 +02:00
Jan Nieuwenhuizen
cf356a553c
nyacc: Add simple split-cppdef for Mes.
...
* module/nyacc/lang/c99/body.scm: Add non-regexp split-cppdef for Mes.
2017-03-26 23:09:44 +02:00