Jan Nieuwenhuizen
adbf1bb296
test: Add psyntax closure tests.
...
* tests/closure.test (closure 7, closure 8, closure 9): New test.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
07778d3b70
core: Show more info on apply error.
...
* mes.c (apply_env): Be more specific about what cannot be applied.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
c121fe3d72
test: Add toplevel begin define test.
...
* tests/base.test (top begin define): New test.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
ffd2d3df4f
core: Bugfix: report name of undefined variable.
...
* mes.c (assert_defined): Add variable as parmeter, print it. Update
callers.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
6c70e92276
core: Use switch in display_helper.
...
*mes (display_helper): Use switch.
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
0eda7383f2
core: Cleanup macro expansion.
...
* mes.c (builtin_eval): Call expand_macro_env after handling primitives.
(expand_macro_env): Include syntax-case expansion, remove skipping
of primitives.
(sc_expand_env): Remove.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen
bcd6cd9dcc
core: Factor-out assert_defined.
...
* mes.c (assert_defined): New function.
(set_env_x): Use it.
(builtin_eval): Use it.
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
70bdab7090
posix: Implement open-input-file.
...
* posix.c: New file.
* mes.c: Include posix.environment.h, posix.environment.i, posix.environment.c.
(read_input_file_env): Rename from read_file_env. Update
callers.
(load_env): Rename from load_file_env. Update callers.
* GNUmakefile (mes.o): Add posix.c, posix.environment.h,
posix.environment.i dependencies.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
1e2e2f2a4a
core: Support switching of input stream.
...
* mes.c (g_stdin): New global.
(getchar): New function, use g_stdin.
(ungetchar): Use g_stdin.
(main): Initialize g_stdin to stdin.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
0e13b7e8dd
Update documentation wrt syntax-case.
...
* HACKING: Update wrt syntax-case.
* NEWS: Likewise.
* README: Likewise.
* guix.scm: Likewise.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
14f417d780
Update AUTHORS.
...
* AUTHORS: Include information on lalr, match and psyntax.
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
c851935d4d
core: Quoted internals are symbols.
...
* mes.c (begin_env): Rename from begin. Update callers.
(scm_begin, scm_if, scm_define, scm_set_x): Rename from symbol_*.
(symbol_begin, symbol_define, symbol_if, scm_lambda, scm_set_x): New symbols.
(mes_environment): Add them to environment, SYMBOL->SCM.
* define.c (define_env): Rename from define. Update callers.
* build-aux/mes-snarf.scm: Shadow internals (SCM) by their symbol.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
8a13b472e3
test: More values, call-with-values tests.
...
* tests/cwv.test: New file.
* GNUmakefile (TESTS): Add it.
* tests/scm.test: Remove value and call-with-values tests.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
019ca90109
psyntax: More tests.
...
* tests/psyntax.test: Add tests.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
f1ae9edd0d
core: Fix quasisyntax reading.
...
* mes.c (readword): Avoid unspecified behaviour in comma list.
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
b8a7334941
Bugfix include.mes: skip commented modules.
...
* scripts/include.mes: Make regexp more strict.
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
d34dba24f2
core: Add compile time switch for quasisyntax.
...
* mes.c [QUASISYNTAX]: New switch. Default off.
(builtin_eval) [QUASISYNTAX]: Handle syntax, unsyntax, quasisyntax.
* quasiquote.c (syntax, unsyntax, unsyntax_splicing, eval_quasisyntax,
add_unsyntaxers) [QUASISYNTAX]: Available only.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
ad717d4bba
More error handling on apply_env.
...
* mes.c (apply_env): Assert if applying *unspecified*.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
332d2655cf
Bugfix assq_ref_cache for running without environment cache.
...
* mes.c (assq_ref_cache) [!ENV_CACHE]: Return *undefined* if nothing
found.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
2cad00527e
Error handling on failing set!.
...
* mes.c (set_env_x): Produce error message [WAS: dump core].
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
3b4e9f36c8
Simplify toplevel read.
...
* mes.c (read_file_env): Rename from read_file.
(load_file_env): New function.
(main): Use it.
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
f593a5c9d7
Define garbage collector/jam collector primitives.
...
* mes.c (make_cell): New primitive alongside make_vector for allocation.
(cons, make_char, make_macro, make_number, make_ref,
internal_make_symbol, make_vector): Use it.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen
16f678a158
Implement strings and symbols as list of characters [WAS: c-string].
...
* mes.c (scm_t): Add string field.
(make_string, internal_lookup_symbol, internal_make_symbol,
make_symbol, lookup, readword): Take scm*. Update callers.
(display_helper): Support string field.
(append_char): New function.
(readstring): Use it. Produce scm*.
(cstring_to_list): New function.
(add_environment, internal_make_symbol): Use it.
(list_of_char_equal_p): New function.
(internal_lookup_symbol): Use it.
* lib.c (list_ref): New function.
* string.c (string_ref): Use it.
(string, string_append, string_length, substring, number_to_string,
string_to_symbol, symbol_to_string): Update to list-of-characters
implementation.
2016-12-12 20:33:48 +01:00
Jan Nieuwenhuizen
266c66e40c
Environment cache bugfix for define.
...
* define.c (define): Invalidate cache. Fixes vector test.
* GNUmakefile (mes-check, guile-check): Use set -e. Fixes skipping over errors.
2016-12-12 20:33:48 +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
3249db47b0
Guile gc experiment: remove global scan variable.
2016-12-12 20:33:48 +01:00
Jan Nieuwenhuizen
8fbe7f1b32
Guile gc experiment: add garbage collection.
2016-12-12 20:33:48 +01:00
Jan Nieuwenhuizen
e1d5135af6
Guile gc experiment: add lists and display.
...
* guile/gc.scm (gc-nil, gc-null?, gc-list, gc-display, make-symbol):
New function.
2016-12-12 20:33:48 +01:00
Jan Nieuwenhuizen
088d939945
Guile gc experiment: add pairs.
...
* guile/gc.scm (cell-type, cell-index, gc-cons, gc-car, gc-cdr): New
function.
2016-12-12 20:33:48 +01:00
Jan Nieuwenhuizen
c5e20f196c
Guile gc experiment.
...
guile/gc.scm: New file.
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
2262e4e409
guix hash: 115jycdz8i1r5sj2fsjqcrh456mayxzaykb8cxxxc3wxfkj8nagf
2016-12-12 20:33:43 +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
09a21626a8
Documentation update.
...
* HACKING: Target is R6RS-like, at least having syntax-case.
* README: Likewise.
* guix.scm: Likewise.
2016-11-20 21:45:12 +01:00