Commit Graph

338 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen c93096fe5f Bugfix: support map^3.
* module/mes/base-0.scm (map): Support third list, add more visible
  error when used with 4 or more list.
2016-12-19 19:32:17 +01:00
Jan Nieuwenhuizen 15eabee623 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.
2016-12-16 15:10:03 +01:00
Jan Nieuwenhuizen e8b78a1077 Add psyntax-based srfi-9.
* module/srfi/srfi-9-psyntax.mes: New file.
2016-12-18 16:05:35 +01:00
Jan Nieuwenhuizen 77a9146aa5 Add support for including Guile files.
* module/mes/guile.mes: New file.
* module/mes/pretty-print.mes: New file.
2016-12-18 15:48:49 +01:00
Jan Nieuwenhuizen 276ffdd7ba Support include and include-from-path.
* module/mes/base-0.mes (include, include-from-path): New function.
2016-12-18 15:43:06 +01:00
Jan Nieuwenhuizen 6b4bf34ff2 Support backslash in string.
* reader.c (read_string): Handle '\\'.
* tests/read.test: Add it.
2016-12-18 15:39:12 +01:00
Jan Nieuwenhuizen 89f771f18a 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.
2016-12-18 15:21:05 +01:00
Jan Nieuwenhuizen 95d913097d 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.
2016-12-18 10:11:22 +01:00
Jan Nieuwenhuizen 9dcff14bba Support #; comment.
* module/mes/read-0.mes (read-word): Implement #;.
* reader.c (read_word)[READER]: Likewise.
* tests/read.test: Test it.
* NEWS: Mention it.
2016-12-18 10:02:49 +01:00
Jan Nieuwenhuizen a8b16ba013 Minimal syntactic exception support.
* module/mes/catch.mes: New file.
* tests/catch.test: New file.
* GNUmakefile (TEST): Add it.
2016-12-17 22:21:46 +01:00
Jan Nieuwenhuizen 4744b315c9 Minimal syntactic fluids support.
* module/mes/fluids.mes: New file.
* tests/fluids.test: New file.
* GNUmakefile (TESTS): Add it.
2016-12-17 14:51:45 +01:00
Jan Nieuwenhuizen 58537e7c66 Add string-prefix?, symbol-prefix, symbol-append.
* module/mes/scm.mes (string-prefix?, symbol-prefix, symbol-append):
  New function,
2016-12-17 15:42:44 +01:00
Jan Nieuwenhuizen dab37a844b Add list-head, list-tail.
* module/mes/scm (list-head, list-tail): New function.
2016-12-17 14:44:34 +01:00
Jan Nieuwenhuizen 738eabbe0e core: Bugfix number-based-cells: allow displaying (current-module).
* display.c (display): Handle cell_symbol_quote as symbol.
2016-12-17 14:43:42 +01:00
Jan Nieuwenhuizen f3c464d07b 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.
2016-12-21 17:08:36 +01:00
Jan Nieuwenhuizen d4dc29c498 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.
2016-12-17 10:57:38 +01:00
Jan Nieuwenhuizen a36896662e optargs guile 2016-12-25 11:13:51 +01:00
Jan Nieuwenhuizen 8531e9d898 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.
2016-12-16 23:34:08 +01:00
Jan Nieuwenhuizen bbeb4708e5 Support => in cond.
* module/mes/base-0.mes (cond): Support =>.
* module/mes/rea-0.mes (cond): Update.
* NEWS: Update.
2016-12-16 20:18:38 +01:00
Jan Nieuwenhuizen 46a617f16e 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.
2016-12-16 23:30:33 +01:00
Jan Nieuwenhuizen 885f48757a Handle form-feed.
* module/mes/read-0.mes (eat-whitespace, read-word): Handle form-feed.
* reader.c (eat_whitespace, read_word): Likewise.
2016-12-16 18:30:54 +01:00
Jan Nieuwenhuizen 94d1c65bde 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.
2016-12-14 19:02:19 +01:00
Jan Nieuwenhuizen dd1daf92e4 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.
2016-12-13 19:58:34 +01:00
Jan Nieuwenhuizen 1aba68dc6a Silence garbage collector.
* GNUmakefile: unexport MES_DEBUG.
2016-12-13 20:55:50 +01:00
Jan Nieuwenhuizen 62eab78f62 Update README.
* README: Add a paragraph with current status.
2016-12-13 07:14:59 +01:00
Jan Nieuwenhuizen fe2e58cd15 guix hash: 0nbdjvmsyarp4vfg3r9hhhnabv11z1b7isw4g09x3kjd0r1lx0mh 2016-12-12 21:01:31 +01:00
Jan Nieuwenhuizen 90e5f16ef9 Release 0.3.
* configure (VERSION): Bump to 0.3.
* mes.c (main): Likewise.
* module/mes/repl.mes: Likewise.
2016-12-12 21:00:02 +01:00
Jan Nieuwenhuizen 661954a352 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.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen ddca30271e Resurrect Mes in Guile.
* guile/mes.mes: New file, from the archives.
* guile/mes.scm: Updates.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen 0da6a4a248 Avoid garbage returns.
* posix.c (set-current-input-port): Return current-input-port.
  (force_output): Return scm_unspecified.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen 696ff8bc77 Update documentation.
* README: Add make targets.
* INSTALL: Add guix.
* HACKING: Add info on sc.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen 3a72f1f186 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.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen 2b577eaee0 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.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen b74d048b95 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
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen fa9952fa91 Resurrect syntax.mes.
* module/mes/syntax.mes: New file.
* AUTHORS: List it.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen b92a8f17f8 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.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen 0a614e6543 core: Set max arena size.
* mes.c (MAX_ARENA_SIZE): New global.
 (gc): Use it.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen 753b63818c 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.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen 0bdad95f61 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.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen e4e29f00b0 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.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen f26c7222b2 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.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen 1614d13439 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.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen e6a0257a79 core: Cleanup cells.
* mes.c: Use accessors rather than g_cell[] access throughout.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen d50b0fe24a 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.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen 61e42e8527 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.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen 25c29ecb6d 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.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen c035a59094 Add sicp garbage example: tests/gc-1.test. 2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen f3225a77e2 core: Make using GC in switchable, set to off; on dumps core. 2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen 99cedbfbde 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.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen 2866c75907 Add mes gc test setup.
* tests/gc.test: New file.
2016-12-12 20:35:18 +01:00