Commit Graph

88 Commits

Author SHA1 Message Date
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 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
Jan Nieuwenhuizen 2715e241e5 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.
2016-10-16 09:44:52 +02:00
Jan Nieuwenhuizen 422b6e6ce9 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.
2016-10-12 21:14:06 +02:00
Jan Nieuwenhuizen 1bb3d1de11 speedup: use ->car etc. 2016-10-08 17:00:32 +02:00
Jan Nieuwenhuizen c5e3e3818d Avoid out-of-spec strncat usage.
mes.c (readword): Use character assignment instead of strncat.  Fixes
Valgrind nit.
2016-10-11 18:50:14 +02:00
Jan Nieuwenhuizen 513bd09f76 Discern between primitive atoms and symbols.
* mes.c (internal_symbol_p): New function.
 (eval): Use it.
2016-10-11 07:10:01 +02:00
Jan Nieuwenhuizen a265f933d8 speedup: use ->car etc. 2016-10-08 17:00:32 +02:00
Jan Nieuwenhuizen 4514be76d9 use IF as primitive, drop using cond/evcon only option. 2016-10-08 16:54:59 +02:00
Jan Nieuwenhuizen 7c759e0670 c++ type-safety. 2016-10-08 10:14:17 +02:00
Jan Nieuwenhuizen e504998b03 assq: use while instead of recursion. 2016-10-08 08:47:23 +02:00
Jan Nieuwenhuizen 509bf3956e mes.c: uniquify symbols. 2016-10-08 08:41:30 +02:00
Jan Nieuwenhuizen ec8553dc4f mes.c: implement string->list. 2016-08-13 18:42:11 +02:00
Jan Nieuwenhuizen 697858f670 Revert "mes.c: use single malloc with arena."
This reverts commit 38c364faeff430a5ee28f402d24b073f6bf9a548.
2016-09-25 10:13:09 +02:00
Jan Nieuwenhuizen b955b84d20 mes.c: use single malloc with arena. 2016-08-13 00:58:00 +02:00
Jan Nieuwenhuizen 2097e9e4ef mes.c: display, newline: take optional port; add write-char, read hex #xXX. 2016-08-12 14:17:20 +02:00
Jan Nieuwenhuizen 287c0284fe Use IF iso COND as primitive; keep COND primitive as option. 2016-07-27 08:49:45 +02:00
Jan Nieuwenhuizen 56fcde0966 macro hax0rz 2016-07-27 00:32:30 +02:00
Jan Nieuwenhuizen 3864d434fc split-up test suite, implement quasiquote in scheme. 2016-07-25 14:39:56 +02:00
Jan Nieuwenhuizen f170735edb mescc: mes parses simplest main with lalr. 2016-07-25 01:12:22 +02:00
Jan Nieuwenhuizen 479d988e42 mes.c: add set-cdr, substring, string-ref. 2016-07-25 00:06:18 +02:00
Jan Nieuwenhuizen 87678add4a mes.c: support whitespace characters. 2016-07-24 23:41:16 +02:00
Jan Nieuwenhuizen 46387d411b mes.c: when reading `EOF', defer read control to program. 2016-07-24 18:28:45 +02:00
Jan Nieuwenhuizen 8dacd68fe8 mes.c, scm.c: add read-char, peek-char, char=?, char-alphabetic?. 2016-07-24 17:35:31 +02:00
Jan Nieuwenhuizen 2983578531 mes.c: add logior. 2016-07-24 17:21:30 +02:00
Jan Nieuwenhuizen b5ab19aab7 mes.c: add quotient and modulo. 2016-07-24 15:25:16 +02:00
Jan Nieuwenhuizen 87c52609ff mes.c: less_p, greater_p, is_p: take multiple arguments. 2016-07-24 15:26:49 +02:00
Jan Nieuwenhuizen 675bc3dead mes.c: display_helper fix for vector. 2016-07-24 15:25:47 +02:00
Jan Nieuwenhuizen 99762c07ca mes.c: fix apply. 2016-07-24 13:27:05 +02:00
Jan Nieuwenhuizen 8c1a5f19da fix for-each. 2016-07-24 12:40:44 +02:00
Jan Nieuwenhuizen 478087abe4 mes.c: grok #\tab. 2016-07-24 12:06:05 +02:00
Jan Nieuwenhuizen d4e335b447 mes.c: add syntax, quasisyntax to reader.... 2016-07-24 00:40:37 +02:00
Jan Nieuwenhuizen 28ae662e0e srfi-9 records! 2016-07-24 00:14:40 +02:00
Jan Nieuwenhuizen 711a29f4f9 mes.c: refactor begin and closures. Fixes bugs/top.mes. 2016-07-24 00:01:31 +02:00
Jan Nieuwenhuizen ab381c841a mes.c: remove hacks 2016-07-23 15:11:32 +02:00
Jan Nieuwenhuizen 5126e16e66 trying to get records up....WIP 2016-07-23 14:39:33 +02:00
Jan Nieuwenhuizen b63444d919 mes.c: barf on unknown symbols. 2016-07-23 11:51:06 +02:00
Jan Nieuwenhuizen efdd84b4c4 mes.c: add new macro type, junk *macro* hack. 2016-07-22 17:13:51 +02:00
Jan Nieuwenhuizen 04f3323f10 mes.c: store actual environment with closures. 2016-07-22 12:23:23 +02:00
Jan Nieuwenhuizen dbbfcb5899 fix closure 5 2016-07-22 09:00:32 +02:00
Jan Nieuwenhuizen 24be64787b mes.c: store enviroment depth in closures. Fixes c1, c3 and more. 2016-07-19 21:37:39 +02:00
Jan Nieuwenhuizen 61bbbdffbf mes.c: move begin_env into eval, decruft. 2016-07-19 18:18:27 +02:00
Jan Nieuwenhuizen 80e6f95f91 fix some tests. 2016-07-18 22:59:33 +02:00
Jan Nieuwenhuizen 3a28828bdf remove booting into mes (would need VM), boot.mes; rewrite test.mes. 2016-07-18 22:43:16 +02:00
Jan Nieuwenhuizen be2326f351 unquoting fix. 2016-07-17 23:43:16 +02:00
Jan Nieuwenhuizen 005f146b68 no closuring in macro body... 2016-07-17 23:07:35 +02:00
Jan Nieuwenhuizen 59cdf9632f closures: mostly supported... 2016-07-17 22:15:31 +02:00
Jan Nieuwenhuizen bfb2f42cd5 mes.c: single-statement body lambda closures. 2016-07-17 15:59:21 +02:00
Jan Nieuwenhuizen 0a497a2765 mes.c: add boolean_p. 2016-07-17 13:32:52 +02:00