mes.git
4 years agoRefactor reader.
Jan Nieuwenhuizen [Sat, 24 Dec 2016 21:16:53 +0000 (22:16 +0100)]
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.

4 years agocore: Remove c3+r abbreviatons.
Jan Nieuwenhuizen [Sat, 24 Dec 2016 13:21:36 +0000 (14:21 +0100)]
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.

4 years agocore: Move dump, load, bload to lib.c.
Jan Nieuwenhuizen [Sat, 24 Dec 2016 13:05:33 +0000 (14:05 +0100)]
core: Move dump, load, bload to lib.c.

* lib.c (dump, load, bload): Move from mes.c
* mes.c (dump, load, bload): Remove.

4 years agocore: Add getenv, verbose module loading on MES_DEBUG.
Jan Nieuwenhuizen [Sat, 24 Dec 2016 13:09:48 +0000 (14:09 +0100)]
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.

4 years agocore: Add some error checking.
Jan Nieuwenhuizen [Sat, 24 Dec 2016 11:10:05 +0000 (12:10 +0100)]
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.

4 years agocore: Move reader and posix functions from mes.c
Jan Nieuwenhuizen [Sat, 24 Dec 2016 10:28:25 +0000 (11:28 +0100)]
core: Move reader and posix functions from mes.c

* mes.c (getchar, ungetchar, peekchar, peek_byte, read_byte,
  unread_byte, write_byte, read_input_file_env_, read_input_file_env):
  Remove.
* posix.c (getchar, ungetchar, peekchar, peek_byte, read_byte,
  unread_byte, write_byte): Move from mes.c.
* reader (read_input_file_env_, read_input_file_env): Move from mes.c.

4 years agocore: Remove unused symbols.
Jan Nieuwenhuizen [Sat, 24 Dec 2016 10:21:30 +0000 (11:21 +0100)]
core: Remove unused symbols.

* mes.c (scm_symbol_noexpand, scm_symbol_syntax,
 scm_symbol_quasisyntax, scm_symbol_unsyntax,
 scm_symbol_unsyntax_splicing, scm_symbol_quasiquote,
 scm_symbol_unquote, scm_symbol_unquote_splicing, scm_symbol_define,
 scm_symbol_define_macro): Remove.

4 years agoAdd write, add display test, some fixes.
Jan Nieuwenhuizen [Sat, 24 Dec 2016 10:10:11 +0000 (11:10 +0100)]
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.

4 years agocore: Remove display.
Jan Nieuwenhuizen [Sat, 24 Dec 2016 00:23:50 +0000 (01:23 +0100)]
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.

4 years agoImport srfi-26 from Guile.
Jan Nieuwenhuizen [Sat, 24 Dec 2016 07:34:19 +0000 (08:34 +0100)]
Import srfi-26 from Guile.

* module/srfi/srfi-26.scm: Import.
* module/srfi/srfi-26.mes: Include it.
* AUTHORS: Mention it.

4 years agocore: Remove symbol_to_list, char_to_integer, integer_to_char.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 22:25:49 +0000 (23:25 +0100)]
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.

4 years agocore: Remove string.c.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 21:48:27 +0000 (22:48 +0100)]
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.

4 years agocore: Remove number_to_string.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 21:08:03 +0000 (22:08 +0100)]
core: Remove number_to_string.

* string.c (number_to_string): Remove.
* module/mes/scm.mes (number->string): New function.

4 years agocore: Remove substring.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 20:44:54 +0000 (21:44 +0100)]
core: Remove substring.

* string.c (substring): Remove.
* module/mes/scm.mes (substring): New function.

4 years agocore: Remove string_length.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 20:26:16 +0000 (21:26 +0100)]
core: Remove string_length.

* module/mes/scm.mes (string-length): New function.

4 years agocore: Remove list_to_string.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 20:21:54 +0000 (21:21 +0100)]
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.

4 years agocore: Remove string-append.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 19:56:37 +0000 (20:56 +0100)]
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.

4 years agocore: Remove string.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 19:44:04 +0000 (20:44 +0100)]
core: Remove string.

* string.c (string): Remove.
* module/mes/type-0.mes (string): New function.

4 years agoAdd exit.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 19:31:45 +0000 (20:31 +0100)]
Add exit.

* lib.c (exit_): Rename from builtin_exit.
* module/mes/scm.mes (list): Remove.

4 years agocore: Remove last_pair, list_ref, string_ref.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 19:09:57 +0000 (20:09 +0100)]
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.

4 years agocore: Make closure real type.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 17:48:36 +0000 (18:48 +0100)]
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.

4 years agocore: Remove quote, quasiquote, quasisyntax.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 17:11:46 +0000 (18:11 +0100)]
core: Remove quote, quasiquote, quasisyntax.

* mes.c (quote, quasiquote, quasisyntax): Remove.

4 years agocore: Remove make_lambda.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 17:10:31 +0000 (18:10 +0100)]
core: Remove make_lambda.

* mes.c (make_lambda): Remove.

4 years agocore: Remove type.c.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 17:05:45 +0000 (18:05 +0100)]
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.

4 years agocore: Remove gc_show.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 16:05:04 +0000 (17:05 +0100)]
core: Remove gc_show.

* mes.c (gc_show): Remove.

4 years agocore: Remove add_environment.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 16:02:23 +0000 (17:02 +0100)]
core: Remove add_environment.

* mes.c (add_environment): Remove.  Update callers.
  (scm_symbol_dot): New global.

4 years agocore: Remove make_string.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 15:38:07 +0000 (16:38 +0100)]
core: Remove make_string.

* mes.c (MAKE_STRING): New macro.
  (make_string): Remove.  Update callers.
* string.c: Update callers.

4 years agocore: Remove make_ref.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 15:31:56 +0000 (16:31 +0100)]
core: Remove make_ref.

* mes.c (MAKE_REF): New macro.
  (make_ref): Remove.  Update callers.

4 years agocore: Remove make_char.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 15:26:00 +0000 (16:26 +0100)]
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.

4 years agocore: Remove make_number.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 15:22:19 +0000 (16:22 +0100)]
core: Remove make_number.

* mes.c (MAKE_NUMBER): New macro.
  (tmp_num_, tmp_num_2): New function.
  (make_number): Remove.  Update callers.

4 years agoRemove make_function.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 15:02:36 +0000 (16:02 +0100)]
Remove make_function.

* mes.c (make_function): Remove.

4 years agocore: Remove make_keyword.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 14:53:57 +0000 (15:53 +0100)]
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.

4 years agocore: Remove make_macro.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 14:47:52 +0000 (15:47 +0100)]
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.

4 years agocore: Simplify lookup.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 10:31:34 +0000 (11:31 +0100)]
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.

4 years agoRemove lookup-char.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 10:26:35 +0000 (11:26 +0100)]
Remove lookup-char.

* reader.c (lookup_char): Remove.
* module/mes/read-0.mes (lookup-char): Remove.
  (read-word): Rewrite using quote.

4 years agocore: Cleanup symbol initialization and lookup.
Jan Nieuwenhuizen [Fri, 23 Dec 2016 09:38:41 +0000 (10:38 +0100)]
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.

4 years agocore: Remove most of reader.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 22:42:28 +0000 (23:42 +0100)]
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.

4 years agoRefactor reader.
Jan Nieuwenhuizen [Sun, 25 Dec 2016 11:37:35 +0000 (12:37 +0100)]
Refactor reader.

* module/mes/read-0.mes (eat-whitespace): More efficient ordering/peeking.
* module/mes/read-0.mes (read-word): Handle tab.

4 years agocore: Disable reader.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 20:23:49 +0000 (21:23 +0100)]
core: Disable reader.

* mes.c (READER): Switch off.
* module/mes/read-0.mes (eat-whitespace): Handle #;.

4 years agocore: Do some tail call elimination.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 15:50:51 +0000 (16:50 +0100)]
core: Do some tail call elimination.

* mes.c (eval_apply): Use goto instead of return.

4 years agocore: One big eval_apply.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 15:34:28 +0000 (16:34 +0100)]
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.

4 years agocore: Remove vm_call_lambda.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 15:16:09 +0000 (16:16 +0100)]
core: Remove vm_call_lambda.

* mes.c (vm_call_lambda): Remove.
 (call_lambda): Use begin_env.

4 years agoSupport PEG from Guile.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 19:16:44 +0000 (20:16 +0100)]
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.

4 years agoSupport pmatch from Guile.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 18:49:58 +0000 (19:49 +0100)]
Support pmatch from Guile.

* module/mes/pmatch.scm: New file.
* module/mes/pmatch.mes: New file.
* AUTHORS: Mention it.

4 years agoUse include-from-path for psyntax.pp.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 18:49:41 +0000 (19:49 +0100)]
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.

4 years agoUse include-from-path for upstream.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 18:34:41 +0000 (19:34 +0100)]
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.

4 years agoAdd string-copy, string=, string=?, char<?, char>?, char<=?, char>=?.
Jan Nieuwenhuizen [Sun, 11 Dec 2016 20:26:27 +0000 (21:26 +0100)]
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 "".

4 years agocore: Remove quasiquote, quasisyntax.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 14:41:43 +0000 (15:41 +0100)]
core: Remove quasiquote, quasisyntax.

* quasiquote.c: Remove.
* mes.c: Remove callers.
* GNUmakefile (mes.o): Remove dependency on quasiquote.

4 years agocore: Disable quasiquote.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 14:36:29 +0000 (15:36 +0100)]
core: Disable quasiquote.

* mes.c (QUASIQUOTE): Switch off.
* tests/read.test: Remove quasiquote tests.

4 years agoRefactor quasiquote.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 11:11:55 +0000 (12:11 +0100)]
Refactor quasiquote.

* module/mes/quasiquote.mes (quasiquote): Refactor.
* tests/quasiquote.test: Add tests.

4 years agocore: Bugfix append with one argument.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 13:22:40 +0000 (14:22 +0100)]
core: Bugfix append with one argument.

* mes.c (append): Handle one argument.
* tests/base.test ("append", "append 0" ... "append 5"): New tests.

4 years agocore: Do macro expansion only once.
Jan Nieuwenhuizen [Thu, 22 Dec 2016 07:31:20 +0000 (08:31 +0100)]
core: Do macro expansion only once.

* mes.c (vm_eval_env): I will expand this macro only once.

4 years agoAdd psyntax-based quasisyntax.
Jan Nieuwenhuizen [Wed, 21 Dec 2016 15:48:33 +0000 (16:48 +0100)]
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.

4 years agocore: Remove define.
Jan Nieuwenhuizen [Wed, 21 Dec 2016 21:22:34 +0000 (22:22 +0100)]
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.

4 years agonyacc: Support enhanced Guile-1.8.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 21:16:14 +0000 (22:16 +0100)]
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.

4 years agoNyacc example scripts: support Guile-1.8.
Jan Nieuwenhuizen [Mon, 19 Dec 2016 21:14:04 +0000 (22:14 +0100)]
Nyacc example scripts: support Guile-1.8.

4 years agoAdd Nyacc example scripts.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 14:44:09 +0000 (15:44 +0100)]
Add Nyacc example scripts.

* guile/nyacc-calc.scm: New file.
* guile/nyacc.scm: New file.
* scripts/nyacc-calc.mes: New file.
* scripts/nyacc.mes: New file.
* GNUmakefile (mes-check, guile-check): Run them.

4 years agonyacc: Add mes modules.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 14:47:55 +0000 (15:47 +0100)]
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

4 years agonyacc: Use standard \return rather than \cr.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 14:39:36 +0000 (15:39 +0100)]
nyacc: Use standard \return rather than \cr.

4 years agoImport Nyacc 0.72.0.
Jan Nieuwenhuizen [Sat, 17 Dec 2016 21:34:43 +0000 (22:34 +0100)]
Import Nyacc 0.72.0.

* module/nyacc: Import module/nyacc.

4 years agoImport psyntax from Guile-1.8: R7RS with-ellipsis.
Jan Nieuwenhuizen [Mon, 19 Dec 2016 18:41:43 +0000 (19:41 +0100)]
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.

4 years agoPrepare for psyntax-6.3..7.3 support.
Jan Nieuwenhuizen [Sun, 11 Dec 2016 20:39:54 +0000 (21:39 +0100)]
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.

4 years agoAdd abs.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 20:22:21 +0000 (21:22 +0100)]
Add abs.

* module/mes/scm.mes (abs): New function.

4 years agocore: Bugfix unread_byte.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 21:28:29 +0000 (22:28 +0100)]
core: Bugfix unread_byte.

* mes.c (unread_byte): Return SCM value instead of stray int.

4 years agoAdd ash.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 19:10:43 +0000 (20:10 +0100)]
Add ash.

* math.c (ash): New function.
* tests/scm.test (ash, ash -1): New tests.

4 years agoSupport (sxml xpath) for Nyacc c99.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 19:12:47 +0000 (20:12 +0100)]
Support (sxml xpath) for Nyacc c99.

* module/sxml/xpath.mes: New file.
* module/sxml/xpath.upstream.mes: Import from Guile.
* AUTHORS: Mention it.

4 years agoPartial (rnrs arithmetic bitwise) support for Nyacc c99.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 19:11:35 +0000 (20:11 +0100)]
Partial (rnrs arithmetic bitwise) support for Nyacc c99.

* module/rnrs/arithmetic/bitwise.mes: New file.

4 years agoNicer closure and builtin procedure display.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 18:13:31 +0000 (19:13 +0100)]
Nicer closure and builtin procedure display.

* display.c (display): Show closure as procedure with formal
  parameters.  Display ariry as fake parameters with builtin.

4 years agoAdd string->number.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 18:01:00 +0000 (19:01 +0100)]
Add string->number.

* module/mes/scm.mes (string->number): New function.

4 years agoAdd unless.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 14:48:10 +0000 (15:48 +0100)]
Add unless.

* module/mes/scm.mes (unless): New syntax.

4 years agoAdd iota.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 18:25:26 +0000 (19:25 +0100)]
Add iota.

* module/mes/scm.mes: (iota): New function.
* tests/scm.test (iota, iota 0, iota -1): New tests.

4 years agoPartial srfi-43 support for Nyacc.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 10:31:46 +0000 (11:31 +0100)]
Partial srfi-43 support for Nyacc.

* module/srfi/srfi-43.mes: New file.

4 years agoPartial srfi-14 support for Nyacc.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 11:26:20 +0000 (12:26 +0100)]
Partial srfi-14 support for Nyacc.

* module/srfi/srfi-14.mes: New file.
* tests/srfi-14.test: New file.
* GNUmakefile (TESTS): Add it.

4 years agoAdd delete, delq, vector-copy.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 10:19:40 +0000 (11:19 +0100)]
Add delete, delq, vector-copy.

* module/mes/scm.mes (filter, delete, delq, vector-copy): New functions.

4 years agoAdd negative?, positive?, zero?, 1+ 1-.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 09:57:09 +0000 (10:57 +0100)]
Add negative?, positive?, zero?, 1+ 1-.

* module/mes/scm.mes (negative?, positive?, zero?, 1+, 1-): New functions.

4 years agoAdd missing srfi-1 functions for Nyacc.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 09:44:43 +0000 (10:44 +0100)]
Add missing srfi-1 functions for Nyacc.

* module/srfi/srfi-1.scm (fold, fold-right, remove, append-reverse,
  remove!): New functions.
* tests/srfi-1.test: New file.
* GNUmakefile (TESTS): Add it.
* module/srfi/srfi-1.upstream.mes: Import bits from Guile-1.8.
* AUTHORS: Mention it.

4 years agoAdd even?, odd?.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 09:41:39 +0000 (10:41 +0100)]
Add even?, odd?.

* module/mes/scm.mes (even?, odd?): New function.

4 years agoBugfix: for-each with two lists.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 11:23:10 +0000 (12:23 +0100)]
Bugfix: for-each with two lists.

* module/mes/scm.mes (for-each): Fix for two lists.  Always return *unspecified*.

4 years agoAdd and=>.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 08:03:05 +0000 (09:03 +0100)]
Add and=>.

* module/mes/base.scm (and=>): New function.

4 years agoAdd eqv?.
Jan Nieuwenhuizen [Tue, 20 Dec 2016 06:51:50 +0000 (07:51 +0100)]
Add eqv?.

* module/mes/base.scm (eqv?): New function.

4 years agoClosure is not a pair.
Jan Nieuwenhuizen [Mon, 19 Dec 2016 18:35:38 +0000 (19:35 +0100)]
Closure is not a pair.

* module/mes/base.mes (closure_p, mes_car, mes_cdr): New function.
  (pair_p): Closure is not a pair.
* NEWS: Mention it.
* psyntax-0.mes (self-evaluating?): Add closure?.

4 years agoBugfix: support map^3.
Jan Nieuwenhuizen [Mon, 19 Dec 2016 18:32:17 +0000 (19:32 +0100)]
Bugfix: support map^3.

* module/mes/base-0.scm (map): Support third list, add more visible
  error when used with 4 or more list.

4 years agoResurrect quasisyntax support.
Jan Nieuwenhuizen [Fri, 16 Dec 2016 14:10:03 +0000 (15:10 +0100)]
Resurrect quasisyntax support.

* mes.c (the_unsyntaxers): New symbol.
  (mes_builtins)[QUASISYNTAX]: Initialize it, add to environment.
* quasiquote.c (add_unsyntaxers): Use it.
  (vm_eval_quasisyntax): New function.
  (eval_quasisyntax): Use it.

4 years agoAdd psyntax-based srfi-9.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 15:05:35 +0000 (16:05 +0100)]
Add psyntax-based srfi-9.

* module/srfi/srfi-9-psyntax.mes: New file.

4 years agoAdd support for including Guile files.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 14:48:49 +0000 (15:48 +0100)]
Add support for including Guile files.

* module/mes/guile.mes: New file.
* module/mes/pretty-print.mes: New file.

4 years agoSupport include and include-from-path.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 14:43:06 +0000 (15:43 +0100)]
Support include and include-from-path.

* module/mes/base-0.mes (include, include-from-path): New function.

4 years agoSupport backslash in string.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 14:39:12 +0000 (15:39 +0100)]
Support backslash in string.

* reader.c (read_string): Handle '\\'.
* tests/read.test: Add it.

4 years agoSupport #\alarm, #\vtab.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 14:21:05 +0000 (15:21 +0100)]
Support #\alarm, #\vtab.

* mes.c (char_alarm): New variable.
  (char_vtab): Rename from char_vt.
* reader.c (read_character): Add alarm, update vtab.
* display.c (display): Likewise.
* module/language/c/lexer.mes (read-string): Use vtab.

4 years agoSupport non-nested #| |# comment.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 09:11:22 +0000 (10:11 +0100)]
Support non-nested #| |# comment.

* module/mes/read-0.mes (read-word, read-block-comment): Implement #|.
* reader.c (read_word, read_block_comment)[READER]: Likewise.
* tests/read.test: Test it.
* NEWS: Mention it.

4 years agoSupport #; comment.
Jan Nieuwenhuizen [Sun, 18 Dec 2016 09:02:49 +0000 (10:02 +0100)]
Support #; comment.

* module/mes/read-0.mes (read-word): Implement #;.
* reader.c (read_word)[READER]: Likewise.
* tests/read.test: Test it.
* NEWS: Mention it.

4 years agoMinimal syntactic exception support.
Jan Nieuwenhuizen [Sat, 17 Dec 2016 21:21:46 +0000 (22:21 +0100)]
Minimal syntactic exception support.

* module/mes/catch.mes: New file.
* tests/catch.test: New file.
* GNUmakefile (TEST): Add it.

4 years agoMinimal syntactic fluids support.
Jan Nieuwenhuizen [Sat, 17 Dec 2016 13:51:45 +0000 (14:51 +0100)]
Minimal syntactic fluids support.

* module/mes/fluids.mes: New file.
* tests/fluids.test: New file.
* GNUmakefile (TESTS): Add it.

4 years agoAdd string-prefix?, symbol-prefix, symbol-append.
Jan Nieuwenhuizen [Sat, 17 Dec 2016 14:42:44 +0000 (15:42 +0100)]
Add string-prefix?, symbol-prefix, symbol-append.

* module/mes/scm.mes (string-prefix?, symbol-prefix, symbol-append):
  New function,

4 years agoAdd list-head, list-tail.
Jan Nieuwenhuizen [Sat, 17 Dec 2016 13:44:34 +0000 (14:44 +0100)]
Add list-head, list-tail.

* module/mes/scm (list-head, list-tail): New function.

4 years agocore: Bugfix number-based-cells: allow displaying (current-module).
Jan Nieuwenhuizen [Sat, 17 Dec 2016 13:43:42 +0000 (14:43 +0100)]
core: Bugfix number-based-cells: allow displaying (current-module).

* display.c (display): Handle cell_symbol_quote as symbol.

4 years agoMake guile switchable in GNUmakefile.
Jan Nieuwenhuizen [Wed, 21 Dec 2016 16:08:36 +0000 (17:08 +0100)]
Make guile switchable in GNUmakefile.

* GNUmakefile (GUILE): New variable.  Update users.
* guile/mes-0.scm (mes?, guile-1.8?, guile-2?): New variables.
* module/mes/base.mes (guile?): Remove.
* module/mes/base-0.mes (effective-version, mes?, guile?, guile-1.8?,
  guile-2?): New variables.
* tests/cwv.test: Support Guile 1.8.

4 years agoResurrect guile-mescc with guile-2.1.5.
Jan Nieuwenhuizen [Sat, 17 Dec 2016 09:57:38 +0000 (10:57 +0100)]
Resurrect guile-mescc with guile-2.1.5.

* scripts/include.mes: Grep all files.
* GNUmakefile (mescc.cat): Update for mes-use-module; list all toplevel inputs.
* module/language/c/lexer.mes: Use (system base lalr).
* module/language/c/parser.mes: Likewise.
* module/language/c/compiler.mes: Likewise.  Remove encoding on output port.
* scripts/mescc.mes: Remove BROKEN comment.

4 years agooptargs guile
Jan Nieuwenhuizen [Sun, 25 Dec 2016 10:13:51 +0000 (11:13 +0100)]
optargs guile

4 years agoSupport Guile optargs.
Jan Nieuwenhuizen [Fri, 16 Dec 2016 22:34:08 +0000 (23:34 +0100)]
Support Guile optargs.

* module/mes/optargs.upstream.mes: Import latest non-syntax-case
  version from Guile.
* AUTHORS: Add it.
* module/mes/optargs.scm: New file.
* tests/optargs.test: New file.
* GNUmakefile (TESTS): Add it.
* NEWS: Update.

4 years agoSupport => in cond.
Jan Nieuwenhuizen [Fri, 16 Dec 2016 19:18:38 +0000 (20:18 +0100)]
Support => in cond.

* module/mes/base-0.mes (cond): Support =>.
* module/mes/rea-0.mes (cond): Update.
* NEWS: Update.