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
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
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
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
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
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
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
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
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
376bb5d62b
Release 0.2.
...
* configure (VERSION): Bump to 0.2.
* mes.c (main): Likewise.
* module/mes/repl.mes: Likewise.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
a0709313ca
core: Refactor eval.
...
* mes.c (eval_env): Rename from builtin_eval, Update callers. Use switch.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
7e8341d76c
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.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
97300ef6ae
Implement load.
...
* mes.c (symbol_primitive_load): New symbol.
(builtin_eval): Use it to implement primitive-load.
* module/mes/base-0.mes (push!, pop!): New macro.
(load): New macro.
* tests/data/load.scm: New file.
* tests/base.test (load): New test.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
2b373ff40f
Finalize psyntax integration.
...
* mes.c (sc_expand_env): Exclude primitives, expand native macros.
(symbol_expand_macro): New symbol.
* module/mes/psyntax-0.mes (properties-alist): New function.
* module/mes/psyntax-1.mes: Set expand-macro.
(define-syntax, syntax-rules, let-syntax): Remove macro.
* module/language/c/parser.mes: Use psyntax modules, remove syntax module.
* module/language/paren.mes: Likewise.
* scripts/repl.mes: Likewise.
* tests/match.test: Likewise.
* tests/record.test: Likewise.
* tests/psyntax.test (define-syntax swap!): Add test.
* module/mes/let-syntax.mes: Remove.
* module/mes/syntax.mes: Remove.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
d2768796dc
test: Add new macros.
...
* module/mes/test.mes (pass-if-equal, expect-fail): New macros.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
0bf26fa7d2
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.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
32214ff608
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.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
d18542e25f
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.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
f6baa9ce98
psyntax: Add missing (interaction-environment) to eval.
...
* module/mes/psyntax.mes: Add (interaction-environment) to eval.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
0a38c3bdf9
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
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
27282738fd
Exit upon error.
...
* module/mes/scm.mes (error): Add exit 1.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
79d989268f
Mescc: avoid `if'.
...
* module/language/c/lexer.mes (keywords): Produce `If'.
* module/language/c/parser.mes (c-parser): Use `If.'
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
97212b5765
boot: fix ignored.
...
* module/mes/loop-0.mes: Wrap read-file in begin.
* module/mes/mes-0.mes: Remove ignored.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
781957cbe9
Implement apply with multiple arguments.
...
* module/mes/base-0.mes (apply): Handle multiple arguments.
* tests/base.test: (apply, apply 1, apply 2): New test.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
1f511481a3
Fix values.
...
* mes.c (call): Respect any other non-value arguments.
* tests/scm.test (values, values 2, values 3, call-with-values): New test.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
d209a18121
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.
2016-12-12 20:33:48 +01:00
Jan Nieuwenhuizen
a00e69863e
Revert "Speedup boot eval/apply."
...
This reverts commit 6326b3103156fd79cd7bebbb351194626cc8a64b.
2016-12-12 20:33:48 +01:00
Jan Nieuwenhuizen
0bd0cb2e3e
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%.
2016-12-12 20:33:48 +01:00
Jan Nieuwenhuizen
3849c48f79
Release 0.1.
...
* configure (VERSION): Bump to 0.1.
* mes.c (main): Likewise.
* module/mes/repl.mes: Likewise.
2016-11-20 21:47:47 +01:00
Jan Nieuwenhuizen
2823fca025
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.
2016-10-23 10:08:04 +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
bca8061232
named let-fu FIXME
2016-10-21 00:00:05 +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
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
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
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
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