Jan Nieuwenhuizen
b45936815c
Add simple-format.
...
* module/mes/display.mes (simple-format, format): New functions.
2017-01-04 08:49:51 +01:00
Jan Nieuwenhuizen
5f8eedacec
Display: If possible, show name of closure.
...
* module/mes/display.mes (display): Lookup closure's name and display it.
2017-01-04 08:49:45 +01:00
Jan Nieuwenhuizen
41207c663e
Remove hardcoded duplication of version.
...
* GNUmakefile (CPPFLAGS): Include VERSION.
* mes.c (main): Use it. Add --dump and --load to --help.
(scm_symbol_mes_prefix, scm_symbol_mes_version): New sybols.
(mes_symbols): Use them to set prefix and version.
* module/mes/base-0.mes (effective-version): Use %version.
* module/mes/repl.mes (welcome): Likewise.
2016-12-25 15:38:26 +01:00
Jan Nieuwenhuizen
49f1c4e5f3
Refactor reader.
...
* module/mes/read-0.mes (read-hash): New function.
(read-word): Use it.
(eat-whitespace): Rewrite.
(display): Minimal implementation through core.
* lib.c (stderr_): Support printing of strings while booting.
2016-12-24 22:16:53 +01:00
Jan Nieuwenhuizen
7cb8aea66f
core: Remove c3+r abbreviatons.
...
* lib.c (caaar, caadr, caddr, cdadr, cadar, cddar, cdddr, cadddr):
Remove.
* mes.c: Rewrite callers
* module/mes/read-0.mes: Rewrite callers.
* module/mes/base.mes (caaar, caadr, caddr, cdadr, cadar, cddar, cdddr,
cadddr): New function.
2016-12-24 14:21:36 +01:00
Jan Nieuwenhuizen
15163e9dc1
core: Add getenv, verbose module loading on MES_DEBUG.
...
* mes.c (MAKE_REF, MAKE_STRING): Oops, remove stray semicolon.
* posix.c (getenv_): New function.
* module/mes/base-0.mes (load): Use it to switch on MES_DEBUG=1.
(mes-use-module): Remove commented-out code.
2016-12-24 14:09:48 +01:00
Jan Nieuwenhuizen
e8d8d5c3be
core: Add some error checking.
...
* lib.c (length): Return -1 for non-proper lists.
(error): New function.
(assert_defined): Use it.
(check_formals, check_apply): New functions.
* mes.c (car, cdr, set_cdr_x, set_env_x, eval_apply): Add error check.
* srfi/srfi-1.mes (member): New function.
* tests/srfi-1.tests ("member"): New test.
2016-12-24 12:10:05 +01:00
Jan Nieuwenhuizen
d81ce91ff7
Add write, add display test, some fixes.
...
* mes.c (write_byte): Rename from write_char.
* module/mes/display.mes (display): Fixes for write: char, closure, procedure.
(write-char, write, with-output-to-string): New functions.
* tests/read.test: Include base-0 to see some output.
* tests/display.test: New file.
* GNUmakefile (TESTS): Add it.
2016-12-24 11:10:11 +01:00
Jan Nieuwenhuizen
16e3caafcd
core: Remove display.
...
* posix.c (stderr_): New function.
* display.c: Remove.
* mes.c: Remove includes. Use stderr_ instead of display_.
(gc_loop): Preserve function's name.
(arity_): New function.
* GNUmakefile (mes.o): Remove dependency on display.
* module/mes/read-0.mes: Use core:stderr instead of display, newline.
(newline): New function.
* module/mes/base-0.mes: Use core:stderr instead of display.
Include (mes display).
* module/mes/display.mes: New file.
* lib.c (assert_defined): Move from mes.c.
(string_to_cstring): Move from posix.c
* build-aux/mes-snarf.scm (function-environment): Initialize function
name with scheme string.
2016-12-24 01:23:50 +01:00
Jan Nieuwenhuizen
d295ee5668
Import srfi-26 from Guile.
...
* module/srfi/srfi-26.scm: Import.
* module/srfi/srfi-26.mes: Include it.
* AUTHORS: Mention it.
2016-12-24 08:34:19 +01:00
Jan Nieuwenhuizen
73fc7707a5
core: Remove symbol_to_list, char_to_integer, integer_to_char.
...
* mes.c (symbol_to_list, char_to_integer, integer_to_char): Remove
* module/mes/read-0.mes (symbol->list, integer->char,
symbol->keyword): New function.
(read-word): Use symbol->keyword.
* module/mes/type-0.mes (char->integer): New function.
* module/mes/scm.mes (keyword->symbol): New function.
2016-12-23 23:25:49 +01:00
Jan Nieuwenhuizen
95fd6646dc
core: Remove string.c.
...
* string.c: Remove.
* mes.c (eval_apply): Remove caller.
* GNUmakefile (mes.o): Remove dependency on string.
* module/mes/psyntax-0.mes (eval): Handle "noexpand".
* module/mes/type-0.mes (string->symbol, symbol->list, symbol->string):
New function.
2016-12-23 22:48:27 +01:00
Jan Nieuwenhuizen
151a07ded3
core: Remove number_to_string.
...
* string.c (number_to_string): Remove.
* module/mes/scm.mes (number->string): New function.
2016-12-23 22:08:03 +01:00
Jan Nieuwenhuizen
d37232f39c
core: Remove substring.
...
* string.c (substring): Remove.
* module/mes/scm.mes (substring): New function.
2016-12-23 21:44:54 +01:00
Jan Nieuwenhuizen
9e6d862c5b
core: Remove string_length.
...
* module/mes/scm.mes (string-length): New function.
2016-12-23 21:26:16 +01:00
Jan Nieuwenhuizen
be786c00a3
core: Remove list_to_string.
...
* string.c (list_to_string): Remove.
* module/mes/read-0.mes (list->string): New function.
* module/mes/scm.mes (list->string): Remove.
2016-12-23 21:21:54 +01:00
Jan Nieuwenhuizen
745b58e419
core: Remove string-append.
...
* string.c (string_append): Remove.
* module/mes/type-0.mes (string-append): New function.
* module/mes/base-0.mes: Include type-0 without using string-append.
2016-12-23 20:56:37 +01:00
Jan Nieuwenhuizen
9d3e079a6d
core: Remove string.
...
* string.c (string): Remove.
* module/mes/type-0.mes (string): New function.
2016-12-23 20:44:04 +01:00
Jan Nieuwenhuizen
e8a591f91d
Add exit.
...
* lib.c (exit_): Rename from builtin_exit.
* module/mes/scm.mes (list): Remove.
2016-12-23 20:31:45 +01:00
Jan Nieuwenhuizen
e13587f57f
core: Remove last_pair, list_ref, string_ref.
...
* lib.c (last_pair, list_ref): Remove.
* string.c (string_ref): Remove.
* module/mes/type-0.mes (string->list): New function.
* module/mes/scm.mes (string-ref): New function.
2016-12-23 20:09:57 +01:00
Jan Nieuwenhuizen
20b7a7851a
core: Make closure real type.
...
* display.c (display_helper):
* mes.c (type_t): Add CLOSURE.
(scm_t): Add closure.
(CLOSURE): New macro.
(eval_apply:apply): Update.
(eval_apply:eval): Remove closure special-casing.
(gc_loop): Handle CLOSURE.
* module/mes/read-0.mes: Update types.
* module/mes/type-0.mes: Update types.
* display.c (display): Update.
* module/mes/fluids.mes (env:escape-closure): Check for '*closure.
2016-12-23 18:48:36 +01:00
Jan Nieuwenhuizen
10235efe7e
core: Remove type.c.
...
* module/mes/type-0.mes: Resurrect.
* module/mes/base-0.mes: Include it.
* module/mes/read-0.mes (not, pair?, atom?): New functions.
* type.c: Remove.
* mes.c: Remove callers.
* GNUmakefile (mes.o): Remove dependency on type.
2016-12-23 18:05:45 +01:00
Jan Nieuwenhuizen
97dfc3c981
core: Remove add_environment.
...
* mes.c (add_environment): Remove. Update callers.
(scm_symbol_dot): New global.
2016-12-23 17:02:23 +01:00
Jan Nieuwenhuizen
c4fe110d1e
core: Remove make_char.
...
* mes.c (MAKE_CHAR): New macro.
(make_char): Remove. Update callers.
* reader.c (peek_char, read_char, unread_char): Remove.
* module/mes/scm.mes (peek-char, read-char, unread-char): New function.
2016-12-23 16:26:00 +01:00
Jan Nieuwenhuizen
89e78bec77
core: Remove make_keyword.
...
* mes.c (make_keyword): Remove.
* module/mes/read-0.mes (<cell:keyword>): New global.
(read-word): Use it with make_cell instead fo make-keyword.
* strting.c (symbol_to_keyword): Use make_cell instead of make_keyword.
2016-12-23 15:53:57 +01:00
Jan Nieuwenhuizen
976c86318e
core: Remove make_macro.
...
* module/mes/read-0.mes (<macro>): New global.
(env:macro): Use it with make_cell instead of make_macro.
* mes.c (make_macro): Remove.
* type.c (car_): Rename from mes_car.
(cdr_): Rename from mes_cdr.
2016-12-23 15:47:52 +01:00
Jan Nieuwenhuizen
18ba10e2ae
core: Simplify lookup.
...
* reader.c (lookup_): Rename from lookup. Remove all lookups except
for numbers and symbols. Update callers.
* mes.c (make_symbol_): Rename from internal_make_symbol. Update
callers.
* module/mes/read-0.mes (lookup): New function.
(read-word): Remove all lookup calls, except for numbers and symbols.
2016-12-23 11:31:34 +01:00
Jan Nieuwenhuizen
6f60e12d76
Remove lookup-char.
...
* reader.c (lookup_char): Remove.
* module/mes/read-0.mes (lookup-char): Remove.
(read-word): Rewrite using quote.
2016-12-23 11:26:35 +01:00
Jan Nieuwenhuizen
aa0aaa58ab
core: Cleanup symbol initialization and lookup.
...
* build-aux/mes-snarf.scm (symbol->names): New function
(function->environment): Initialize symbol.
(generate-includes): Also write .symbol-names.i.
* mes.c (mes_symbols): Include it. Remove internal_lookup_symbol.
* display.c (display): Handle display of nil in symbol list.
* reader.c (internal_lookup_symbol): Remove name-fu.
2016-12-23 10:38:41 +01:00
Jan Nieuwenhuizen
ddfaa05149
core: Remove most of reader.
...
* reader.c (append_char, read_block_comment, read_character, read_hex,
read_string): Remove.
(eat_whitespace, read_word)[READER]: Remove.
* mes.c (list_to_symbol): New function.
* module/mes/read-0.mes (list->symbol, read-character, read-hex,
read-string): New functions.
2016-12-22 23:42:28 +01:00
Jan Nieuwenhuizen
a0caca6409
Refactor reader.
...
* module/mes/read-0.mes (eat-whitespace): More efficient ordering/peeking.
* module/mes/read-0.mes (read-word): Handle tab.
2016-12-25 12:37:35 +01:00
Jan Nieuwenhuizen
b45a3b6f33
core: Disable reader.
...
* mes.c (READER): Switch off.
* module/mes/read-0.mes (eat-whitespace): Handle #;.
2016-12-22 21:23:49 +01:00
Jan Nieuwenhuizen
471bdb0af4
core: One big eval_apply.
...
* mes.c (eval_apply): New function.
(eval_apply_t): New type.
(g_target): New global.
(vm_evlis, vm_apply_env, vm_eval_env, vm_expand_macro_env,
vm_begin_env, vm_if_env, vm_call_with_values_env): Remove. Update callers.
(macro_expand_env): Rename from expand_macro_env.
* guile/mes.mes: Update callers.
* module/mes/base-0.mes: Likewise.
* module/mes/mes-0.mes: Likewise.
* module/mes/psyntax-1.mes: Likewise.
* module/mes/repl.mes: Likewise.
2016-12-22 16:34:28 +01:00
Jan Nieuwenhuizen
33ac19d7df
Support PEG from Guile.
...
* module/mes/peg.mes: New file.
* module/mes/peg/cache.scm: New file.
* module/mes/peg/codegen.scm: New file.
* module/mes/peg/simplify-tree.scm: New file.
* module/mes/peg/string-peg.scm: New file.
* module/mes/peg/using-parsers.scm: New file.
* tests/peg.test: New file.
* GNUmakefile (TESTS): Add it.
2016-12-22 20:16:44 +01:00
Jan Nieuwenhuizen
a0b18a402b
Support pmatch from Guile.
...
* module/mes/pmatch.scm: New file.
* module/mes/pmatch.mes: New file.
* AUTHORS: Mention it.
2016-12-22 19:49:58 +01:00
Jan Nieuwenhuizen
8a78f45e25
Use include-from-path for psyntax.pp.
...
* module/mes/psyntax.pp: Rename from module/mes/psyntax-pp.mes.
* module/mes/psyntax.mes: Update.
* AUTHORS: Update.
2016-12-22 19:49:41 +01:00
Jan Nieuwenhuizen
0bac0cb948
Use include-from-path for upstream.
...
* module/mes/lalr.scm: Rename from module/mes/lalr.upstream.mes.
* module/mes/lalr.mes: Update.
* module/mes/match.scm: Rename from module/mes/match.upstream.mes.
* module/mes/match.mes: Update.
* module/mes/optargs.scm: Rename from module/mes/optargs.upstream.mes.
* module/mes/optargs.mes: Update.
* module/mes/quasisyntax.scm: Rename from module/mes/quasisyntax.upstream.mes.
* module/mes/quasisyntax.mes: Update.
* module/srfi/srfi-1.scm: Rename from module/srfi/srfi-1.upstream.mes.
* module/srfi/srfi-1.mes: Update.
* module/srfi/srfi-9.scm: Rename from module/srfi/srfi-9.upstream.mes.
* module/srfi/srfi-9.mes: Update.
* AUTHORS: Update.
2016-12-22 19:34:41 +01:00
Jan Nieuwenhuizen
51cd4885fc
Add string-copy, string=, string=?, char<?, char>?, char<=?, char>=?.
...
* module/srfi/srfi-13.mes: New file.
* module/mes/scm.mes (char<?, char>?, char<=?, char>=?): New function.
* module/srfi/srfi-13.mes: New file.
* tests/srfi-13.test: New file.
* string.c (string_to_symbol): Handle "".
2016-12-11 21:26:27 +01:00
Jan Nieuwenhuizen
ea7c0aac86
Refactor quasiquote.
...
* module/mes/quasiquote.mes (quasiquote): Refactor.
* tests/quasiquote.test: Add tests.
2016-12-22 12:11:55 +01:00
Jan Nieuwenhuizen
326095c9c9
Add psyntax-based quasisyntax.
...
* module/mes/quasisyntax.upstream.mes: Import from Guile.
* AUTHORS: Mention it.
* module/mes/quasisyntax.mes: New file.
* module/mes/psyntax.mes: Include it.
2016-12-21 16:48:33 +01:00
Jan Nieuwenhuizen
7bf25a7e17
core: Remove define.
...
* base-0.mes (cons*): Refactor.
* module/mes/read-0.mes: Implement define, define-macro using macros.
* define.c: Remove.
* mes.c: Remove callers.
* GNUmakefile (mes.o): Remove dependency on define.
2016-12-21 22:22:34 +01:00
Jan Nieuwenhuizen
1072c7fba9
nyacc: Support enhanced Guile-1.8.
...
* module/nyacc/lalr.scm: Export process-spec, reserved?. Use optargs, syncase.
* module/nyacc/lex.scm: Use optargs, syncase.
* module/nyacc/parse.scm: Use optargs.
* module/nyacc/util.scm: Use optargs.
* module/nyacc/lang/util.scm: Use optargs.
* module/nyacc/lang/c99/cpp.scm: Use syncase.
* module/nyacc/lang/c99/parser.scm: Use optargs, syncase.
2016-12-18 22:16:14 +01:00
Jan Nieuwenhuizen
f8e4d6e42b
nyacc: Add mes modules.
...
* module/nyacc/lang/c99/cpp.mes
* module/nyacc/lang/c99/parser.mes
* module/nyacc/lang/calc/parser.mes
* module/nyacc/lang/util.mes
* module/nyacc/lex.mes
* module/nyacc/parse.mes
* module/nyacc/util.mes
2016-12-18 15:47:55 +01:00
Jan Nieuwenhuizen
0a9bfa7e3d
nyacc: Use standard \return rather than \cr.
2016-12-18 15:39:36 +01:00
Jan Nieuwenhuizen
a53e09d3e8
Import Nyacc 0.72.0.
...
* module/nyacc: Import module/nyacc.
2016-12-17 22:34:43 +01:00
Jan Nieuwenhuizen
f8bc344dfc
Import psyntax from Guile-1.8: R7RS with-ellipsis.
...
* GNUmakefile (psyntax-import): New target.
* module/mes/psyntax.ss: Import.
* module/mes/psyntax-pp.mes: Import.
* NEWS: Mention it.
2016-12-19 19:41:43 +01:00
Jan Nieuwenhuizen
40a6f2df34
Prepare for psyntax-6.3..7.3 support.
...
* module/mes/psyntax-0.mes (ormap): New function.
(eval): New function.
(remprop): New function.
($sc-put-cte, $make-environment, environment?, syntax->list,
syntax->vector, literal-identifier=?, $syntax-dispatch, eval-when):
New variable.
2016-12-11 21:39:54 +01:00
Jan Nieuwenhuizen
8b172e3438
Add abs.
...
* module/mes/scm.mes (abs): New function.
2016-12-20 21:22:21 +01:00
Jan Nieuwenhuizen
7d5c3a0201
Support (sxml xpath) for Nyacc c99.
...
* module/sxml/xpath.mes: New file.
* module/sxml/xpath.upstream.mes: Import from Guile.
* AUTHORS: Mention it.
2016-12-20 20:12:47 +01:00
Jan Nieuwenhuizen
096a2ed52e
Partial (rnrs arithmetic bitwise) support for Nyacc c99.
...
* module/rnrs/arithmetic/bitwise.mes: New file.
2016-12-20 20:11:35 +01:00