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
Jan Nieuwenhuizen
6b3328c71c
scm: Add with-throw-handler hack.
...
* module/mes/catch.mes (with-throw-handler): Add hack for Nyacc 0.75
2017-03-26 23:09:11 +02:00
Jan Nieuwenhuizen
3cbadcda86
scm: Add list->char-set.
...
* module/srfi/srfi-14.mes (list->char-set): New function.
* tests/srfi-14.test ("list->char-set!"): Test it.
2017-03-26 22:33:51 +02:00
Jan Nieuwenhuizen
6a816687e8
core: Prepare gc.c for mescc, non-POSIX_SOURCE.
...
* mes.c (NLENGTH, NVALUE, NVECTOR): New macros.
(mes_builtins): Add comment on .i include order.
* module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0.
* gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs
rather than fprintf.
(gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector.
* gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c
implementation.
2017-03-26 15:55:12 +02:00
Jan Nieuwenhuizen
17f89b2c78
mescc: Bugfix for realloc.
...
* module/mes/libc.mes (realloc): Thinko.
2017-03-26 15:49:45 +02:00
Jan Nieuwenhuizen
f015150cd8
mescc: Bugfix for neg.
...
* module/language/c99/compiler.mes (expr->accu): Fix neg.
* scaffold/t.c (math_test): Test it.
* scaffold/mini-mes.c (ash): Remove workaround.
2017-03-25 19:03:03 +01:00
Jan Nieuwenhuizen
c39c04cb56
mescc: Support rshift, have guile-mini-mes pass math test.
...
* module/mes/as-i386.mes (i386:accu>>base): New function.
* module/mes/as-i386.scm (mes): Export it.
* module/language/c99/compiler.mes (expr->accu): Support rshift.
* scaffold/t.c (math_test): Test it.
* scaffold/mini-mes.c (ash): Use it.
2017-03-25 18:48:40 +01: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
040b9aedfc
mescc: Support bitwise or.
...
* module/mes/as-i386.mes (i386:accu-or-base): New function.
* module/mes/as-i386.scm: Export it.
* module/language/c99/compiler.mes (expr->accu): Use it; support bitwise or.
* scaffold/t.c (math_test): Test it.
* scaffold/mini-mes.c (logior): Use it.
2017-03-24 23:15:01 +01:00
Jan Nieuwenhuizen
ca633abdda
mescc: Lshift support non-fixed shift value.
...
* module/mes/as-i386.mes (i386:accu<<base): New function.
* module/mes/as-i386.scm: Export it.
* module/language/c99/compiler.mes (expr->accu): Use it.
* scaffold/t.c (math_test): Test it.
2017-03-24 22:32:02 +01:00
Jan Nieuwenhuizen
ce55c198c0
mescc: Use signed integer comparison.
...
* module/language/c99/compiler.mes (test->jump->info):
* module/mes/as-i386.mes (i386:Xjump-le, i386:Xjump-g, i386:Xjump-l,
i386:Xjump-ge): New functions.
* module/mes/as-i386.scm: Export them.
* scaffold/t.c (math_test): Test them.
* tests/scm.test ("iota -1"): Enable for mesc.
2017-03-24 21:45:19 +01:00
Jan Nieuwenhuizen
66b53669f8
mescc: Run module/base-0.mes.
...
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 21:13:01 +02:00
Jan Nieuwenhuizen
9896f9eb92
scm+test: Factor-out math and vector.
...
* module/mes/base-0.mes (quotient): Remove.
* module/mes/scm.mes (quotient): Add.
* tests/scm.test: Remove arithmetic/math tests.
* tests/math.test: New file.
* GNUmakefile (TESTS): Add it
2017-04-02 11:34:40 +02:00
Jan Nieuwenhuizen
dbd987ab19
mescc: Have ungetc remember 2 positions.
...
* doc/examples/t.c (read_test): Test it.
* doc/examples/mini-mes.c:
* mlibc.c (getchar, ungetc): Support 2 ungetc positions.
* module/mes/libc.mes (getchar, ungetc): Likewise.
2017-03-23 18:57:06 +01:00
Jan Nieuwenhuizen
0685c9e7e8
mescc: Add brk, naive malloc.
...
* scaffold/mini-mes.c (gc_init_cells): Use malloc to init g_cells.
* scaffold/malloc.c: New file.
* GNUmakefile (malloc, guile-malloc): New targets.
* module/mes/libc-i386.mes (i386:brk): New function.
(i386:libc): Add it.
* mlibc.c (brk): New function.
(malloc): Use it.
(realloc): New function.
* module/mes/libc.mes (malloc, realloc): New functions.
2017-04-02 12:31:15 +02:00
Jan Nieuwenhuizen
b1d6e19eca
mescc: Struct fixes.
...
* module/language/c99/compiler.mes (expr->arg, expr->accu, ast->info):
Fixes for struct assignment.
2017-03-23 18:48:19 +01:00
Jan Nieuwenhuizen
a7f40f71ff
mescc: Add missing defines.
...
* module/language/c99/compiler.mes (mescc): Set STDIN, STDOUT, STDERR,
INT_MIN, INT_MAX.
2017-03-22 07:54:45 +01:00
Jan Nieuwenhuizen
76f6fdc43e
mescc: Struct by value assignment fixes.
...
* module/language/c99/compiler.mes (ast->info): Remove g_function
hardcoding, fix struct assignment.
* doc/examples/t.c (struct_test): Test it.
2017-03-22 07:13:34 +01:00
Jan Nieuwenhuizen
bcf1b2a356
mescc: Fix struct field comparison.
...
* module/language/c99/compiler.mes (expr->accu, ast->info): Some
push/pop fixes, fixes struct field comparisons.
* doc/examples/t.c (struct_test): Test it.
2017-03-22 07:10:54 +01:00
Jan Nieuwenhuizen
9a02352a15
mescc: Run full scheme reader read-0.mes.
...
* lib.c (load_env)[MINI_MES]: Load full reader, module/mes/read-0.mes.
* GNUmakefile (module/mes/read-0-32.mo): Update dependency.
* module/mes/mini-0.mes: Remove.
* doc/examples/t.c (struct_test):
* module/mes/read-0-32.mo: New file: bootstrap binary reader.
2017-03-22 06:59:50 +01:00
Jan Nieuwenhuizen
98f64ae516
mescc: Mini-mes (gcc-compiled) runs read-0.mes.
...
* module/language/c99/compiler.mes (expr->accu): Add mul.
(test->jump->info): Add le, ge.
(ast->info): Support int and char* initialization at top level.
* module/mes/as-i386.mes (i386:accu*base, i386:Xjump-cz,
i386:Xjump-ncz): New function.
* module/mes/as-i386.scm: Export them.
* doc/examples/t.c (test): Test them.
* module/mes/libc.mes (ungetc): New function.
(getchar): Support it.
(assert_fail, isdigit): New functions.
(libc): Export them.
* module/mes/mini-0.mes: Load full reader.
* mlibc.c (ungetc): New function.
(getchar): Support it.
(assert_fail, isdigit): New functions.
* mes.c (list length error lookup_ getchar ungetchar peekchar
peek_byte read_byte unread_byte greater_p less_p): Move functions
needed to run read-0.mes into core.
* doc/examples/mini-mes.c: Likewise.
* lib.c (length, error): Comment-out.
* math.c (greater_p, less_p): Comment-out.
* posix.c: (getchar, ungetchar, peekchar, peek_byte, read_byte,
unread_byte): Comment-out.
* reader.c (lookup_): Comment-out.
2017-03-22 06:39:24 +01:00
Jan Nieuwenhuizen
240f2814f4
mescc: Cleanup mini-mes build and test.
...
* GNUmakefile (guile-cons-mes guile-m guile-main guile-micro-mes
guile-mini-mes guile-t guile-tiny-mes): New targets.
(clean): Clean them.
* .gitignore: Ignore them.
* HACKING: Update.
* scaffold/tiny-mes.c (bload_env): Read module/mes/tiny-0-32.mo.
* scaffold/cons-mes.c (simple_bload_env): Likewise.
* lib.c (dump)[MES_TINY]: Write crafted dump: module/mes/tiny-0-32.mo.
(load_env): Read module/mes/mini-0.mes.
(bload_env): Read module/mes/read-0-32.mo.
* module/mes/mini-0.mes: New file.
* module/mes/tiny-0.mes : New file.
2017-03-19 13:41:56 +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
124352e087
mescc: Refactor ret.
...
* module/mes/libc-i386.mes (i386:ret): Refactor.
* module/language/c99/compiler.mes (ast->info): Use it.
2017-03-19 10:27:18 +01:00
Jan Nieuwenhuizen
a010203f0d
mescc: Cache text generation.
...
* module/mes/elf-util.mes (functions->text): Add cache.
2017-03-18 23:00:04 +01:00
Jan Nieuwenhuizen
2397e0c8e2
mescc: Refactor function-offset.
...
* module/mes/elf-util.mes (function-offset): Recurse down. Factor 5
speedup on mini-mes.c.
2017-03-18 19:12:25 +01:00
Jan Nieuwenhuizen
4b349fabf1
mescc: Cache data-offset too.
...
* module/mes/elf-util.mes (data-offset): Add cache.
2017-03-18 08:58:15 +01:00
Jan Nieuwenhuizen
a14c3d937a
mescc: Support assignment with comparison.
...
* module/language/c99/compiler.mes (expr->accu): Handle assignment -> accu.
* doc/examples/t.c (test): Test it.
* doc/examples/mini-mes.c (eval_apply): Use it.
2017-03-18 08:25:15 +01:00
Jan Nieuwenhuizen
4c59078002
mescc: Support assignment test.
...
* module/language/c99/compiler.mes (test->jump->info): Handle assignment.
* doc/examples/t.c (test): Test it.
2017-03-18 08:17:18 +01:00
Jan Nieuwenhuizen
b22eee36df
mescc: Fix simple value tests.
...
* module/language/c99/compiler.mes (test->jump->info): Test accu
before jumping. Fixes simple value tests.
2017-03-17 23:49:29 +01:00
Jan Nieuwenhuizen
f03a2e7500
mescc: Struct by value.
...
* build-aux/mes-snarf.scm (symbol->names, function->header,
function->environment): Remove struct by value assignment
workarounds.
* module/language/c99/compiler.mes (ast->info): Remove struct by value
assignment debug printing.
2017-03-17 22:45:48 +01:00
Jan Nieuwenhuizen
a4d65166c0
mescc: Support generic initializer.
...
* module/language/c99/compiler.mes (ast->info): Support generic
declaration using initializer. Supports struct field initializer.
* doc/examples/t.c (struct_test): Test it.
* doc/examples/mini-mes.c (call_lambda, eval_apply, write_byte,
display_): Use it. (call_lambda): (eval_apply,
list_of_char_equal_p): Use it.
2017-03-17 17:54:37 +01:00
Jan Nieuwenhuizen
ddd880bdc8
mescc: Remove last hardcodings for identifiers.
...
* module/language/c99/compiler.mes (ident->accu, ident->base):
Use local:ptr, type->size to remove hard coding of functionx, c1.
(expr->accu): Use type->size to remove hard coding of size byte.
(decl->type): Also handle typename, bail out if type not found.
(type->size): Print identifier and and bail out if type not found.
(formal:ptr): New function.
(formals->locals): Use it to set pointer value of parameter. WAS: 0.
(ast->info): Remove functionx hardcoding.
(getchar): Rename c1 to c.
* doc/examples/t.c: Test it.
2017-03-17 17:32:23 +01:00
Jan Nieuwenhuizen
cbee04c4b8
mescc: Support function call with enum value.
...
* doc/examples/mini-mes.c: Remove debug printing.
* module/language/c99/compiler.mes (push-global, push-local,
push-global-address, push-local-address, push-local-de-ref): Return
list of lambda.
(push-ident): Support push constant. Fixes mini-mes,
cstring_to_list.
* doc/examples/t.c (test): Test it.
2017-03-17 08:37:45 +01:00
Jan Nieuwenhuizen
a2f180ba4a
mescc: Fix d-sel comparisons.
...
* module/language/c99/compiler.mes (ast->info): Save base while
computing accu. Fix comparison using d-sel in second argument.
* doc/examples/t.c: Test it.
* doc/examples/mini-mes.c (assq): Use it.
2017-03-14 00:15:13 +01:00
Jan Nieuwenhuizen
d039b00349
mescc: Fix for character array s[0].
...
* module/language/c99/compiler.mes (expr->arg, expr->accu, ast->info):
Use type size to calculate index.
* doc/examples/t.c: Test it.
* doc/examples/mini-mes.c (cstring_to_list): Simplify.
2017-03-13 19:38:38 +01:00
Jan Nieuwenhuizen
03c37b2e22
mescc: Support mini-mes running scheme program with builtins.
...
Mini-mes, compiled with either gcc or mescc, now runs a memory dump of
this mini-0.mes program
(begin
(write-byte (make-cell 0 0 65))
(write-byte (make-cell 0 0 66))
(write-byte (make-cell 0 0 67))
(write-byte (make-cell 0 0 10))
#f)
when read and dumped by (gcc-compiled) mes-32.
* build-aux/mes-snarf.scm: FIXES ..collapse?
* module/language/c99/compiler.mes (ast->info): Bail out on unhandled
declarations. Was: verbosely skip.
2017-03-12 12:02:12 +01:00
Jan Nieuwenhuizen
1322d99c22
mescc: Support [for] itoa.
...
* module/mes/libc-i386.mes (i386:accu%base): New function.
* module/mes/libc-i386.scm: Export it.
* module/language/c99/compiler.mes (expr->accu): Use it to support mod.
* doc/examples/t.c (itoa): New function.
(test): Test it.
* doc/examples/mini-mes.c (itoa)[!__GNUC__]: New function.
2017-03-12 11:05:20 +01:00
Jan Nieuwenhuizen
3268027e46
mescc: Support do .. while.
...
* module/language/c99/compiler.mes (ast->info): Support do-while.
* doc/examples/t.c (test): Test it.
2017-03-12 11:05:00 +01:00
Jan Nieuwenhuizen
76f1a89cef
core+mini-mes: Replace manual snippets by snarfed includes.
...
* build-aux/mes-snarf.scm (symbol->source, function->header,
function->source, function->environment): Add workarounds to
avoid struct-copy initializers.
* GNUmakefile (mini-mes): Snarf symbols and functions.
* scaffold/mini-mes.c: Include mini-mes.h, mini-mes.symbols.h,
mini-mes.symbols.i, mini-mes.i, mini-mes.environment.i.
Add snarfable symbol/special definitions.
(type_t): Prefix all types with `T', update users.
(assert_defined, gc_push_frame, gc_peek_frame, gc_init_cells): Mark
as internal.
* mes.c (type_t): Prefix all types with `T', update users.
* scaffold/mini-mes.c (eq_p, type_, car_, cdr_,
list_of_char_equal_p, lookup_macro, write_byte): New functions (from
mes.c).
(assq): Add debugging, workaround.
2017-03-10 20:56:18 +01:00
Matt Wette
b43380c8d8
nyacc: removed start from lalr-spec -- not needed
2017-03-05 13:22:51 -08:00
Matt Wette
2f1e0e6360
nyacc: working javascript interpreter in guile
2017-03-03 17:07:29 -08:00
Matt Wette
07310be6d0
nyacc: lex fixes for char-lit
2017-03-02 16:23:44 -08:00
Matt Wette
9c4e5247c2
nyacc: cleaned up documentation
2017-03-01 18:11:40 -08:00
Matt Wette
be4d33f022
nyacc: working on C99 UG as a memo
2017-02-28 17:19:48 -08:00
Matt Wette
6c536c0e9d
nyacc: new release 0.76.5
2017-02-28 09:57:49 -08:00
Matt Wette
953a57b663
nyacc: fixed bug in pretty-print-c99 wrt i-sel
2017-02-28 09:53:41 -08:00
Matt Wette
f7ab751dcd
nyacc: merge from 0.76.4
2017-02-25 07:36:57 -08:00
Matt Wette
72b0dbe2bd
nyacc: new release 0.76.4
2017-02-23 17:31:24 -08:00
Matt Wette
14d6407bc9
nyacc: new release 0.76.3
2017-02-23 05:38:49 -08:00
Matt Wette
e00dc59ac0
nyacc: more bugs in cpp tokl->string
2017-02-23 05:37:25 -08:00
Matt Wette
7bb78f15b8
nyacc: new release 0.76.2
2017-02-22 17:14:07 -08:00
Matt Wette
8580e706f8
nyacc: fixed more CPP issues
2017-02-22 17:12:32 -08:00
Matt Wette
f7fb6ac395
nyacc: new release 0.76.1
2017-02-22 08:26:40 -08:00
Matt Wette
2c6a6dc47d
nyacc: fixed C99 CPP to deal with numbers correctly
2017-02-22 08:23:27 -08:00
Matt Wette
62154122b3
nyacc: merge master 0.76.0
2017-02-20 13:45:45 -08:00
Matt Wette
34c0f46c62
nyacc: new release 0.76.0
2017-02-19 08:28:25 -08:00
Matt Wette
a301ce53df
nyacc: worked c99/util2.scm udecl->mspec
2017-02-19 08:26:30 -08:00
Matt Wette
047590bd5e
nyacc: new release 0.75.6
2017-02-18 17:11:12 -08:00