Jan Nieuwenhuizen
bdeb41e0ae
core: Move reader and posix functions from mes.c
...
* mes.c (getchar, ungetchar, peekchar, peek_byte, read_byte,
unread_byte, write_byte, read_input_file_env_, read_input_file_env):
Remove.
* posix.c (getchar, ungetchar, peekchar, peek_byte, read_byte,
unread_byte, write_byte): Move from mes.c.
* reader (read_input_file_env_, read_input_file_env): Move from mes.c.
2016-12-24 11:28:25 +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
c2bfeffe96
core: Remove make_number.
...
* mes.c (MAKE_NUMBER): New macro.
(tmp_num_, tmp_num_2): New function.
(make_number): Remove. Update callers.
2016-12-23 16:22:19 +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
6b4bf34ff2
Support backslash in string.
...
* reader.c (read_string): Handle '\\'.
* tests/read.test: Add it.
2016-12-18 15:39:12 +01:00
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
46a617f16e
core: Support keywords.
...
* display.c (display): Handle keyword.
* mes.c (type_t): Add KEYWORD.
(eq_p): Handle it.
(make_keyword): New function.
* reader.c (lookup): Use it.
* type.c (keyword_p): New function.
* NEWS: Update.
2016-12-16 23:30:33 +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
e4e29f00b0
core: gc bugfixes.
...
* mes.c (make_tmps): New function.
(make_symbols, gc): Use it.
(vm_call_with_values_env): New vm function.
(call-with-values): Call it.
(eval_env): Do not call eval_env inline.
* define.c (vm_define_env): Use r2 rather than local name.
(g_symbols): Rename from symbols.
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