mes.git
4 years agotest: More values, call-with-values tests.
Jan Nieuwenhuizen [Wed, 2 Nov 2016 08:40:58 +0000 (09:40 +0100)]
test: More values, call-with-values tests.

* tests/cwv.test: New file.
* GNUmakefile (TESTS): Add it.
* tests/scm.test: Remove value and call-with-values tests.

4 years agopsyntax: More tests.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 22:32:33 +0000 (23:32 +0100)]
psyntax: More tests.

* tests/psyntax.test: Add tests.

4 years agocore: Fix quasisyntax reading.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 22:30:22 +0000 (23:30 +0100)]
core: Fix quasisyntax reading.

* mes.c (readword): Avoid unspecified behaviour in comma list.

4 years agotest: Add new macros.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 22:28:57 +0000 (23:28 +0100)]
test: Add new macros.

* module/mes/test.mes (pass-if-equal, expect-fail): New macros.

4 years agorepl: Add sc-expand meta command, include syntax-case.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 15:18:59 +0000 (16:18 +0100)]
repl: Add sc-expand meta command, include syntax-case.

* module/mes/repl.mes (,sc-expand): New meta command.
* scripts/repl.mes: Include psyntax-0, psyntax-1, psyntax.  Not used as
  basis for match yet.

4 years agoAdd syntax-case based syntax-rules.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 19:41:49 +0000 (20:41 +0100)]
Add syntax-case based syntax-rules.

* module/mes/psyntax-1.mes (syntax-rules): New syntax transformer,
  based on syntax-case.
  (define-syntax-rule): New macro.
  (let-syntax): New macro, for syntax-case.
* tests/let-syntax.test: Switch to syntax-case.
* tests/psyntax.test: Add syntax-rules and syntax-rule test.

4 years agoBugfix include.mes: skip commented modules.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 19:32:38 +0000 (20:32 +0100)]
Bugfix include.mes: skip commented modules.

* scripts/include.mes: Make regexp more strict.

4 years agoInitial psyntax integration.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 15:16:20 +0000 (16:16 +0100)]
Initial psyntax integration.

* mes.c (sc_expand_env): New function.
  (builtin_eval): Use it.
* module/mes/psyntax-0.mes: New file.
* module/mes/psyntax-1.mes: New file.
* tests/psyntax.test: New file.
* GNUmakefile (TESTS): Add it.

4 years agopsyntax: Add missing (interaction-environment) to eval.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 14:46:54 +0000 (15:46 +0100)]
psyntax: Add missing (interaction-environment) to eval.

* module/mes/psyntax.mes: Add (interaction-environment) to eval.

4 years agoImport psyntax from Guile-1.3a.
Jan Nieuwenhuizen [Sat, 29 Oct 2016 17:05:06 +0000 (19:05 +0200)]
Import psyntax from Guile-1.3a.

* module/mes/psyntax.mes: New file.
* module/mes/psyntax.ss: New file.

commit 230c435383087a1e6ad60d9c98d3ec75dd2c3e49
Author: Mikael Djurfeldt <djurfeldt@nada.kth.se>
Date:   Tue Aug 19 01:28:50 1997 +0000

    * syncase.scm: New file: Guile-adaption for syntax-case macros.
    psyntax.pp, psyntax.ss: Syntax-case macros, portable version 2 by
    R. Kent Dybvig, Oscar Waddell, Bob Hieb and Carl Bruggeman

4 years agoExit upon error.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 19:33:59 +0000 (20:33 +0100)]
Exit upon error.

* module/mes/scm.mes (error): Add exit 1.

4 years agoMescc: avoid `if'.
Jan Nieuwenhuizen [Sun, 20 Nov 2016 20:17:49 +0000 (21:17 +0100)]
Mescc: avoid `if'.

* module/language/c/lexer.mes (keywords): Produce `If'.
* module/language/c/parser.mes (c-parser): Use `If.'

4 years agocore: Add compile time switch for quasisyntax.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 15:01:34 +0000 (16:01 +0100)]
core: Add compile time switch for quasisyntax.

* mes.c [QUASISYNTAX]: New switch.  Default off.
 (builtin_eval) [QUASISYNTAX]: Handle syntax, unsyntax, quasisyntax.
* quasiquote.c (syntax, unsyntax, unsyntax_splicing, eval_quasisyntax,
  add_unsyntaxers) [QUASISYNTAX]: Available only.

4 years agoMore error handling on apply_env.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 14:42:50 +0000 (15:42 +0100)]
More error handling on apply_env.

* mes.c (apply_env): Assert if applying *unspecified*.

4 years agoBugfix assq_ref_cache for running without environment cache.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 14:39:36 +0000 (15:39 +0100)]
Bugfix assq_ref_cache for running without environment cache.

* mes.c (assq_ref_cache) [!ENV_CACHE]: Return *undefined* if nothing
  found.

4 years agoError handling on failing set!.
Jan Nieuwenhuizen [Sun, 30 Oct 2016 14:38:27 +0000 (15:38 +0100)]
Error handling on failing set!.

* mes.c (set_env_x): Produce error message [WAS: dump core].

4 years agoSimplify toplevel read.
Jan Nieuwenhuizen [Sat, 29 Oct 2016 16:43:03 +0000 (18:43 +0200)]
Simplify toplevel read.

* mes.c (read_file_env): Rename from read_file.
 (load_file_env): New function.
 (main): Use it.

4 years agoboot: fix ignored.
Jan Nieuwenhuizen [Sat, 29 Oct 2016 16:35:06 +0000 (18:35 +0200)]
boot: fix ignored.

* module/mes/loop-0.mes: Wrap read-file in begin.
* module/mes/mes-0.mes: Remove ignored.

4 years agoImplement apply with multiple arguments.
Jan Nieuwenhuizen [Sat, 29 Oct 2016 14:35:44 +0000 (16:35 +0200)]
Implement apply with multiple arguments.

* module/mes/base-0.mes (apply): Handle multiple arguments.
* tests/base.test: (apply, apply 1, apply 2): New test.

4 years agoFix values.
Jan Nieuwenhuizen [Sat, 29 Oct 2016 14:06:41 +0000 (16:06 +0200)]
Fix values.

* mes.c (call): Respect any other non-value arguments.
* tests/scm.test (values, values 2, values 3, call-with-values): New test.

4 years agoDefine garbage collector/jam collector primitives.
Jan Nieuwenhuizen [Wed, 26 Oct 2016 17:44:36 +0000 (19:44 +0200)]
Define garbage collector/jam collector primitives.

* mes.c (make_cell): New primitive alongside make_vector for allocation.
  (cons, make_char, make_macro, make_number, make_ref,
  internal_make_symbol, make_vector): Use it.

4 years agoImplement strings and symbols as list of characters [WAS: c-string].
Jan Nieuwenhuizen [Tue, 25 Oct 2016 14:50:19 +0000 (16:50 +0200)]
Implement strings and symbols as list of characters [WAS: c-string].

* mes.c (scm_t): Add string field.
  (make_string, internal_lookup_symbol, internal_make_symbol,
  make_symbol, lookup, readword): Take scm*.  Update callers.
  (display_helper): Support string field.
  (append_char): New function.
  (readstring): Use it.  Produce scm*.
  (cstring_to_list): New function.
  (add_environment, internal_make_symbol): Use it.
  (list_of_char_equal_p): New function.
  (internal_lookup_symbol): Use it.
* lib.c (list_ref): New function.
* string.c (string_ref): Use it.
  (string, string_append, string_length, substring, number_to_string,
  string_to_symbol, symbol_to_string): Update to list-of-characters
  implementation.

4 years agoEnvironment cache bugfix for define.
Jan Nieuwenhuizen [Tue, 25 Oct 2016 06:59:20 +0000 (08:59 +0200)]
Environment cache bugfix for define.

* define.c (define): Invalidate cache.  Fixes vector test.
* GNUmakefile (mes-check, guile-check): Use set -e.  Fixes skipping over errors.

4 years agoIntroduce reference type, use vectors of SCM.
Jan Nieuwenhuizen [Mon, 24 Oct 2016 22:21:28 +0000 (00:21 +0200)]
Introduce reference type, use vectors of SCM.

* mes.c (type): Add REF.
  (scm_t): Add ref, change vector to *scm_t.  Update users.
  (alloc): New function.
  (cons, make_char, make_macro, make_number, make_string,
  internal_make_symbol, make_vector): Use it.
  (make_ref): New function.
  (vector_entry): New function.
  (make_vector, list_to_vector, vector_set_x): Use it.
  (vector_ref): Dereference REF entry.
  (display_helper): Handle REF.
* lib.c (vector_to_list): Handle REF.
* type.c (ref_p): New function.
* tests/vector.test (vector list): New test.

Bugfix vector-ref.

* mes.c (vector-ref): Make copies of simple values.  Fixes lalr.
* tests/vector.test (vector-set! 3): New test.

4 years agoGuile gc experiment: remove global scan variable.
Jan Nieuwenhuizen [Mon, 24 Oct 2016 15:49:40 +0000 (17:49 +0200)]
Guile gc experiment: remove global scan variable.

4 years agoGuile gc experiment: add garbage collection.
Jan Nieuwenhuizen [Mon, 24 Oct 2016 09:52:01 +0000 (11:52 +0200)]
Guile gc experiment: add garbage collection.

4 years agoGuile gc experiment: add lists and display.
Jan Nieuwenhuizen [Sun, 23 Oct 2016 15:21:56 +0000 (17:21 +0200)]
Guile gc experiment: add lists and display.

* guile/gc.scm (gc-nil, gc-null?, gc-list, gc-display, make-symbol):
  New function.

4 years agoGuile gc experiment: add pairs.
Jan Nieuwenhuizen [Sun, 23 Oct 2016 12:22:53 +0000 (14:22 +0200)]
Guile gc experiment: add pairs.

* guile/gc.scm (cell-type, cell-index, gc-cons, gc-car, gc-cdr): New
  function.

4 years agoGuile gc experiment.
Jan Nieuwenhuizen [Sun, 23 Oct 2016 10:32:40 +0000 (12:32 +0200)]
Guile gc experiment.

guile/gc.scm: New file.

4 years agoRevert "Speedup boot eval/apply."
Jan Nieuwenhuizen [Sun, 23 Oct 2016 12:25:37 +0000 (14:25 +0200)]
Revert "Speedup boot eval/apply."

This reverts commit 6326b3103156fd79cd7bebbb351194626cc8a64b.

4 years agoSpeedup boot eval/apply.
Jan Nieuwenhuizen [Sat, 22 Oct 2016 19:43:39 +0000 (21:43 +0200)]
Speedup boot eval/apply.

* module/mes/mes-0.scm (apply-env, evlis, eval-expand,
  eval-quasiquote): use IF iso COND: factor 3.
  (apply-env): Use lambda iso let: another 30%.

4 years agoguix hash: 115jycdz8i1r5sj2fsjqcrh456mayxzaykb8cxxxc3wxfkj8nagf
Jan Nieuwenhuizen [Mon, 12 Dec 2016 19:33:26 +0000 (20:33 +0100)]
guix hash: 115jycdz8i1r5sj2fsjqcrh456mayxzaykb8cxxxc3wxfkj8nagf

4 years agoRelease 0.1. v0.1
Jan Nieuwenhuizen [Sun, 20 Nov 2016 20:47:47 +0000 (21:47 +0100)]
Release 0.1.

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

4 years agoDocumentation update.
Jan Nieuwenhuizen [Sun, 20 Nov 2016 20:45:12 +0000 (21:45 +0100)]
Documentation update.

* HACKING: Target is R6RS-like, at least having syntax-case.
* README: Likewise.
* guix.scm: Likewise.

4 years agoAvoid gratuitous consing with begin and quasiquote.
Jan Nieuwenhuizen [Sun, 23 Oct 2016 08:08:04 +0000 (10:08 +0200)]
Avoid gratuitous consing with begin and quasiquote.

* mes.c (apply_env, main): Call begin rather than eval with cons'ed
  symbol begin.
* module/mes/mes-0.mes (apply-env): Likewise.
* quasiquote.c (add_unquoters): cons global unquoters rather than
  creating it fresh.
* module/mes/mes-0.mes (add-unquoters): Likewise.

4 years agoRemove dead code.
Jan Nieuwenhuizen [Sat, 22 Oct 2016 18:58:33 +0000 (20:58 +0200)]
Remove dead code.

* mes.c (mes_environment): Remove dead code.

4 years agoMove other post-boot and derived functions to lib.c.
Jan Nieuwenhuizen [Sat, 22 Oct 2016 18:51:32 +0000 (20:51 +0200)]
Move other post-boot and derived functions to lib.c.

* mes.c (c*r, length, last_pair, builtin_list, vector_to_list,
  integer_to_char, char_to_integer, builtin_exit): Move to lib.c.
* lib.c: New file.
* GNUmakefile (mes.o): Depend on lib snarf output.

4 years agoMove strings to string.c.
Jan Nieuwenhuizen [Sat, 22 Oct 2016 18:18:03 +0000 (20:18 +0200)]
Move strings to string.c.

* mes.c (string, string_append, list_to_string, string_length,
  string_ref, substring, number_to_string, string_to_symbol,
  symbol_to_string): Move to string.c
* string.c: New file.
* GNUmakefile (mes.o): Depend on string snarf output.

4 years agoMove arithmetic functions to math.c.
Jan Nieuwenhuizen [Sat, 22 Oct 2016 18:07:12 +0000 (20:07 +0200)]
Move arithmetic functions to math.c.

* mes.c (greater_p, less_p, is_p, minus, divide, modulo, multiply,
  logior): Move to math.c.
* math.c: New file.
* GNUmakefile (mes.o): Depend on math snarf output.

4 years agoMove define, define-macro to define.c.
Jan Nieuwenhuizen [Sat, 22 Oct 2016 17:36:54 +0000 (19:36 +0200)]
Move define, define-macro to define.c.

* mes.c (define, define-macro): Move to define.c
* define.c: New file.
* GNUmakefile (mes.o): Depend on define snarf output.

4 years agoMove quasiquote to quasiquote.c.
Jan Nieuwenhuizen [Sat, 22 Oct 2016 17:26:12 +0000 (19:26 +0200)]
Move quasiquote to quasiquote.c.

* mes.c (unquote, unquote_splicing, syntax, unsyntax,
  unsyntax_splicing, eval_quasiquote, eval_quasisyntax, add_unquoters,
  add_unsyntaxers): Move to quasiquote.c
* quasiquote.c: New file.
* GNUmakefile (mes.o): Depend on quasiquote snarf output.

4 years agoMove optional type predicates to type.c.
Jan Nieuwenhuizen [Sat, 22 Oct 2016 10:16:19 +0000 (12:16 +0200)]
Move optional type predicates to type.c.

* mes.c (char_p, macro_p, number_p, pair_p, string_p, symbol_p,
  vector_p, builtin_p, boolean_p): Move to type.c
* type.c: New file.
* GNUmakefile (mes.o): Depend on type snarf output.
* module/mes/loop-0.mes (cond, map, let, or, and not, evlis-env,
  apply-env, eval-expand, uquote, add-unquoters, eval,
  expand-macro-env, eval-begin-env, eval-if-env, sexp:define,
  env:define, env:macro): Move to mes-0.mes.
* module/mes/mes-0.mes: New file.
* module/mes/type-0.mes: New file.
* scripts/include.mes: If BOOT, also include mes-0.mes.  If TYPE0,
  also include type-0.mes.

4 years agoUpdate NEWS.
Jan Nieuwenhuizen [Mon, 12 Dec 2016 19:31:41 +0000 (20:31 +0100)]
Update NEWS.

* NEWS: Note specials fix and booting with smaller core.

4 years agoGenerate C header and includes using snarfing.
Jan Nieuwenhuizen [Fri, 21 Oct 2016 20:44:50 +0000 (22:44 +0200)]
Generate C header and includes using snarfing.

* mes.c: Move specific renames and n-args to alist annotation.
* build-aux/mes-snarf.scm: New file.
* GNUmakefile (mes.environment.h): Use it.
  (mes.h): Remove.
  (clean): Update.
  (mes.o): New dependency rule.
* .gitignore: Update.

4 years agoRevert "Flip sign of cached symbols: only search cache if symbol is cached."
Jan Nieuwenhuizen [Sat, 22 Oct 2016 16:13:37 +0000 (18:13 +0200)]
Revert "Flip sign of cached symbols: only search cache if symbol is cached."

This reverts commit cef058be0d6ef5322f74e644bbcd96f1725c6327.

4 years agoFlip sign of cached symbols: only search cache if symbol is cached.
Jan Nieuwenhuizen [Fri, 21 Oct 2016 18:44:18 +0000 (20:44 +0200)]
Flip sign of cached symbols: only search cache if symbol is cached.

* mes.c (cache_save): Flip sign when caching and invalidating.
  (cache_invalidate): Flip sign when invalidating.

4 years agonamed let-fu FIXME
Jan Nieuwenhuizen [Thu, 20 Oct 2016 22:00:05 +0000 (00:00 +0200)]
named let-fu FIXME

4 years agoboot: fix builtin? tests.
Jan Nieuwenhuizen [Fri, 21 Oct 2016 09:14:33 +0000 (11:14 +0200)]
boot: fix builtin? tests.

* tests/scm.test: Test primitives, not eval.

4 years agoEnvironment cache heuristicts.
Jan Nieuwenhuizen [Fri, 21 Oct 2016 08:43:32 +0000 (10:43 +0200)]
Environment cache heuristicts.

* mes.c (ENV_HEAD): New define.
  (assq_ref_cache): Use it.

4 years agoboot: support apply.
Jan Nieuwenhuizen [Fri, 21 Oct 2016 08:41:29 +0000 (10:41 +0200)]
boot: support apply.

* module/mes/loop-0.mes (eval-env): Add clause for apply-env.

4 years agoboot: Remove label support from Scheme.
Jan Nieuwenhuizen [Fri, 21 Oct 2016 08:39:13 +0000 (10:39 +0200)]
boot: Remove label support from Scheme.

* module/mes/loop-0.scm (apply-env): Remove label clause.

4 years agoboot: vector support.
Jan Nieuwenhuizen [Fri, 21 Oct 2016 08:51:09 +0000 (10:51 +0200)]
boot: vector support.

* mes.c (make_vector): Change to scm interface.
  (temp_number): New global.
  (list_to_vector): Use it.
* module/mes/scm.mes (c:make-vector): New function.
* tests/scm.test: Remove vector tests.
* tests/vector.test: New file.
* GNUmakefile (TESTS): Add it.

4 years agoAvoid let* in scm.mes.
Jan Nieuwenhuizen [Fri, 21 Oct 2016 08:52:59 +0000 (10:52 +0200)]
Avoid let* in scm.mes.

* module/mes/scm.mes (case, max, min): Avoid let*.

4 years agoloop-0: define and, let and cache-invalidate-range.
Jan Nieuwenhuizen [Thu, 20 Oct 2016 22:02:24 +0000 (00:02 +0200)]
loop-0: define and, let and cache-invalidate-range.

4 years agoboot: support quasiquote in eval.
Jan Nieuwenhuizen [Thu, 20 Oct 2016 21:33:35 +0000 (23:33 +0200)]
boot: support quasiquote in eval.

* module/mes/loop-0.mes (eval-env): Add quasiquote support.

4 years agoRemove evcon from loop-0.
Jan Nieuwenhuizen [Tue, 18 Oct 2016 17:50:07 +0000 (19:50 +0200)]
Remove evcon from loop-0.

* module/mes/loop-0.mes (loop-0): Handle define-macro.
 (cond): New macro.
 (eval-env-expand): Remove 'cond clause.
 (evcon): Remove.

4 years agoSwitch fat-c/boot using environment variable BOOT.
Jan Nieuwenhuizen [Thu, 20 Oct 2016 20:03:17 +0000 (22:03 +0200)]
Switch fat-c/boot using environment variable BOOT.

* GNUmakefile: check for BOOT, set CFLAGS.
* mes.c: Remove hardcoded BOOT define.
* scripts/include.mes: include loop-0 when BOOT is set.

4 years agoImplement eval/apply in Scheme.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 16:53:31 +0000 (18:53 +0200)]
Implement eval/apply in Scheme.

* module/mes/loop-0.mes: New file.
* module/mes/mes.mes: Remove

4 years agoReduce eval/apply in core, extend in Scheme.
Jan Nieuwenhuizen [Thu, 20 Oct 2016 16:43:33 +0000 (18:43 +0200)]
Reduce eval/apply in core, extend in Scheme.

* mes.c (eval_env_)[BOOT]: Rename from eval_env.  Remove define, defin-macro.
  (eval_env): New function.
  (make_macro): Swap parameter ordering.
  (apply_env)[BOOT]: Support label.

4 years agoAvoid adding top of environment to cache.
Jan Nieuwenhuizen [Wed, 19 Oct 2016 22:21:06 +0000 (00:21 +0200)]
Avoid adding top of environment to cache.

* mes.c (assq_ref_cache): Only consider caching symbols deeper than
  4*CACHE_SIZE depth.  50% speedup.

4 years agoImplement environment cache.
Jan Nieuwenhuizen [Wed, 19 Oct 2016 22:11:48 +0000 (00:11 +0200)]
Implement environment cache.

* mes.c (cache_save, cache_lookup, cache_invalidate,
  cache_invalidate_range): Implement cache for environment.
  (assq_ref_cache): New function, perform cached lookups.
  (builtin_eval,lookup_macro): Use it.
  (set_cdr_x): Invalidate cache.
  (set_x): Likewise.
  (apply_env): Likewise.

4 years agoIntroduce SCM type for special symbols.
Jan Nieuwenhuizen [Thu, 20 Oct 2016 17:19:32 +0000 (19:19 +0200)]
Introduce SCM type for special symbols.

* GNUmakefile (mes.h): Also export SCM to symbols.i
* mes.c: Introduce SCM type for special symbols.
  (builtin_eval): Rename from eval_env.  Update callers.
* module/mes/base-0.mes (eval): Remove.
* module/mes/repl.mes (repl): Use eval.

4 years agoRemove static primitives hack.
Jan Nieuwenhuizen [Thu, 20 Oct 2016 07:37:14 +0000 (09:37 +0200)]
Remove static primitives hack.

* mes.c (internal_primitive_p, internal_p, lookup_primitive,
  mes_primitives): Remove.

4 years agoRefactor primitives lookup.
Jan Nieuwenhuizen [Wed, 19 Oct 2016 05:22:15 +0000 (07:22 +0200)]
Refactor primitives lookup.

* mes.c (lookup_primitive_): Rename from internal_lookup_primitive,
  use scm-compatible signature.
  (lookup): Update caller.
  (eval_env): Check for builtins first.

4 years agoRemove unused symbol.
Jan Nieuwenhuizen [Tue, 18 Oct 2016 18:05:51 +0000 (20:05 +0200)]
Remove unused symbol.

* mes.c (symbol_cond): Remove.

4 years agoAdd report to closure test.
Jan Nieuwenhuizen [Tue, 18 Oct 2016 17:10:16 +0000 (19:10 +0200)]
Add report to closure test.

* tests/closure.test: Add report.

4 years agoRemove dead code from let.mes.
Jan Nieuwenhuizen [Tue, 18 Oct 2016 17:11:14 +0000 (19:11 +0200)]
Remove dead code from let.mes.

* module/mes/let.mes (simple-let, named-let, let): Remove dead code.

4 years agoAvoid cons* in base.
Jan Nieuwenhuizen [Tue, 18 Oct 2016 06:24:47 +0000 (08:24 +0200)]
Avoid cons* in base.

* module/mes/base-0.mes (cond, simple-let, let): Rewrite without cons*.
* module/mes/base.mes (or): Likewise.

4 years agoDifferentiate apply asserts.
Jan Nieuwenhuizen [Tue, 18 Oct 2016 07:21:49 +0000 (09:21 +0200)]
Differentiate apply asserts.

* mes.c (apply_env): Split bool assert into bool, number and string.

4 years agoAdd display tag for builtin procedures.
Jan Nieuwenhuizen [Tue, 18 Oct 2016 07:08:42 +0000 (09:08 +0200)]
Add display tag for builtin procedures.

* mes.c (display_helper): Show builtin functions as #<procedure ...>.

4 years agoRemove macro expansion from apply.
Jan Nieuwenhuizen [Mon, 17 Oct 2016 16:26:07 +0000 (18:26 +0200)]
Remove macro expansion from apply.

mes.c (apply_env): Remove macro expansion.

4 years agoAdd paredit workaround in scripts.
Jan Nieuwenhuizen [Mon, 17 Oct 2016 16:24:40 +0000 (18:24 +0200)]
Add paredit workaround in scripts.

* scripts/elf.mes: Add paredit parsing comment.
* scripts/repl.mes: Likewise.

4 years agomake tests standalone executable.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 15:34:51 +0000 (17:34 +0200)]
make tests standalone executable.

* tests/closure.test: Add shebang and boot-0 include.
* tests/let-syntax.test: Likewise.
* tests/let.test: Likewise.
* tests/match.test: Likewise.
* tests/quasiquote.test: Likewise.
* tests/record.test: Likewise.
* tests/scm.test: Likewise.
* GNUmakefile (mes-check): Run tests by exec'ing.

4 years agomake clean: remove symbols.i.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 12:57:30 +0000 (14:57 +0200)]
make clean: remove symbols.i.

* GNUmakefile (clean): remove symbols.i.

4 years agoUpdate documentation.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 12:00:40 +0000 (14:00 +0200)]
Update documentation.

* HACKING: Describe (mes-use-modules).
* NEWS: Update.

4 years agoAdd --help, --version.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 11:45:24 +0000 (13:45 +0200)]
Add --help, --version.

* mes.c (main): Handle --help, --version.
* scripts/include.mes: Handle --help.
* scripts/elf.mes: Pass any arguments on to mes.
* scripts/mescc.mes: Likewise.
* scripts/paren.mes: Likewise.
* scripts/repl.mes: Likewise.

4 years agoguix hash: 0g6lcms2hv1i8hdkfh2xz0g7jmsayisr7bcwkp47blkbapqpzpsf
Jan Nieuwenhuizen [Tue, 18 Oct 2016 22:36:08 +0000 (00:36 +0200)]
guix hash: 0g6lcms2hv1i8hdkfh2xz0g7jmsayisr7bcwkp47blkbapqpzpsf

4 years agoUpdate guix hash.
Jan Nieuwenhuizen [Tue, 18 Oct 2016 21:50:09 +0000 (23:50 +0200)]
Update guix hash.

* make/install.make (update-hash): New target.
* guix.scm: Prepare for update.

4 years agoAdd installation instructions.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 09:24:41 +0000 (11:24 +0200)]
Add installation instructions.

* INSTALL: New file.

4 years agoAdd guix.scm package recipe.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 09:27:39 +0000 (11:27 +0200)]
Add guix.scm package recipe.

* guix.scm: New file.

4 years agoPrepare for 0.1 release: update READMEs.
Jan Nieuwenhuizen [Sat, 15 Oct 2016 09:54:24 +0000 (11:54 +0200)]
Prepare for 0.1 release: update READMEs.

* NEWS: New file.
* AUTHORS: Add info about files taken from Scheme48.
* HACKING: Update with info from TODO.
* TODO: Remove.

4 years agoPrepare for 0.1 release: make install.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 06:14:50 +0000 (08:14 +0200)]
Prepare for 0.1 release: make install.

* make/install.make (install): Install documentation.

4 years agoPrepare for 0.1 release: installable scripts.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 06:00:04 +0000 (08:00 +0200)]
Prepare for 0.1 release: installable scripts.

* scripts/mes: New symlink.
* scripts/elf.mes: Use it.
* scripts/mescc.mes: Likewise, read all mes modules with include.mes.
* scripts/paren.mes: Likewise.
* scripts/repl.mes: Likewise.

4 years agoPrepare for 0.1 release: gnu-build-system.
Jan Nieuwenhuizen [Sat, 15 Oct 2016 22:34:23 +0000 (00:34 +0200)]
Prepare for 0.1 release: gnu-build-system.

* configure: New file.
* make/install.make: New file.
* .gitignore: Ignore generated files.
* build-aux/gitlog-to-changelog: New file.

4 years agoPrepare for 0.1 release: new directory structure.
Jan Nieuwenhuizen [Wed, 12 Oct 2016 21:40:11 +0000 (23:40 +0200)]
Prepare for 0.1 release: new directory structure.

* scripts/elf.mes: New file.
* scripts/include.mes: New file.
* scripts/mescc.mes: New file.
* scripts/paren.mes: New file.
* scripts/repl.mes: New file.
* doc/examples/main.c: Move from ./main.c.
* module/mes/base-0.mes: Move from ./base0.mes.
* module/mes/base.mes: Move from top.
* module/mes/elf.mes: Likewise.
* module/mes/let-syntax.mes: Likewise.
* module/mes/let.mes: Likewise.
* module/mes/mes.mes: Likewise.
* module/mes/quasiquote.mes: Likewise.
* module/mes/repl.mes: Likewise.
* module/mes/scm.mes: Likewise.
* module/mes/syntax.mes: Likewise.
* module/mes/lalr-0.mes: Move from lib/lalr.mes.
* module/mes/lalr.mes: Move from lib/lalr.scm.
* module/mes/match.mes: Move from lib/match.scm.
* module/mes/record-0.mes: Move from lib/record.mes.
* module/mes/record.mes: Move from lib/record.scm.
* module/mes/test.mes: Move flom lib/.
* module/rnrs/bytevectors.mes: Move from lib/rnrs.
* module/srfi/srfi-0.mes: Move from lib/srfi.
* module/srfi/srfi-1.mes: Likewise.
* module/srfi/srfi-9.mes: Likewise.
* module/language/c/lexer.mes: Move from ./c-lexer.scm.
* module/language/c/parser.mes: Move from ./mescc.scm.
* module/language/c/compiler.mes: New file, split from parser.mes.
* module/language/paren.mes: Move from ./paren.scm.
* module/mes/libc-i386.mes: New file, split from elf.mes.
* tests/base.test: Move from test/.
* tests/closure.test: Likewise.
* tests/let-syntax.test: Likewise.
* tests/let.test: Likewise.
* tests/match.test: Likewise.
* tests/quasiquote.test: Likewise.
* tests/record.test: Likewise.
* tests/scm.test: Likewise.
* hello.S: Remove.
* hello.c: Remove.
* loop2.mes: Remove.
* test/foo.test: Remove.

4 years agoRemove evcon (Sorry John).
Jan Nieuwenhuizen [Sat, 15 Oct 2016 09:56:18 +0000 (11:56 +0200)]
Remove evcon (Sorry John).

* mes.c (evcon): Remove, remove callers.
* base0-if.mes (cond): Rename from disabled-cond.

4 years agoSupport quasisyntax.
Jan Nieuwenhuizen [Sat, 15 Oct 2016 23:41:07 +0000 (01:41 +0200)]
Support quasisyntax.

* mes.c (eval_quasisyntax, add_unsyntaxers): New functions.
  (eval_env): Use them.

4 years agoAdd REPL.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 07:44:52 +0000 (09:44 +0200)]
Add REPL.

* mes.c (expand_macro_env, force_output): New function.  Use STRING_MAX
  for string buffers throughout.  (eval_env, eval_begin_env): Rename
  from eval, eval_begin.  Update callers.
* repl.mes: New file.
* base.mes (list?): Move from scm.mes.
* scm.mes (eval, apply, primitive-eval, expand-macro): New function.
* GNUmakefile: New repl target.

4 years agoAvoid 90% of cdr'ing environment, assuming static primitives.
Jan Nieuwenhuizen [Wed, 12 Oct 2016 19:14:06 +0000 (21:14 +0200)]
Avoid 90% of cdr'ing environment, assuming static primitives.

* mes.c (internal_primitive_p)[STATIC_PRIMITIVES: New function.
 (lookup_macro)[STATIC_PRIMITIVES]: Use it.
 (internal_lookup_primitive)[STATIC_PRIMITIVES]: New function.
 (lookup)[STATIC_PRIMITIVES]: Use it.
 (mes_primitives)[STATIC_PRIMITIVES]: New function.
 (main): Use it.
* base0-if.mes (disabled-cond): Rename from xcond.
* GNUmakefile: Add commented profiling CFLAGS.

4 years agoDo not use quasiquote in base0.
Jan Nieuwenhuizen [Sun, 16 Oct 2016 07:21:17 +0000 (09:21 +0200)]
Do not use quasiquote in base0.

* base0.scm (defined?): Rewrite without quasiquote.

4 years agoAdd procedure? to base.
Jan Nieuwenhuizen [Wed, 12 Oct 2016 20:58:35 +0000 (22:58 +0200)]
Add procedure? to base.

* base.mes (procedure?): Move from scm.mes.

4 years agospeedup: use ->car etc.
Jan Nieuwenhuizen [Sat, 8 Oct 2016 15:00:32 +0000 (17:00 +0200)]
speedup: use ->car etc.

4 years agoAvoid out-of-spec strncat usage.
Jan Nieuwenhuizen [Tue, 11 Oct 2016 16:50:14 +0000 (18:50 +0200)]
Avoid out-of-spec strncat usage.

mes.c (readword): Use character assignment instead of strncat.  Fixes
Valgrind nit.

4 years agoDiscern between primitive atoms and symbols.
Jan Nieuwenhuizen [Tue, 11 Oct 2016 05:10:01 +0000 (07:10 +0200)]
Discern between primitive atoms and symbols.

* mes.c (internal_symbol_p): New function.
 (eval): Use it.

4 years agoresurrect mescc.
Jan Nieuwenhuizen [Mon, 10 Oct 2016 21:54:48 +0000 (23:54 +0200)]
resurrect mescc.

4 years agocleanup and doc update.
Jan Nieuwenhuizen [Mon, 10 Oct 2016 21:24:44 +0000 (23:24 +0200)]
cleanup and doc update.

4 years agosyntax.mes: silence syntax error.
Jan Nieuwenhuizen [Mon, 10 Oct 2016 20:44:42 +0000 (22:44 +0200)]
syntax.mes: silence syntax error.

4 years agotest/scm.test: update.
Jan Nieuwenhuizen [Mon, 10 Oct 2016 20:42:05 +0000 (22:42 +0200)]
test/scm.test: update.

4 years agotest/match.test: pass.
Jan Nieuwenhuizen [Tue, 11 Oct 2016 16:51:30 +0000 (18:51 +0200)]
test/match.test: pass.

4 years agolib/match: ugly hygiene hack. FIXME.
Jan Nieuwenhuizen [Mon, 10 Oct 2016 18:53:42 +0000 (20:53 +0200)]
lib/match: ugly hygiene hack. FIXME.