Commit graph

466 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 fa0d10e121 nyacc: Add README.nyacc.
* README.nyacc: New file.
2016-12-26 08:05:00 +01:00
Jan Nieuwenhuizen 15518f92af tests: Move (ice-9 syncase) into cond-expand.
* tests/psyntax.mes: Move (ice-9 syncase) into cond-expand.  Fixes
  guile-2 deprecation messages.
2016-12-25 22:48:06 +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 43a1774750 core: Move GNUisms inside #if.
* mes.c: Move GNUisms inside #if, add Nyacc #ifs.
 (tmp_num2, tmp_num3): Remove.
 (make_tmps): Update.
 (g_free): Make simple int.  Update users.
* lib.c: Update users.
* build-aux/mes-snarf.scm (GCC?): New switch to enable GNU extensions.
2017-01-04 08:16:14 +01: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 cb1fa49767 core: Throw exceptions rather than asserts.
* lib.c (error): Throw instead of assert.
  (check_formals, check_apply): Update.
* mes.c (scm_symbol_unbound_variable, scm_symbol_not_a_pair,
  scm_symbol_system_error, scm_symbol_wrong_number_of_args,
  scm_symbol_wrong_type_arg, scm_symbol_unbound_variable): New symbols.
  (car, cdr, set_cdr_x, set_env_x, eval_apply, gc_up_arena): Update.
2016-12-28 22:26:33 +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 04bb0cb79d Revert "core: Display me debuggor CPS+CC."
This reverts commit 6c327b5bdceae6fc59ac8cce4aed99ea0a491846.
2016-12-28 16:37:06 +01:00
Jan Nieuwenhuizen 134f39ce22 core: Display me debuggor CPS+CC.
Having display in the core is handy for debugging.
This is a courtesy commit intended to prevent bitrot.

* GNUmakefile (mes.o): Depend on display.
* mes.c: Include display.
* display.c: New file.
2016-12-28 16:35:12 +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 c3a6d70f74 core: Stderr_ also print numbers.
* posix.c (stderr_): Handle numbers.
2017-01-04 21:45:10 +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 2ae1eec0eb core: Move GNUisms inside #if.
* mes.c: Move GNUisms inside #if, add Nyacc #ifs.
 (tmp_num2, tmp_num3): Remove.
 (make_tmps): Update.
 (g_free): Make simple int.  Update users.
* lib.c: Update users.
* build-aux/mes-snarf.scm (GCC?): New switch to enable GNU extensions.
2017-01-04 10:52:36 +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 3dd219b891 Fix core:car, core:cdr for specials.
* mes.c (car_, cdr_): Return special.  Fixes string->list, returning nil.
* tests/scm.test ("string-length", "string->list"): New tests.
2017-01-04 09:12:16 +01:00
Jan Nieuwenhuizen 9848c90738 core: Add continuation on stack.
* mes.c (r3): New stack variable.
  (mes_g_stack): Initialize it.
  (gc_push_frame): Add it.
  (gc_peek_frame): Set it.
2017-01-04 09:07:11 +01:00
Jan Nieuwenhuizen 23c1e33a6d core: Uniformize calling of apply.
* mes.c (eval_apply): Have apply take one argument, like all other vm
  functions: r1; cons of function f and argument list x.  Sorry John.
  (r2): Repurpose as save/load register.  Update users.
  (r3): Remove.
  (vm_call): Remove p2.  Update callers.
2017-01-04 09:05:56 +01:00
Jan Nieuwenhuizen a80ced8f84 core: Refactor stack handling.
* mes.c (gc_pop_frame, gc_push_frame): New Functions.
  (gc_frame, gc_stack): Remove.
  (vm_call): Update callers.
* lib.c (dump, bload_env): Update callers.
2017-01-04 08:52:04 +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 3d86df27c8 Update documentation.
* doc/ANNOUNCE-0.4: New file.
* NEWS: Typo.
2016-12-25 16:49:12 +01:00
Jan Nieuwenhuizen cc5627c08d guix hash: 1jpm8m8y2dqsl3sc6flf8da4rpdrqh6zgr2mghzjw0lg34v1r21j 2016-12-25 16:30:53 +01:00
Jan Nieuwenhuizen f84e97fc33 Release 0.4.
* configure (VERSION): Bump.
2016-12-25 16:26:48 +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 67c2f1537b Update documentation.
* HACKING: Update status, some ideas where to go next.
* NEWS: Update status.
* README: Update.
* doc/ANNOUNCE: Move from top.
* doc/ANNOUNCE-2: Likewise.
* doc/ANNOUNCE-0.3: New file.
2016-12-24 17:22:34 +01:00
Jan Nieuwenhuizen d0f2e1cabf make: Install nyacc scripts too.
* make/install.make (install): Add scripts/nyacc.mes, scripts/nyacc-calc.mes.
2016-12-25 00:49:00 +01:00
Jan Nieuwenhuizen 95a7782089 Revert "core: Display me debuggor."
This reverts commit 53ec23a0edcfdcb7dd4e32277e5a24e0a8fab5dd.
2016-12-25 11:54:14 +01:00
Jan Nieuwenhuizen 6014e56f68 core: Display me debuggor.
Having display in the core is handy for debugging.
This is a courtesy commit intended to prevent bitrot.

* GNUmakefile (mes.o): Depend on display.
* mes.c: Include display.
* display.c: New file.
2016-12-25 11:53:55 +01:00
Jan Nieuwenhuizen 9dcbdf2135 Revert "core: FAT_C_READER: Show your speed."
This reverts commit 5a9b9ac36bd33e497272b287ab1f0db715e01d38.
2016-12-25 09:57:19 +01:00
Jan Nieuwenhuizen d8ea0d593b core: FAT_C_READER: Show your speed.
scripts/nyacc.mes runs in 4s rather than 18s with fat C reader.
This is a courtesy commit intended to prevent bitrot.

* mes.c (quasiquote, unquote, unquote_splicing, syntax, quasisyntax,
  unsyntax, unsyntax_splicing): Add symbols.
* reader.c (char_eof, char_nul, char_alarm, char_backspace, char_tab,
  char_newline, char_vtab, char_page, char_return,
  char_space)[FAT_C_READER]: New global variables.
  (make_keyword, read_block_comment, read_character, read_hex,
  append_char, read_string, fat_c_lookup_, fat_c_eat_whitespace,
  fat_c_read_word): New functions.
  (eat_whitespace_, read_word_, lookup_)[FAT_C_READER]: Add hook.
2016-12-25 08:41:27 +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 f1e0165faf core: Move dump, load, bload to lib.c.
* lib.c (dump, load, bload): Move from mes.c
* mes.c (dump, load, bload): Remove.
2016-12-24 14:05:33 +01:00