Commit graph

147 commits

Author SHA1 Message Date
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