Commit graph

2331 commits

Author SHA1 Message Date
Jan Nieuwenhuizen e282117de9 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.
2016-10-22 20:18:03 +02:00
Jan Nieuwenhuizen be2f3bc274 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.
2016-10-22 20:07:12 +02:00
Jan Nieuwenhuizen 27247383d7 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.
2016-10-22 19:36:54 +02:00
Jan Nieuwenhuizen bd7beddcda 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.
2016-10-22 19:26:12 +02:00
Jan Nieuwenhuizen 2586f0bb2c 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.
2016-10-22 12:16:19 +02:00
Jan Nieuwenhuizen c8fdae40d9 Update NEWS.
* NEWS: Note specials fix and booting with smaller core.
2016-12-12 20:31:41 +01:00
Jan Nieuwenhuizen 3e03a12a4d 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.
2016-10-21 22:44:50 +02:00
Jan Nieuwenhuizen 18aa0beaa9 Revert "Flip sign of cached symbols: only search cache if symbol is cached."
This reverts commit cef058be0d6ef5322f74e644bbcd96f1725c6327.
2016-10-22 18:13:37 +02:00
Jan Nieuwenhuizen 1684564ea1 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.
2016-10-21 20:44:18 +02:00
Jan Nieuwenhuizen bca8061232 named let-fu FIXME 2016-10-21 00:00:05 +02:00
Jan Nieuwenhuizen 497bbdc76f boot: fix builtin? tests.
* tests/scm.test: Test primitives, not eval.
2016-10-21 11:14:33 +02:00
Jan Nieuwenhuizen 2545605a69 Environment cache heuristicts.
* mes.c (ENV_HEAD): New define.
  (assq_ref_cache): Use it.
2016-10-21 10:43:32 +02:00
Jan Nieuwenhuizen 28b695510b boot: support apply.
* module/mes/loop-0.mes (eval-env): Add clause for apply-env.
2016-10-21 10:41:29 +02:00
Jan Nieuwenhuizen 2938f5155d boot: Remove label support from Scheme.
* module/mes/loop-0.scm (apply-env): Remove label clause.
2016-10-21 10:39:13 +02:00
Jan Nieuwenhuizen 46eca44fb4 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.
2016-10-21 10:51:09 +02:00
Jan Nieuwenhuizen 2926190567 Avoid let* in scm.mes.
* module/mes/scm.mes (case, max, min): Avoid let*.
2016-10-21 10:52:59 +02:00
Jan Nieuwenhuizen 37d27f66e3 loop-0: define and, let and cache-invalidate-range. 2016-10-21 00:02:24 +02:00
Jan Nieuwenhuizen 430455e886 boot: support quasiquote in eval.
* module/mes/loop-0.mes (eval-env): Add quasiquote support.
2016-10-20 23:33:35 +02:00
Jan Nieuwenhuizen 97f1d71de6 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.
2016-10-18 19:50:07 +02:00
Jan Nieuwenhuizen c8e87f3021 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.
2016-10-20 22:03:17 +02:00
Jan Nieuwenhuizen 596fa86cc4 Implement eval/apply in Scheme.
* module/mes/loop-0.mes: New file.
* module/mes/mes.mes: Remove
2016-10-16 18:53:31 +02:00
Jan Nieuwenhuizen 1d0cbcd59c 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.
2016-10-20 18:43:33 +02:00
Jan Nieuwenhuizen 1e62bbf8c9 Avoid adding top of environment to cache.
* mes.c (assq_ref_cache): Only consider caching symbols deeper than
  4*CACHE_SIZE depth.  50% speedup.
2016-10-20 00:21:06 +02:00
Jan Nieuwenhuizen 7885096526 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.
2016-10-20 00:11:48 +02:00
Jan Nieuwenhuizen d1b8f0ff0c 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.
2016-10-20 19:19:32 +02:00
Jan Nieuwenhuizen cdd903054c Remove static primitives hack.
* mes.c (internal_primitive_p, internal_p, lookup_primitive,
  mes_primitives): Remove.
2016-10-20 09:37:14 +02:00
Jan Nieuwenhuizen 9c986748e1 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.
2016-10-19 07:22:15 +02:00
Jan Nieuwenhuizen 035b0a8d5d Remove unused symbol.
* mes.c (symbol_cond): Remove.
2016-10-18 20:05:51 +02:00
Jan Nieuwenhuizen a4c3acc7ba Add report to closure test.
* tests/closure.test: Add report.
2016-10-18 19:10:16 +02:00
Jan Nieuwenhuizen d0addb3e99 Remove dead code from let.mes.
* module/mes/let.mes (simple-let, named-let, let): Remove dead code.
2016-10-18 19:11:14 +02:00
Jan Nieuwenhuizen 4ff96673c7 Avoid cons* in base.
* module/mes/base-0.mes (cond, simple-let, let): Rewrite without cons*.
* module/mes/base.mes (or): Likewise.
2016-10-18 08:24:47 +02:00
Jan Nieuwenhuizen 2a8d3c57b7 Differentiate apply asserts.
* mes.c (apply_env): Split bool assert into bool, number and string.
2016-10-18 09:21:49 +02:00
Jan Nieuwenhuizen b9bbac3d0c Add display tag for builtin procedures.
* mes.c (display_helper): Show builtin functions as #<procedure ...>.
2016-10-18 09:08:42 +02:00
Jan Nieuwenhuizen 0eae7674b6 Remove macro expansion from apply.
mes.c (apply_env): Remove macro expansion.
2016-10-17 18:26:07 +02:00
Jan Nieuwenhuizen 3098f84e9e Add paredit workaround in scripts.
* scripts/elf.mes: Add paredit parsing comment.
* scripts/repl.mes: Likewise.
2016-10-19 00:36:12 +02:00
Jan Nieuwenhuizen d18e50a569 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.
2016-10-19 00:36:12 +02:00
Jan Nieuwenhuizen 219a8cdfbb make clean: remove symbols.i.
* GNUmakefile (clean): remove symbols.i.
2016-10-19 00:36:12 +02:00
Jan Nieuwenhuizen 1e59009102 Update documentation.
* HACKING: Describe (mes-use-modules).
* NEWS: Update.
2016-10-19 00:36:12 +02:00
Jan Nieuwenhuizen ac4b1eed3f 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.
2016-10-19 00:36:12 +02:00
Jan Nieuwenhuizen c5aa93d67b guix hash: 0g6lcms2hv1i8hdkfh2xz0g7jmsayisr7bcwkp47blkbapqpzpsf 2016-10-19 00:36:08 +02:00
Jan Nieuwenhuizen b5af238305 Update guix hash.
* make/install.make (update-hash): New target.
* guix.scm: Prepare for update.
2016-10-18 23:50:09 +02:00
Jan Nieuwenhuizen ac6fb6feed Add installation instructions.
* INSTALL: New file.
2016-10-16 11:24:41 +02:00
Jan Nieuwenhuizen 7e4736f3d0 Add guix.scm package recipe.
* guix.scm: New file.
2016-10-16 11:27:39 +02:00
Jan Nieuwenhuizen 2001183928 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.
2016-10-15 11:54:24 +02:00
Jan Nieuwenhuizen 6d64e55500 Prepare for 0.1 release: make install.
* make/install.make (install): Install documentation.
2016-10-16 08:14:50 +02:00
Jan Nieuwenhuizen 323e78b190 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.
2016-10-16 08:00:04 +02:00
Jan Nieuwenhuizen 3128c4b976 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.
2016-10-16 00:34:23 +02:00
Jan Nieuwenhuizen d114634203 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.
2016-10-12 23:40:11 +02:00
Jan Nieuwenhuizen bd2b81755a Remove evcon (Sorry John).
* mes.c (evcon): Remove, remove callers.
* base0-if.mes (cond): Rename from disabled-cond.
2016-10-15 11:56:18 +02:00
Jan Nieuwenhuizen 83970245e5 Support quasisyntax.
* mes.c (eval_quasisyntax, add_unsyntaxers): New functions.
  (eval_env): Use them.
2016-10-16 01:41:07 +02:00