mes.git
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.

4 years agocore: Support keywords.
Jan Nieuwenhuizen [Fri, 16 Dec 2016 22:30:33 +0000 (23:30 +0100)]
core: Support keywords.

* display.c (display): Handle keyword.
* mes.c (type_t): Add KEYWORD.
  (eq_p): Handle it.
  (make_keyword): New function.
* reader.c (lookup): Use it.
* type.c (keyword_p): New function.
* NEWS: Update.

4 years agoHandle form-feed.
Jan Nieuwenhuizen [Fri, 16 Dec 2016 17:30:54 +0000 (18:30 +0100)]
Handle form-feed.

* module/mes/read-0.mes (eat-whitespace, read-word): Handle form-feed.
* reader.c (eat_whitespace, read_word): Likewise.

4 years agocore: Make symbols constants.
Jan Nieuwenhuizen [Wed, 14 Dec 2016 18:02:19 +0000 (19:02 +0100)]
core: Make symbols constants.

* mes.c (apply_env,eval_env): Rewrite using switch.
* build-aux/mes-snarf.scm (symbol->header): Define constants.
  (symbol->source): Only update g_free and init cells.

4 years agoExtend Scheme reader, reduce C reader dependency.
Jan Nieuwenhuizen [Tue, 13 Dec 2016 18:58:34 +0000 (19:58 +0100)]
Extend Scheme reader, reduce C reader dependency.

* mes.c (bload_env): Mark as internal.
  (load_env): Likewise.  Load Scheme reader from source.  Remove dumping.
  (dump): New function.
* (vm_begin_env): Allow for gc while read_input_file_env.
  (mes_builtins): Add *dot*.
  (read_input_file_env)[!READER]: Invoke read-input-file.
* module/mes/read-0.mes (read-env): New function.
  (read-word): Support quasisyntax.
  Remove usage of ' thoughout.
* module/mes/repl.mes (repl): Use read instead of read-env.
* guile/mes.scm (environment): Add *dot*.
* guile/reader.mes: Update.
* NEWS: Update.

4 years agoSilence garbage collector.
Jan Nieuwenhuizen [Tue, 13 Dec 2016 19:55:50 +0000 (20:55 +0100)]
Silence garbage collector.

* GNUmakefile: unexport MES_DEBUG.

4 years agoUpdate README.
Jan Nieuwenhuizen [Tue, 13 Dec 2016 06:14:59 +0000 (07:14 +0100)]
Update README.

* README: Add a paragraph with current status.

4 years agoguix hash: 0nbdjvmsyarp4vfg3r9hhhnabv11z1b7isw4g09x3kjd0r1lx0mh
Jan Nieuwenhuizen [Mon, 12 Dec 2016 20:01:31 +0000 (21:01 +0100)]
guix hash: 0nbdjvmsyarp4vfg3r9hhhnabv11z1b7isw4g09x3kjd0r1lx0mh

4 years agoRelease 0.3. v0.3
Jan Nieuwenhuizen [Mon, 12 Dec 2016 20:00:02 +0000 (21:00 +0100)]
Release 0.3.

* configure (VERSION): Bump to 0.3.
* mes.c (main): Likewise.
* module/mes/repl.mes: Likewise.

4 years agoUpdate Mes in Guile.
Jan Nieuwenhuizen [Mon, 12 Dec 2016 19:07:17 +0000 (20:07 +0100)]
Update Mes in Guile.

* guile/mes.scm: Update for guile-2.2.
* guile/mes.mes: Update from module/mes/mes-0.mes.
* guile/reader.mes: Update from module/mes/read-0.mes.

4 years agoResurrect Mes in Guile.
Jan Nieuwenhuizen [Mon, 12 Dec 2016 14:41:48 +0000 (15:41 +0100)]
Resurrect Mes in Guile.

* guile/mes.mes: New file, from the archives.
* guile/mes.scm: Updates.

4 years agoAvoid garbage returns.
Jan Nieuwenhuizen [Sun, 11 Dec 2016 19:13:56 +0000 (20:13 +0100)]
Avoid garbage returns.

* posix.c (set-current-input-port): Return current-input-port.
  (force_output): Return scm_unspecified.

4 years agoUpdate documentation.
Jan Nieuwenhuizen [Sat, 10 Dec 2016 21:47:13 +0000 (22:47 +0100)]
Update documentation.

* README: Add make targets.
* INSTALL: Add guix.
* HACKING: Add info on sc.

4 years agocore: Resurrect QUASIQUOTE=0.
Jan Nieuwenhuizen [Sun, 11 Dec 2016 17:40:42 +0000 (18:40 +0100)]
core: Resurrect QUASIQUOTE=0.

* mes.c (mes_builtins) [!QUASIQUOTE]: Do not add unquoters.
* module/mes/base-0.mes (push!, pop!, load, mes-use-module): Rewrite
  without quasiquote.
* module/mes/quasiquote.mes (quasiquote): Rewrite using if, and.
* module/srfi/srfi-0 (cond-expand): Rewrite without quasiquote.

4 years agoAdd loadable modules.
Jan Nieuwenhuizen [Wed, 7 Dec 2016 19:26:41 +0000 (20:26 +0100)]
Add loadable modules.

* module/mes/base-0.mes (mes-use-module): Implement.
* module/mes: Update users.
* HACKING: Update.
* NEWS: Update.
* configure (main): Use shell expansion for prefix.
* make/install.make (install): Substitute prefix.

4 years agoUse syntax rather than psyntax.
Jan Nieuwenhuizen [Wed, 7 Dec 2016 22:27:44 +0000 (23:27 +0100)]
Use syntax rather than psyntax.

* module/language/c/parser.mes: Switch to syntax.
* module/language/paren.mes: Likewise
* scripts/mescc.mes: Likewise
* scripts/paren.mes: Likewise
* scripts/repl.mes: Likewise
* tests/let-syntax.test: Likewise
* tests/match.test: Likewise
* tests/record.test: Likewise

4 years agoResurrect syntax.mes.
Jan Nieuwenhuizen [Wed, 7 Dec 2016 22:51:07 +0000 (23:51 +0100)]
Resurrect syntax.mes.

* module/mes/syntax.mes: New file.
* AUTHORS: List it.

4 years agocore: use FIXED_PRIMITIVES rather than environment cache.
Jan Nieuwenhuizen [Mon, 21 Nov 2016 20:43:06 +0000 (21:43 +0100)]
core: use FIXED_PRIMITIVES rather than environment cache.

* cache.c: Remove.
* define.c: Remove callers.
* mes.c: Likewise.
  (vm_eval_env) [FIXED_PRIMITIVES]: Hardcode car, cdr, cons, null_p.
* GNUmakefile: Update.

4 years agocore: Set max arena size.
Jan Nieuwenhuizen [Sun, 11 Dec 2016 17:41:08 +0000 (18:41 +0100)]
core: Set max arena size.

* mes.c (MAX_ARENA_SIZE): New global.
 (gc): Use it.

4 years agocore: Make arena size configurable.
Jan Nieuwenhuizen [Sun, 11 Dec 2016 07:50:51 +0000 (08:50 +0100)]
core: Make arena size configurable.

* mes.c (main): Read MES_ARENA.
* scripts/repl.mes: Set MES_ARENA to 5000000 if not already set.
  Fixes repl startup.

4 years agocore: Grow gc arena gradually.
Jan Nieuwenhuizen [Sun, 11 Dec 2016 07:23:15 +0000 (08:23 +0100)]
core: Grow gc arena gradually.

* mes.c: (gc_up_arena): New function.
 (gc): Use it when possible.
 (gc_init_cells, gc_init_news): New function.
 (mes_symbols): Use them.

4 years agocore: gc bugfixes.
Jan Nieuwenhuizen [Sat, 10 Dec 2016 11:07:04 +0000 (12:07 +0100)]
core: gc bugfixes.

* mes.c (make_tmps): New function.
  (make_symbols, gc): Use it.
  (vm_call_with_values_env): New vm function.
  (call-with-values): Call it.
  (eval_env): Do not call eval_env inline.
* define.c (vm_define_env): Use r2 rather than local name.
  (g_symbols): Rename from symbols.

4 years agocore: Split-off cache, display, reader.
Jan Nieuwenhuizen [Mon, 21 Nov 2016 08:36:32 +0000 (09:36 +0100)]
core: Split-off cache, display, reader.

* mes.c: Remove cache, display, reader functions.
* cache.c: New file.
* display.c: New file.
* reader.c: New file.

4 years agoAdd reader in Scheme.
Jan Nieuwenhuizen [Sat, 19 Nov 2016 22:25:24 +0000 (23:25 +0100)]
Add reader in Scheme.

* module/mes/read-0.mes: New file.
* mes.c (char_to_integer, integer_to_char, null_p): Move to core.
 (peek_byte, read_byte, unread_byte): New function.
 (main): --dump, --load: New option.
* lib.c (char_to_integer, integer_to_char): Remove.
* NEWS: Update.

4 years agocore: Cleanup cells.
Jan Nieuwenhuizen [Mon, 21 Nov 2016 08:30:59 +0000 (09:30 +0100)]
core: Cleanup cells.

* mes.c: Use accessors rather than g_cell[] access throughout.

4 years agocore: Add function indirection.
Jan Nieuwenhuizen [Sat, 19 Nov 2016 21:31:30 +0000 (22:31 +0100)]
core: Add function indirection.

* mes.c (functions): New array.
  (scm_t): Change function pointer to index.
  (make_cell): Handle function.
  (call): Update for function change.
  (display_): Likewise.
  (make_function): New function.
* build-aux/mes-snarf.scm (function->source): Update declarations.
  (function->environment): New function.

4 years agocore: Number based cells.
Jan Nieuwenhuizen [Mon, 21 Nov 2016 08:28:34 +0000 (09:28 +0100)]
core: Number based cells.

* mes.c (scm_t): Change car, string, ref, cdr, macro, vector into g_cell index
  [WAS]: scm_t pointer.
* define.c: Update.
* lib.c: Update.
* math.c: Update.
* posix.c: Update.
* quasiquote.c: Update.
* string.c: Update.
* type.c: Update.
* build-aux/mes-snarf.mes Update.
* tests/gc-4.test: New test.
* tests/gc-5.test: New test.
* tests/gc-6.test: New test.

4 years agocore: Integrate garbage collector/jam scraper.
Jan Nieuwenhuizen [Fri, 28 Oct 2016 16:42:03 +0000 (18:42 +0200)]
core: Integrate garbage collector/jam scraper.

* mes.c (r0, r1, r2, r3, stack):  New globals.
  (gc_loop): Handle MACRO and SCM.
  (gc_copy): Handle FUNCTION, allow for pre-allocated SCM and SYMBOL.
  (assq): Flag any BROKEN_HEARTs.
  (vm_call): New function.  Enables moving C stack to GC stack.
  (evlis_env, apply_env, eval_env, expand_macro_env, begin_env,
  if_env): Use vm_call-indirection.
  (call_lambda): New function.
  (vm_apply_env): Rename from apply_env.  Remove parameters, instead
  use r1, r2 and r0.
  (vm_evlis_env, vm_eval_env, vm_expand_macro_env, vm_begin_env,
  vm_if_env): Likewise.
  (acons): New function.
  (mes_environment) [!MES_FULL, MES_MINI]: Add cpp switches to create minimally
  filled environment, for debugging.
  (main): Print free value at exit.
* define.c (define_env): Use vm_call-indirection.
  (vm_define_env): Rename from define_env.
* quasiquote.c (eval_quasiquote): Use vm_call-indirection.
  (vm_eval_quasiquote): Rename from eval_quasiquote.
* tests/gc-2.test: New test.
  tests/gc-2a.test: New test.
  tests/gc-3.test: New test.

4 years agoAdd sicp garbage example: tests/gc-1.test.
Jan Nieuwenhuizen [Thu, 27 Oct 2016 19:00:08 +0000 (21:00 +0200)]
Add sicp garbage example: tests/gc-1.test.

4 years agocore: Make using GC in switchable, set to off; on dumps core.
Jan Nieuwenhuizen [Thu, 27 Oct 2016 18:46:29 +0000 (20:46 +0200)]
core: Make using GC in switchable, set to off; on dumps core.

4 years agocore: Add garbage collector/jam collector experiment.
Jan Nieuwenhuizen [Thu, 27 Oct 2016 14:44:09 +0000 (16:44 +0200)]
core: Add garbage collector/jam collector experiment.

* mes.c (gc, gc_loop, gc_copy, gc_move, gc_relocate_car,
  gc_relocate_cdr, gc_flip): New function.
* tests/gc-0.test: New file.

4 years agoAdd mes gc test setup.
Jan Nieuwenhuizen [Wed, 26 Oct 2016 17:54:03 +0000 (19:54 +0200)]
Add mes gc test setup.

* tests/gc.test: New file.

4 years agoguix hash: 09axqivywpw0l9lm7pk1ncp6690vfv658z731z674ih73yqs5qma
Jan Nieuwenhuizen [Mon, 12 Dec 2016 19:35:07 +0000 (20:35 +0100)]
guix hash: 09axqivywpw0l9lm7pk1ncp6690vfv658z731z674ih73yqs5qma

4 years agoRelease 0.2. v0.2
Jan Nieuwenhuizen [Mon, 21 Nov 2016 13:18:01 +0000 (14:18 +0100)]
Release 0.2.

* configure (VERSION): Bump to 0.2.
* mes.c (main): Likewise.
* module/mes/repl.mes: Likewise.

4 years agoUpdate NEWS.
Jan Nieuwenhuizen [Mon, 21 Nov 2016 13:16:52 +0000 (14:16 +0100)]
Update NEWS.

4 years agotest: Run psyntax before record.
Jan Nieuwenhuizen [Thu, 10 Nov 2016 09:20:47 +0000 (10:20 +0100)]
test: Run psyntax before record.

* GNUmakefile (TESTS): Run psyntax before record.

4 years agotest: Add psyntax closure tests.
Jan Nieuwenhuizen [Tue, 8 Nov 2016 20:05:01 +0000 (21:05 +0100)]
test: Add psyntax closure tests.

* tests/closure.test (closure 7, closure 8, closure 9): New test.

4 years agocore: Show more info on apply error.
Jan Nieuwenhuizen [Sat, 5 Nov 2016 14:33:16 +0000 (15:33 +0100)]
core: Show more info on apply error.

* mes.c (apply_env): Be more specific about what cannot be applied.

4 years agotest: Add toplevel begin define test.
Jan Nieuwenhuizen [Sat, 5 Nov 2016 12:46:22 +0000 (13:46 +0100)]
test: Add toplevel begin define test.

* tests/base.test (top begin define): New test.

4 years agocore: Bugfix: report name of undefined variable.
Jan Nieuwenhuizen [Sat, 5 Nov 2016 10:08:10 +0000 (11:08 +0100)]
core: Bugfix: report name of undefined variable.

* mes.c (assert_defined): Add variable as parmeter, print it.  Update
  callers.

4 years agocore: Use switch in display_helper.
Jan Nieuwenhuizen [Thu, 3 Nov 2016 21:11:18 +0000 (22:11 +0100)]
core: Use switch in display_helper.

*mes (display_helper): Use switch.

4 years agocore: Refactor eval.
Jan Nieuwenhuizen [Thu, 3 Nov 2016 20:43:01 +0000 (21:43 +0100)]
core: Refactor eval.

* mes.c (eval_env): Rename from builtin_eval, Update callers.  Use switch.

4 years agocore: One SCM type for function.
Jan Nieuwenhuizen [Thu, 3 Nov 2016 20:28:05 +0000 (21:28 +0100)]
core: One SCM type for function.

* mes.c (function_t): New struct.
  (type): One type for function.
  (call): Refactor.
* build-aux/mes-snarf.mes: Use arity annotation.  WAS: args.  Update
  annotations.

4 years agocore: Cleanup macro expansion.
Jan Nieuwenhuizen [Thu, 3 Nov 2016 09:39:22 +0000 (10:39 +0100)]
core: Cleanup macro expansion.

* mes.c (builtin_eval): Call expand_macro_env after handling primitives.
  (expand_macro_env): Include syntax-case expansion, remove skipping
  of primitives.
  (sc_expand_env): Remove.

4 years agocore: Factor-out assert_defined.
Jan Nieuwenhuizen [Thu, 3 Nov 2016 09:37:08 +0000 (10:37 +0100)]
core: Factor-out assert_defined.

* mes.c (assert_defined): New function.
  (set_env_x): Use it.
  (builtin_eval): Use it.