Commit Graph

517 Commits

Author SHA1 Message Date
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
Matt Wette bed639f680 nyacc: fixed some c99/util2 items 2017-02-18 17:06:50 -08:00
Matt Wette 5bf49dfb54 nyacc: merged in 0.75.5 from master and inc version 2017-02-17 10:21:52 -08:00
Matt Wette 9559240282 nyacc: new release 0.75.5 2017-02-17 08:30:20 -08:00
Matt Wette 883a93ce60 nyacc: new release 0.74.4 2017-02-16 16:14:42 -08:00
Matt Wette f831edafe9 nyacc: minor cpp fixes 2017-02-16 16:12:40 -08:00
Matt Wette 5b34d2b2e7 nyacc: merge from 0.75.3 2017-02-16 11:03:11 -08:00
Matt Wette 16bf996c93 nyacc: new release 0.75.3 2017-02-16 06:26:10 -08:00
Matt Wette 2d35221753 nyacc: new release 0.75.2 2017-02-16 06:24:56 -08:00
Matt Wette 49a7200b72 nyacc: new release 0.75.1 2017-02-16 06:12:32 -08:00
Matt Wette 2b57b3dc6e nyacc: new release 0.74.0 2017-02-15 20:49:07 -08:00
Matt Wette 1ae749b25f nyacc: I think cpp is working now 2017-02-15 19:58:29 -08:00
Matt Wette 5baa7f33b1 nyacc: working cpp now, I hope 2017-02-14 19:24:59 -08:00
Matt Wette 8a821d03d6 nyacc: CPP not yet working for file mode 2017-02-12 14:29:18 -08:00
Matt Wette ea7f0b3a01 nyacc: working on cpp issues 2017-02-11 13:04:38 -08:00
Matt Wette d03ea06c84 nyacc: C99 CPP for code is better 2017-02-05 07:52:44 -08:00
Matt Wette e534225328 nyacc: starting to work on reframing 2017-01-20 14:51:55 -08:00
Matt Wette 85cb3731cc nyacc: more CPP fixes 2017-01-18 17:26:41 -08:00
Matt Wette 50fc6f6966 nyacc: redesign lang/c99/cppbocy.scm:scan-cpp-input 2017-01-17 05:50:45 -08:00
Jan Nieuwenhuizen f738d4381d mescc: Support goto in while body.
* module/language/c99/compiler.mes (ast->info): Support goto in while
  body.
* doc/examples/t.c (test): Test it.
2017-03-10 07:01:51 +01:00
Jan Nieuwenhuizen f612feec47 core+mini-mes: Move function name to struct function.
* module/language/c99/compiler.mes (expr->arg): Handle char arguments.
* doc/examples/cons-mes.c (struct function): Add name field.
* doc/examples/mini-mes.c: Likewise.
  (mes_builtins): Update.
* mes.c: Likewise.
* build-aux/mes-snarf.scm: Update.
2017-03-09 23:27:12 +01:00
Jan Nieuwenhuizen e9560e95a5 mescc: Support strings in struct initialization.
* module/mes/elf-util.mes (add-s:-prefix, drop-s:-prefix): New functions.
* module/mes/elf-util.scm: Export them.
* module/language/c99/compiler.mes (string->global): Add `s:' prefix
  to global strings.  Update users.
  (expr->arg): Update.
  (expr->accu): Handle string expressions.
  (initzer->global): New function.
  (struct-field): Handle string field.
* doc/examples/t.c: Test it.
* doc/examples/mini-mes.c: Use it.

dun!
2017-03-09 08:14:27 +01:00
Jan Nieuwenhuizen 64e73dcf29 mescc: Display sexps better.
* module/mes/elf.mes (make-elf): Only display data sections smaller
  than 200 bytes.
* doc/examples/mini-mes.c (simple_bload_env): Read mini-0-32.mes.
* doc/examples/cons-mes.c (display_): Support symbols and specials.
* doc/examples/tiny-mes.c: Likewise.
* lib.c:
* mes.c:
2017-03-07 22:33:59 +01:00
Jan Nieuwenhuizen dd52f580fb mescc: Compile all of mini-mes.
* module/language/c99/compiler.mes (case->jump-info): Support single statement.
* module/mes/elf-util.mes (function-prefix): Workaround for reversed
  functions.  FIXME!
* module/mes/elf.mes:
* scaffold/mini-mes.c (type_t): Rename FUNCTION to TFUNCTION for Nyacc.
  Add missing symbols.
  (eval_apply): Uncomment most.
* scaffold/tiny-mes.c:
* scaffold/cons-mes.c: Remove cruft.
2017-03-06 07:14:15 +01:00
Jan Nieuwenhuizen 78e70f9024 mescc: Support struct assignment.
* module/mes/libc-i386.mes (i386:base-address->accu-address,
  i386:accu+n, i386:base+n): New functions.
* module/mes/libc-i386.scm: Export them.
* module/language/c99/compiler.mes (ast->info): Use them.
* doc/examples/t.c: Test them.
* doc/examples/cons-mes.c: Drop workarounds.
* doc/examples/mini-mes.c: Likewise.
* mes.c:
2017-03-02 20:26:13 +01:00
Jan Nieuwenhuizen 08ea0da745 mescc: Fix add, sub, lshift.
* module/language/c99/compiler.mes (expr->accu): Fix add, sub, lshift.
* doc/examples/t.c: Test them.
* doc/examples/cons-mes.c:
* doc/examples/mini-mes.c:
2017-03-02 20:19:53 +01:00
Jan Nieuwenhuizen c9b251616a mescc: Support any expression as arg.
* module/language/c99/compiler.mes (expr->arg): Also push parameter,
  always return info.
  (ast->info): Loop over args.  Fixes using function calls in arguments.
* module/mes/libc-i386.mes (i386:push-arg): Remove.
  (i386:call, i386:call-accu): Remove arguments parameter.
* doc/examples/t.c: Test it.
2017-02-27 07:50:33 +01:00
Jan Nieuwenhuizen 394a3925be mescc: Rename expr->accu*.
* module/language/c99/compiler.mes (expr->accu*): Rename from expr->accuX.
2017-03-02 06:41:19 +01:00
Jan Nieuwenhuizen 07c4b02fa3 mescc: Fixes for goto.
* module/mes/libc-i386.mes (XXjump): New function.
* module/mes/libc-i386.scm: Export it.
* module/language/c99/compiler.mes (case->jump-info, ast->info): Use it.
* scaffold/t.c: Test it.
* GNUmakefile (cons-mes): New target.
* scaffold/cons-mes.c: New file.
* scaffold/mini-mes.c:
2017-04-02 12:13:04 +02:00
Jan Nieuwenhuizen 184c9f2641 mescc: Mini-mes runs (cons 0 1) dump.
* module/mes/libc-i386.mes (i386:Xjump-z, i386:Xjump-c,
  i386:Xjump-nc): New functions.
* module/mes/libc-i386.scm: Export them.
* module/language/c99/compiler.mes (case->jump-info, test-jump->info,
  ast->info): Use them.
* doc/examples/t.c: Test it.
* doc/examples/mini-mes.c: Run it.
2017-02-24 13:27:39 +01:00
Jan Nieuwenhuizen 70e4aec861 mescc: Run mini-mes.
* .gitignore: Ignore tiny-mes and tiny .mo's.
* doc/examples/tiny-mes.c: Simplify.
* doc/examples/mini-mes.c: Use simplifications from tiny-mes.
* doc/examples/t.c (read_test, struct_test): New functions.
  (test): Add tests for arena, g_cells globals.
* module/mes/elf-util.mes (dec->hex): New function.
  (lambda/label->list): Add text-address parameter.  Update callers.
* module/language/c99/compiler.mes (make, info, clone): Add init field.
  (.init): New function.
  (ident->accu): Add exceptions for globals.
* module/mes/elf-util.scm: Export it.
* module/mes/libc-i386.mes (i386:accu->base-ref,
  i386:byte-accu->base-ref, i386:accu->base-ref+n,
  i386:accu->global-ref, i386:global-ref->accu, i386:global-ref->base,
  i386:global-add, i386:global->accu):, i386:local-ref->accu,
  i386:local-ptr->accu, i386:local-ptr->base): New functions.
* module/mes/libc-i386.scm: Export them.
2017-01-29 15:22:39 +01:00
Jan Nieuwenhuizen 452b231645 mescc: bugfix: arg as function call.
* module/language/c99/compiler.mes (expr->arg):
2017-01-21 13:17:24 +01:00
Matt Wette e00d18b59f nyacc: new release 0.74.3 2017-01-15 08:51:21 -08:00
Matt Wette 50301b8fd7 nyacc: CPP working better now 2017-01-15 08:47:49 -08:00
Matt Wette 7e39956858 nyacc: something working 2017-01-14 15:16:28 -08:00
Matt Wette 532687f6d8 nyacc: still debugginug 2017-01-14 13:30:47 -08:00
Matt Wette bd3f15af64 nyacc: working # and ## I think, but lots of debug output too 2017-01-11 16:37:58 -08:00
Matt Wette 5652db7984 nyacc: exceptions worked on.. still need to fix # 2017-01-11 08:14:45 -08:00
Matt Wette d644043ef8 nyacc: new release 0.74.2 2017-01-10 20:10:32 -08:00
Matt Wette 91023edbf4 nyacc: fixed C99 use of 'defined XYZ' (no parens) 2017-01-10 20:06:28 -08:00
Matt Wette 09b9c41dba nyacc: merged master 2017-01-10 18:57:27 -08:00
Matt Wette cc5f5ac96f nyacc: working on fixes 2017-01-10 18:56:00 -08:00
Jan Nieuwenhuizen c210959c49 mescc: Read and display sexp dumped by mes.
* lib.c (dump)[MES_HACK]: Dump small hello-world sexp, to be handled by
* doc/examples/tiny-mes.c (display_): New function.
* module/mes/libc-i386.mes (i386:accu->base, i386:mem->accu,
  i386:mem+n->accu): New functions.
* module/mes/libc-i386.scm: Export them.
* GNUmakefile (mes-32): New target.
2017-01-10 20:05:47 +01:00
Jan Nieuwenhuizen 2bb9f2b818 mescc: Support global pointer assignments.
* module/mes/libc-i386.mes (base->accu-ref, local-ref->base): New functions.
* module/mes/libc-i386.scm: Export them.
* module/language/c99/compiler.mes (base->ident-ref, ident-ref->base):
  New functions.
2017-01-17 18:57:41 +01:00
Jan Nieuwenhuizen bf9539c565 mescc: Add data as loadable ELF section.
* module/mes/elf.mes (make-elf): Add data as loadable section too.
2017-01-17 18:48:54 +01:00
Jan Nieuwenhuizen 11f7f67a45 mescc: Support switch.
* module/language/c99/compiler.mes (case->jump-info): New function.
  (ast->info): Use it.
* doc/examples/t.c (swits): Test it.
2017-01-17 19:03:08 +01:00
Jan Nieuwenhuizen 04218971c5 mescc: Handle enums.
* module/language/c99/compiler.mes (<types>, <constants>): New slots for info.
 (make, clone): Add them.
 (.types, .constants): New accessors.
2017-01-10 22:44:01 +01:00
Jan Nieuwenhuizen 961559f32e mescc: Update for.
* module/language/c99/compiler.mes (ast->info): Rewrite for to use
  test->jump->info.
2017-01-10 20:51:29 +01:00
Jan Nieuwenhuizen 5fae0f7bff scm: Add string-delete.
* module/srfi/srfi-13.mes (string-delete): New function.
2017-01-17 18:48:28 +01:00
Jan Nieuwenhuizen c3eacb58df mescc: Support ?.
* module/language/c99/compiler.mes (ast->info): Support cond-expr.
* scaffold/t.c (test): Test it.
2017-01-10 20:27:44 +01:00
Jan Nieuwenhuizen b0e0ab014f mescc: Support open, read.
* module/mes/libc-i386.mes (i386:write): Fix comment.
  (i386:open, i386:read): New functions.
* module/mes/libc-i386.scm: Export them.
* module/language/c99/compiler.mes (i386:libc): Add them.
  (getchar, putchar): New libc functions.
  (libc): Add them.
2017-01-10 20:35:52 +01:00
Jan Nieuwenhuizen 4726a6c9ce mescc: Support globals.
* module/language/c99/compiler.mes (write-any): Catch writing of
  procedure and give more debug information.
  (ref-local, ref-global): Remove.
  (push-global-ref, push-global, push-ident-ref): New functions.
  (push-ident): New function.
  (expr->arg): Use them.
  (ident->accu, ident->accu, accu->ident, value->ident, ident->base):
  Take info parameter, also handle globals.
  (ident-address->accu, ident->global, cstring->number): New functions.
  (ast->info): Update.
* module/mes/libc-i386.mes (i386:ret-local): Remove.
  (i386:push-global-ref): Rename from i386:ref-global.
  (i386:push-local): Rename from i386:ref-local.
  (i386:value->local): Rename from i386:local-assign.
  (i386:push-global, i386:push-local-ref, i386:value->global,
  i386:local-address->accu): New functions.
* module/mes/libc-i386.scm: Export them.
2017-01-10 20:12:06 +01:00
Jan Nieuwenhuizen 36f9d584c5 mescc: Small ELF tweaks allowing debugging with gdb.
* module/mes/elf.mes (make-elf): Change note section to comment.  Fixes
  readelf.  Add SHF-ALLOC to .text and .data.
2017-01-09 20:06:32 +01: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 7667fb95c0 mescc: Proper support for i++,++i,i--,--i.
* module/language/c99/compiler.mes (ast->info): Bugfix: locals.
  Add i--, --i.  Properly support i++, ++i.
* module/mes/libc-i386.mes (i386:function-locals): Support 8 local vars.
* scaffold/t.c (test): Test it.
2017-01-07 21:53:12 +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 107795b13c mescc: Compile specific for loop.
* module/language/c99/compiler.mes (ast->info): Handle for, pre-inc.
* GNUmakefile (main): New target.
* doc/examples/main.c:
  (exit, write, strlen,puts)[__GNUC__]: New functions; import from micro-mes.c
  (_start): New function.
2017-01-05 21:24:56 +01:00
Jan Nieuwenhuizen 4a3e419e30 mescc: Refactor compiler.
* module/language/c99/compiler.mes (make, clone): Lightweight functional
  GOOPS-like list-based info structure.
  (make-text+globals+locals): Remove.
  (ast->info): Rename from statement->text+globals+locals, refactor.
  Update callers.
  (function->info): Rename from function->globals, refactor.  Update
  callers.
  (ast-list->info): New function.
2017-01-05 00:55:46 +01:00
Jan Nieuwenhuizen 21a6f2ca52 scm: Fix psyntax/keyword/optargs interaction bug.
* module/mes/psyntax-0.mes (self-evaluating?): Add keyword?.
* module/mes/pmatch.mes (mes): Add missing psyntax dependency.
* module/mes/optargs.scm (rest-arg->keyword-binding-list): Make error
  messages non-constant.
* tests/optargs.test ("clone <info>"): New test.
2017-01-07 01:08:29 +01:00
Jan Nieuwenhuizen 3c35f59e63 nyacc: Add cpp to c99 mes module.
* module/nyacc/lang/c99/parser.mes: Include (nyacc lang c99 cpp).
2017-01-03 22:12:12 +01:00
Jan Nieuwenhuizen f106dbfdae mescc: Rename symbols to globals.
* module/language/c99/compiler.mes:
2017-01-03 18:34:49 +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 b93d5188ea mescc: Support literal .byte in asm ().
* module/language/c99/compiler.mes (expr->arg): Handle array-ref (int
  only).
  (byte->hex, asm->hex): New functions.
  (statement->text+symbols+locals): Use it to implement asm ().
2017-01-03 12:45:47 +01:00
Jan Nieuwenhuizen ea7e3f4952 mescc: Remove data section from disassembly.
* module/mes/elf.mes (make-elf): Remove executable bit from data.
2017-01-03 12:43:00 +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 57e11b3147 mescc: Nicer functions/parameters.
* module/mes/libc-i386.mes (eputs, exit, puts): Save stack pointer,
  fill parameter registers from stack.
* module/language/c99/compiler.mes (formal->text): Fill parameter
  registers from stack memory.
  (formals->text): Save stack pointer.
2017-01-02 07:41:56 +01:00
Jan Nieuwenhuizen eb3fed2a00 mescc: Nyacc updates, factor-out elf-util.
* module/mes/bytevectors.mes
* module/mes/elf-util.mes: New file.
* module/mes/elf.mes: Use it.
  (make-elf): Generate symbol-table string-table.
* module/mes/elf-util.scm: New file.
* module/mes/elf.scm: Use it.
* module/language/c99/compiler.mes: Include it.
* module/language/c99/compiler.scm: Include it.
* module/mes/libc-i386.mes (call, eputs, exit, puts): New functions.
* module/mes/libc-i386.scm: Export them.
2017-04-02 11:55:37 +02:00
Jan Nieuwenhuizen 7ec42c3cc7 mescc: Use Nyacc frontend.
* module/language/c99/compiler.mes: New file.
* module/language/c99/compiler.scm: Include it.
* module/mes/elf.mes: Move (mes-use-module) into cond-expand.
* module/mes/elf.scm: New file.
* module/mes/libc-i386.scm: New file.
* module/nyacc/lang/c99/parser.mes: Add missing module includes.
* module/nyacc/lang/util.mes: Add missing module include.
* scripts/mescc.mes: Use Nyacc.
* guile/mescc.scm: New file.
* GNUmakefile (guile-mescc): Run it.
2016-12-31 09:03:07 +01:00
Jan Nieuwenhuizen cd44770258 scm: Avoid xpath's shadowing of filter.
* module/sxml/xpath.scm (xpath:filter): Rename from filter.  Fixes
  shadowing of core filter.
2017-01-03 22:18:22 +01:00
Matt Wette 5e988b4ebf nyacc: fixes didn't get in in 0.74.0 2017-01-08 16:59:20 -08:00
Matt Wette c5b99d79b7 nyacc: ugh. fixes did not take, why? 2017-01-08 16:56:24 -08:00
Matt Wette 16755c68b5 nyacc: new release 0.74.0 2017-01-08 13:06:33 -08:00
Matt Wette cafdfbb0bb nyacc: minor fixes 2017-01-08 13:00:57 -08:00
Matt Wette 9c32a41370 nyacc: lots of C99/CPP fixes. now more robust for code mode 2017-01-08 12:16:28 -08:00
Matt Wette 0b46949f48 nyacc: lots of fixes to make CPP more robust; now need to test 2017-01-07 16:06:09 -08:00
Matt Wette baea80d962 nyacc: updates for cpp-ok/not-ok 2017-01-06 08:03:41 -08:00
Matt Wette 2df0f57a30 nyacc: fixed c99/CPP bug: need to skip space before lparen 2017-01-02 07:42:23 -08:00
Matt Wette 7b665385c9 nyacc: have something working for in-place include 2017-01-01 19:40:27 -08:00
Matt Wette f5d1522166 nyacc: working on cpp-include fix 2017-01-01 07:54:21 -08:00
Matt Wette 6309b99aaa nyacc: creating fixes for 0.73.0 2016-12-31 08:33:07 -08:00
Matt Wette 5251e707ab nyacc: new release 0.73.0 2016-12-25 19:34:40 -08:00
Matt Wette e589c81c8d nyacc: misc updates; see ChangeLog 2016-12-25 19:31:09 -08:00
Matt Wette 4c4706f17e nyacc: multiple fixes 2016-12-03 07:19:35 -08:00
Matt Wette 4d5102dffd nyacc: starting devel on 0.72.0 2016-08-09 05:45:52 -07:00
Jan Nieuwenhuizen 1e8d27fb7d nyacc: Move README.nyacc.
* module/nyacc/README.nyacc: Moved from README.nyacc.
2016-12-26 08:06:49 +01:00
Jan Nieuwenhuizen 1a58dbe3c6 nyacc: Move (ice-9 syncase) into cond-expand.
* module/nyacc/lalr.scm: Move (ice-9 syncase) into cond-expand.  Fixes
  guile-2 deprecation messages.
* module/nyacc/lang/c99/cpp.scm: Likewise.
* module/nyacc/lang/c99/parser.scm: Likewise.
* module/nyacc/lex.scm: Likewise.
2017-03-26 22:27:20 +02:00
Jan Nieuwenhuizen e74a7584e9 repl: Fix expand in repl.
* module/mes/repl.mes (repl): Fix expand.  Remove sc-expand.
2017-01-22 01:35:33 +01:00
Jan Nieuwenhuizen 712403752d scm: Error throws rather than hard exit.
* module/mes/read-0.mes (read-character, read-string): Call error.
* module/mes/scm.mes (error): Call core:error instead of exit.
  (syntax-error): Likewise.
* module/mes/repl.mes (repl): Move read into catch.
2017-01-04 00:11:47 +01:00
Jan Nieuwenhuizen 1f9476aeca repl: Use exception handling.
* module/mes/repl.mes (repl): Use catch to prevent exit upon error.
2016-12-28 20:49:19 +01:00
Jan Nieuwenhuizen 2675f711a3 core+scm: Implement exception handling.
* mes.c (scm_symbol_throw): New symbol.
* module/mes/catch.scm (catch, throw): Implement [WAS: syntactic sugar].
  (make-exception, exception?, exception-key, exception-args): Remove.
* tests/catch.test ("catch", "catch 22"): Add tests.
* module/mes/base-0.scm: Include it.
2016-12-28 22:26:07 +01:00
Jan Nieuwenhuizen d0f7db73f9 core: Add continuations, call/cc.
* mes.c (type_t): Add CONTINUATION.
  (scm_t): Add continuation;
  (scm_call_with_current_continuation): New symbol.
  (scm_symbol_call_with_current_continuation): New special.
  (g_continuations): New global
  (CONTINUATION): New field accessor.
  (MAKE_CONTINUATION): New make_cell helper.
  (car_): Update.
  (eval_apply): Implement call/cc.
* module/mes/display.mes (display): Handle continuations.
* module/mes/type-0.mes (<cell:continuation>): New type.
  (cell-type-alist): Add it.
  (continuation?): New function.
* tests/base.test ("call/cc"): New test.
2016-12-28 22:04:57 +01:00
Jan Nieuwenhuizen b66cd8627c core: Rewrite eval_apply in continuation passing style.
* mes.c (scm_vm_evlis, scm_vm_evlis2, scm_vm_evlis3, scm_vm_apply,
  scm_vm_apply2, scm_vm_eval, scm_vm_eval_set_x, scm_vm_eval_macro,
  scm_vm_eval2, scm_vm_macro_expand, scm_vm_begin,
  scm_vm_begin_read_input_file, scm_vm_begin2, scm_vm_if,
  scm_vm_if_expr, scm_vm_call_with_values, scm_vm_call_with_values2,
  scm_vm_return): New specials.
  (scm_vm_eval_car, scm_vm_eval_cdr, scm_vm_eval_cons,
  scm_vm_eval_null_p)[PRIMITIVE-EVAL]: New specials.
  (eval_apply_t, g_target): Remove.
  (push_cc): New function.
  (eval_apply): Rewrite.
  (vm_call, eval_env, apply_env, eval_env, macro_expand_env, begin_env,
  call_with_values_env): Remove.
* posix.c (stderr_): Update.
* reader.c (read_input_file_env): Update.
* module/mes/base-0.mes: Update.
2016-12-28 21:55:42 +01:00
Jan Nieuwenhuizen b83d583755 Support radix for string->number, number->string.
* module/mes/scm.mes (string->number, number->string): Support radix.
2017-01-04 21:45:32 +01:00
Jan Nieuwenhuizen a0baa98196 Add string-take, string-drop.
* module/srfi/srfi-13.mes (string-take, string-drop): New functions.
2017-01-04 21:45:24 +01:00
Jan Nieuwenhuizen 40593ac218 Bugfixes bytevectors.
* math.c (modulo): Modulo of negative value correctly.
* module/mes/bytevectors.mes (bytevector-u32-native-set!):
  (bytevector-u16-native-set!): Use ash instead of quotient.
2017-01-04 21:44:38 +01:00
Jan Nieuwenhuizen 921c2fe79e Append-map: handle multiple list.
* module/srfi/srfi-1.mes (append-map): Add optional rest argument.
2017-01-04 21:43:35 +01:00
Jan Nieuwenhuizen b8fd6ca7b9 Add drain-input.
* module/mes/guile.mes (drain-input): New function.
2017-01-04 09:16:52 +01:00
Jan Nieuwenhuizen cc68c1cda8 Bugfix for reading #\*eof* character.
* module/mes/read-0.mes (read-character): Bugfix for #\*eof*.
2017-01-04 09:16:43 +01:00
Jan Nieuwenhuizen d0e222dac3 core: Expose command line.
* mes.c (scm_symbol_argv): New symbol
  (main): Use it to add argv to environment.
* module/mes/base.mes (command-line): New function.
2017-01-04 09:16:18 +01:00
Jan Nieuwenhuizen e1fa4ed8be Include srfi-13 in base.
* module/mes/base-0.mes: Include srfi-13.
2017-01-04 09:14:12 +01:00
Jan Nieuwenhuizen 6d5cfad356 Add filter-map.
* module/srfi/srfi-1.mes (filter-map): New function.
2017-01-04 09:14:05 +01:00
Jan Nieuwenhuizen aa82c408eb Add srfi-1:iota.
* module/srfi/srfi-1.mes (iota,srf-1:iota): New function.
2017-01-04 09:14:00 +01:00
Jan Nieuwenhuizen 1eba164dd9 Add pretty-print from Guile.
* module/mes/pretty-print.scm: Import.
* module/mes/pretty-print.mes: Include it.
* AUTHORS: Mention it.
2017-01-04 09:12:31 +01:00
Jan Nieuwenhuizen da6bd4cf97 Add make-string, object->string.
* module/mes/guile.mes (make-string, object->string): New functions.
2017-01-04 09:12:26 +01:00
Jan Nieuwenhuizen 02895340de Add list-set!, string-set!
* module/mes/scm.mes (list-set!, string-set!): New functions.
2017-01-04 09:12:21 +01:00
Jan Nieuwenhuizen b45936815c Add simple-format.
* module/mes/display.mes (simple-format, format): New functions.
2017-01-04 08:49:51 +01:00
Jan Nieuwenhuizen 5f8eedacec Display: If possible, show name of closure.
* module/mes/display.mes (display): Lookup closure's name and display it.
2017-01-04 08:49:45 +01:00
Jan Nieuwenhuizen 41207c663e Remove hardcoded duplication of version.
* GNUmakefile (CPPFLAGS): Include VERSION.
* mes.c (main): Use it.  Add --dump and --load to --help.
  (scm_symbol_mes_prefix, scm_symbol_mes_version): New sybols.
  (mes_symbols): Use them to set prefix and version.
* module/mes/base-0.mes (effective-version): Use %version.
* module/mes/repl.mes (welcome): Likewise.
2016-12-25 15:38:26 +01:00
Jan Nieuwenhuizen 49f1c4e5f3 Refactor reader.
* module/mes/read-0.mes (read-hash): New function.
  (read-word): Use it.
  (eat-whitespace): Rewrite.
  (display): Minimal implementation through core.
* lib.c (stderr_): Support printing of strings while booting.
2016-12-24 22:16:53 +01:00
Jan Nieuwenhuizen 7cb8aea66f core: Remove c3+r abbreviatons.
* lib.c (caaar, caadr, caddr, cdadr, cadar, cddar, cdddr, cadddr):
  Remove.
* mes.c: Rewrite callers
* module/mes/read-0.mes: Rewrite callers.
* module/mes/base.mes (caaar, caadr, caddr, cdadr, cadar, cddar, cdddr,
  cadddr): New function.
2016-12-24 14:21:36 +01:00
Jan Nieuwenhuizen 15163e9dc1 core: Add getenv, verbose module loading on MES_DEBUG.
* mes.c (MAKE_REF, MAKE_STRING): Oops, remove stray semicolon.
* posix.c (getenv_): New function.
* module/mes/base-0.mes (load): Use it to switch on MES_DEBUG=1.
  (mes-use-module): Remove commented-out code.
2016-12-24 14:09:48 +01:00
Jan Nieuwenhuizen e8d8d5c3be core: Add some error checking.
* lib.c (length): Return -1 for non-proper lists.
  (error): New function.
  (assert_defined): Use it.
  (check_formals, check_apply): New functions.
* mes.c (car, cdr, set_cdr_x, set_env_x, eval_apply): Add error check.
* srfi/srfi-1.mes (member): New function.
* tests/srfi-1.tests ("member"): New test.
2016-12-24 12:10:05 +01:00
Jan Nieuwenhuizen d81ce91ff7 Add write, add display test, some fixes.
* mes.c (write_byte): Rename from write_char.
* module/mes/display.mes (display): Fixes for write: char, closure, procedure.
  (write-char, write, with-output-to-string): New functions.
* tests/read.test: Include base-0 to see some output.
* tests/display.test: New file.
* GNUmakefile (TESTS): Add it.
2016-12-24 11:10:11 +01:00
Jan Nieuwenhuizen 16e3caafcd core: Remove display.
* posix.c (stderr_): New function.
* display.c: Remove.
* mes.c: Remove includes.  Use stderr_ instead of display_.
 (gc_loop): Preserve function's name.
 (arity_): New function.
* GNUmakefile (mes.o): Remove dependency on display.
* module/mes/read-0.mes: Use core:stderr instead of display, newline.
  (newline): New function.
* module/mes/base-0.mes: Use core:stderr instead of display.
  Include (mes display).
* module/mes/display.mes: New file.
* lib.c (assert_defined): Move from mes.c.
  (string_to_cstring): Move from posix.c
* build-aux/mes-snarf.scm (function-environment): Initialize function
  name with scheme string.
2016-12-24 01:23:50 +01:00
Jan Nieuwenhuizen d295ee5668 Import srfi-26 from Guile.
* module/srfi/srfi-26.scm: Import.
* module/srfi/srfi-26.mes: Include it.
* AUTHORS: Mention it.
2016-12-24 08:34:19 +01:00
Jan Nieuwenhuizen 73fc7707a5 core: Remove symbol_to_list, char_to_integer, integer_to_char.
* mes.c (symbol_to_list, char_to_integer, integer_to_char): Remove
* module/mes/read-0.mes (symbol->list, integer->char,
  symbol->keyword): New function.
  (read-word): Use symbol->keyword.
* module/mes/type-0.mes (char->integer): New function.
* module/mes/scm.mes (keyword->symbol): New function.
2016-12-23 23:25:49 +01:00
Jan Nieuwenhuizen 95fd6646dc core: Remove string.c.
* string.c: Remove.
* mes.c (eval_apply): Remove caller.
* GNUmakefile (mes.o): Remove dependency on string.
* module/mes/psyntax-0.mes (eval): Handle "noexpand".
* module/mes/type-0.mes (string->symbol, symbol->list, symbol->string):
  New function.
2016-12-23 22:48:27 +01:00
Jan Nieuwenhuizen 151a07ded3 core: Remove number_to_string.
* string.c (number_to_string): Remove.
* module/mes/scm.mes (number->string): New function.
2016-12-23 22:08:03 +01:00
Jan Nieuwenhuizen d37232f39c core: Remove substring.
* string.c (substring): Remove.
* module/mes/scm.mes (substring): New function.
2016-12-23 21:44:54 +01:00
Jan Nieuwenhuizen 9e6d862c5b core: Remove string_length.
* module/mes/scm.mes (string-length): New function.
2016-12-23 21:26:16 +01:00
Jan Nieuwenhuizen be786c00a3 core: Remove list_to_string.
* string.c (list_to_string): Remove.
* module/mes/read-0.mes (list->string): New function.
* module/mes/scm.mes (list->string): Remove.
2016-12-23 21:21:54 +01:00
Jan Nieuwenhuizen 745b58e419 core: Remove string-append.
* string.c (string_append): Remove.
* module/mes/type-0.mes (string-append): New function.
* module/mes/base-0.mes: Include type-0 without using string-append.
2016-12-23 20:56:37 +01:00
Jan Nieuwenhuizen 9d3e079a6d core: Remove string.
* string.c (string): Remove.
* module/mes/type-0.mes (string): New function.
2016-12-23 20:44:04 +01:00
Jan Nieuwenhuizen e8a591f91d Add exit.
* lib.c (exit_): Rename from builtin_exit.
* module/mes/scm.mes (list): Remove.
2016-12-23 20:31:45 +01:00
Jan Nieuwenhuizen e13587f57f core: Remove last_pair, list_ref, string_ref.
* lib.c (last_pair, list_ref): Remove.
* string.c (string_ref): Remove.
* module/mes/type-0.mes (string->list): New function.
* module/mes/scm.mes (string-ref): New function.
2016-12-23 20:09:57 +01:00
Jan Nieuwenhuizen 20b7a7851a core: Make closure real type.
* display.c (display_helper):
* mes.c (type_t): Add CLOSURE.
  (scm_t): Add closure.
  (CLOSURE): New macro.
  (eval_apply:apply): Update.
  (eval_apply:eval): Remove closure special-casing.
  (gc_loop): Handle CLOSURE.
* module/mes/read-0.mes: Update types.
* module/mes/type-0.mes: Update types.
* display.c (display): Update.
* module/mes/fluids.mes (env:escape-closure): Check for '*closure.
2016-12-23 18:48:36 +01:00
Jan Nieuwenhuizen 10235efe7e core: Remove type.c.
* module/mes/type-0.mes: Resurrect.
* module/mes/base-0.mes: Include it.
* module/mes/read-0.mes (not, pair?, atom?): New functions.
* type.c: Remove.
* mes.c: Remove callers.
* GNUmakefile (mes.o): Remove dependency on type.
2016-12-23 18:05:45 +01:00
Jan Nieuwenhuizen 97dfc3c981 core: Remove add_environment.
* mes.c (add_environment): Remove.  Update callers.
  (scm_symbol_dot): New global.
2016-12-23 17:02:23 +01:00
Jan Nieuwenhuizen c4fe110d1e core: Remove make_char.
* mes.c (MAKE_CHAR): New macro.
  (make_char): Remove.  Update callers.
* reader.c (peek_char, read_char, unread_char): Remove.
* module/mes/scm.mes (peek-char, read-char, unread-char): New function.
2016-12-23 16:26:00 +01:00
Jan Nieuwenhuizen 89e78bec77 core: Remove make_keyword.
* mes.c (make_keyword): Remove.
* module/mes/read-0.mes (<cell:keyword>): New global.
  (read-word): Use it with make_cell instead fo make-keyword.
* strting.c (symbol_to_keyword): Use make_cell instead of make_keyword.
2016-12-23 15:53:57 +01:00
Jan Nieuwenhuizen 976c86318e core: Remove make_macro.
* module/mes/read-0.mes (<macro>): New global.
  (env:macro): Use it with make_cell instead of make_macro.
* mes.c (make_macro): Remove.
* type.c (car_): Rename from mes_car.
  (cdr_): Rename from mes_cdr.
2016-12-23 15:47:52 +01:00
Jan Nieuwenhuizen 18ba10e2ae core: Simplify lookup.
* reader.c (lookup_): Rename from lookup.  Remove all lookups except
  for numbers and symbols.  Update callers.
* mes.c (make_symbol_): Rename from internal_make_symbol.  Update
  callers.
* module/mes/read-0.mes (lookup): New function.
  (read-word): Remove all lookup calls, except for numbers and symbols.
2016-12-23 11:31:34 +01:00
Jan Nieuwenhuizen 6f60e12d76 Remove lookup-char.
* reader.c (lookup_char): Remove.
* module/mes/read-0.mes (lookup-char): Remove.
  (read-word): Rewrite using quote.
2016-12-23 11:26:35 +01:00
Jan Nieuwenhuizen aa0aaa58ab core: Cleanup symbol initialization and lookup.
* build-aux/mes-snarf.scm (symbol->names): New function
  (function->environment): Initialize symbol.
  (generate-includes): Also write .symbol-names.i.
* mes.c (mes_symbols): Include it.  Remove internal_lookup_symbol.
* display.c (display): Handle display of nil in symbol list.
* reader.c (internal_lookup_symbol): Remove name-fu.
2016-12-23 10:38:41 +01:00
Jan Nieuwenhuizen ddfaa05149 core: Remove most of reader.
* reader.c (append_char, read_block_comment, read_character, read_hex,
  read_string): Remove.
  (eat_whitespace, read_word)[READER]: Remove.
* mes.c (list_to_symbol): New function.
* module/mes/read-0.mes (list->symbol, read-character, read-hex,
  read-string): New functions.
2016-12-22 23:42:28 +01:00
Jan Nieuwenhuizen a0caca6409 Refactor reader.
* module/mes/read-0.mes (eat-whitespace): More efficient ordering/peeking.
* module/mes/read-0.mes (read-word): Handle tab.
2016-12-25 12:37:35 +01:00
Jan Nieuwenhuizen b45a3b6f33 core: Disable reader.
* mes.c (READER): Switch off.
* module/mes/read-0.mes (eat-whitespace): Handle #;.
2016-12-22 21:23:49 +01:00
Jan Nieuwenhuizen 471bdb0af4 core: One big eval_apply.
* mes.c (eval_apply): New function.
  (eval_apply_t): New type.
  (g_target): New global.
  (vm_evlis, vm_apply_env, vm_eval_env, vm_expand_macro_env,
  vm_begin_env, vm_if_env, vm_call_with_values_env): Remove.  Update callers.
  (macro_expand_env): Rename from expand_macro_env.
* guile/mes.mes: Update callers.
* module/mes/base-0.mes: Likewise.
* module/mes/mes-0.mes: Likewise.
* module/mes/psyntax-1.mes: Likewise.
* module/mes/repl.mes: Likewise.
2016-12-22 16:34:28 +01:00
Jan Nieuwenhuizen 33ac19d7df Support PEG from Guile.
* module/mes/peg.mes: New file.
* module/mes/peg/cache.scm: New file.
* module/mes/peg/codegen.scm: New file.
* module/mes/peg/simplify-tree.scm: New file.
* module/mes/peg/string-peg.scm: New file.
* module/mes/peg/using-parsers.scm: New file.
* tests/peg.test: New file.
* GNUmakefile (TESTS): Add it.
2016-12-22 20:16:44 +01:00
Jan Nieuwenhuizen a0b18a402b Support pmatch from Guile.
* module/mes/pmatch.scm: New file.
* module/mes/pmatch.mes: New file.
* AUTHORS: Mention it.
2016-12-22 19:49:58 +01:00
Jan Nieuwenhuizen 8a78f45e25 Use include-from-path for psyntax.pp.
* module/mes/psyntax.pp: Rename from module/mes/psyntax-pp.mes.
* module/mes/psyntax.mes: Update.
* AUTHORS: Update.
2016-12-22 19:49:41 +01:00
Jan Nieuwenhuizen 0bac0cb948 Use include-from-path for upstream.
* module/mes/lalr.scm: Rename from module/mes/lalr.upstream.mes.
* module/mes/lalr.mes: Update.
* module/mes/match.scm: Rename from module/mes/match.upstream.mes.
* module/mes/match.mes: Update.
* module/mes/optargs.scm: Rename from module/mes/optargs.upstream.mes.
* module/mes/optargs.mes: Update.
* module/mes/quasisyntax.scm: Rename from module/mes/quasisyntax.upstream.mes.
* module/mes/quasisyntax.mes: Update.
* module/srfi/srfi-1.scm: Rename from module/srfi/srfi-1.upstream.mes.
* module/srfi/srfi-1.mes: Update.
* module/srfi/srfi-9.scm: Rename from module/srfi/srfi-9.upstream.mes.
* module/srfi/srfi-9.mes: Update.
* AUTHORS: Update.
2016-12-22 19:34:41 +01:00
Jan Nieuwenhuizen 51cd4885fc Add string-copy, string=, string=?, char<?, char>?, char<=?, char>=?.
* module/srfi/srfi-13.mes: New file.
* module/mes/scm.mes (char<?, char>?, char<=?, char>=?): New function.
* module/srfi/srfi-13.mes: New file.
* tests/srfi-13.test: New file.
* string.c (string_to_symbol): Handle "".
2016-12-11 21:26:27 +01:00
Jan Nieuwenhuizen ea7c0aac86 Refactor quasiquote.
* module/mes/quasiquote.mes (quasiquote): Refactor.
* tests/quasiquote.test: Add tests.
2016-12-22 12:11:55 +01:00
Jan Nieuwenhuizen 326095c9c9 Add psyntax-based quasisyntax.
* module/mes/quasisyntax.upstream.mes: Import from Guile.
* AUTHORS: Mention it.
* module/mes/quasisyntax.mes: New file.
* module/mes/psyntax.mes: Include it.
2016-12-21 16:48:33 +01:00
Jan Nieuwenhuizen 7bf25a7e17 core: Remove define.
* base-0.mes (cons*): Refactor.
* module/mes/read-0.mes: Implement define, define-macro using macros.
* define.c: Remove.
* mes.c: Remove callers.
* GNUmakefile (mes.o): Remove dependency on define.
2016-12-21 22:22:34 +01:00
Jan Nieuwenhuizen 1072c7fba9 nyacc: Support enhanced Guile-1.8.
* module/nyacc/lalr.scm: Export process-spec, reserved?.  Use optargs, syncase.
* module/nyacc/lex.scm: Use optargs, syncase.
* module/nyacc/parse.scm: Use optargs.
* module/nyacc/util.scm: Use optargs.
* module/nyacc/lang/util.scm: Use optargs.
* module/nyacc/lang/c99/cpp.scm: Use syncase.
* module/nyacc/lang/c99/parser.scm: Use optargs, syncase.
2016-12-18 22:16:14 +01:00
Jan Nieuwenhuizen f8e4d6e42b nyacc: Add mes modules.
* module/nyacc/lang/c99/cpp.mes
* module/nyacc/lang/c99/parser.mes
* module/nyacc/lang/calc/parser.mes
* module/nyacc/lang/util.mes
* module/nyacc/lex.mes
* module/nyacc/parse.mes
* module/nyacc/util.mes
2016-12-18 15:47:55 +01:00
Jan Nieuwenhuizen 0a9bfa7e3d nyacc: Use standard \return rather than \cr. 2016-12-18 15:39:36 +01:00
Jan Nieuwenhuizen a53e09d3e8 Import Nyacc 0.72.0.
* module/nyacc: Import module/nyacc.
2016-12-17 22:34:43 +01:00
Jan Nieuwenhuizen f8bc344dfc Import psyntax from Guile-1.8: R7RS with-ellipsis.
* GNUmakefile (psyntax-import): New target.
* module/mes/psyntax.ss: Import.
* module/mes/psyntax-pp.mes: Import.
* NEWS: Mention it.
2016-12-19 19:41:43 +01:00
Jan Nieuwenhuizen 40a6f2df34 Prepare for psyntax-6.3..7.3 support.
* module/mes/psyntax-0.mes (ormap): New function.
  (eval): New function.
  (remprop): New function.
  ($sc-put-cte, $make-environment, environment?, syntax->list,
  syntax->vector, literal-identifier=?, $syntax-dispatch, eval-when):
  New variable.
2016-12-11 21:39:54 +01:00
Jan Nieuwenhuizen 8b172e3438 Add abs.
* module/mes/scm.mes (abs): New function.
2016-12-20 21:22:21 +01:00
Jan Nieuwenhuizen 7d5c3a0201 Support (sxml xpath) for Nyacc c99.
* module/sxml/xpath.mes: New file.
* module/sxml/xpath.upstream.mes: Import from Guile.
* AUTHORS: Mention it.
2016-12-20 20:12:47 +01:00
Jan Nieuwenhuizen 096a2ed52e Partial (rnrs arithmetic bitwise) support for Nyacc c99.
* module/rnrs/arithmetic/bitwise.mes: New file.
2016-12-20 20:11:35 +01:00
Jan Nieuwenhuizen d08a28cfc1 Add string->number.
* module/mes/scm.mes (string->number): New function.
2016-12-20 19:01:00 +01:00
Jan Nieuwenhuizen 489d7c7f51 Add unless.
* module/mes/scm.mes (unless): New syntax.
2016-12-20 15:48:10 +01:00
Jan Nieuwenhuizen 8e1b25368b Add iota.
* module/mes/scm.mes: (iota): New function.
* tests/scm.test (iota, iota 0, iota -1): New tests.
2016-12-20 19:25:26 +01:00
Jan Nieuwenhuizen 641653563d Partial srfi-43 support for Nyacc.
* module/srfi/srfi-43.mes: New file.
2016-12-20 11:31:46 +01:00
Jan Nieuwenhuizen f8bb463da6 Partial srfi-14 support for Nyacc.
* module/srfi/srfi-14.mes: New file.
* tests/srfi-14.test: New file.
* GNUmakefile (TESTS): Add it.
2016-12-20 12:26:20 +01:00
Jan Nieuwenhuizen c07f3e18ca Add delete, delq, vector-copy.
* module/mes/scm.mes (filter, delete, delq, vector-copy): New functions.
2016-12-20 11:19:40 +01:00
Jan Nieuwenhuizen d7d46b9546 Add negative?, positive?, zero?, 1+ 1-.
* module/mes/scm.mes (negative?, positive?, zero?, 1+, 1-): New functions.
2016-12-20 10:57:09 +01:00