Jan Nieuwenhuizen
4e12e14b85
mescc: Refactor libc.
...
* GNUmakefile (mini-mes): Add include.
* mlibc.c: New file: libc bits for GNUC -nostdlib.
* mstart.c: New file: _start for GNUC -nostdlib.
* scaffold/cons-mes.c: Remove GNUC libc bits.
* scaffold/m.c: Likewise.
* scaffold/mini-mes.c: Likewise.
* scaffold/t.c: Likewise.
* scaffold/tiny-mes.c: Litkewise.
* module/language/c99/compiler.mes (libc, i386:libc): Remove.
* module/language/c99/compiler.scm
* module/mes/libc-i386.mes: Remove assembly bits.
(_start): New function.
* module/mes/libc-i386.scm: Export it, remove assembly exports.
* module/mes/as-i386.mes: New file: assembly bits from libc-i386.mes.
* module/mes/as-i386.scm: New file: export them.
* module/mes/libc.mes (libc,_start): New functions from compiler.mes.
* module/mes/libc.scm: Export them.
2017-04-02 12:29:09 +02:00
Jan Nieuwenhuizen
03c37b2e22
mescc: Support mini-mes running scheme program with builtins.
...
Mini-mes, compiled with either gcc or mescc, now runs a memory dump of
this mini-0.mes program
(begin
(write-byte (make-cell 0 0 65))
(write-byte (make-cell 0 0 66))
(write-byte (make-cell 0 0 67))
(write-byte (make-cell 0 0 10))
#f)
when read and dumped by (gcc-compiled) mes-32.
* build-aux/mes-snarf.scm: FIXES ..collapse?
* module/language/c99/compiler.mes (ast->info): Bail out on unhandled
declarations. Was: verbosely skip.
2017-03-12 12:02:12 +01:00
Jan Nieuwenhuizen
76f1a89cef
core+mini-mes: Replace manual snippets by snarfed includes.
...
* build-aux/mes-snarf.scm (symbol->source, function->header,
function->source, function->environment): Add workarounds to
avoid struct-copy initializers.
* GNUmakefile (mini-mes): Snarf symbols and functions.
* scaffold/mini-mes.c: Include mini-mes.h, mini-mes.symbols.h,
mini-mes.symbols.i, mini-mes.i, mini-mes.environment.i.
Add snarfable symbol/special definitions.
(type_t): Prefix all types with `T', update users.
(assert_defined, gc_push_frame, gc_peek_frame, gc_init_cells): Mark
as internal.
* mes.c (type_t): Prefix all types with `T', update users.
* scaffold/mini-mes.c (eq_p, type_, car_, cdr_,
list_of_char_equal_p, lookup_macro, write_byte): New functions (from
mes.c).
(assq): Add debugging, workaround.
2017-03-10 20:56:18 +01:00
Jan Nieuwenhuizen
dd52f580fb
mescc: Compile all of mini-mes.
...
* module/language/c99/compiler.mes (case->jump-info): Support single statement.
* module/mes/elf-util.mes (function-prefix): Workaround for reversed
functions. FIXME!
* module/mes/elf.mes:
* scaffold/mini-mes.c (type_t): Rename FUNCTION to TFUNCTION for Nyacc.
Add missing symbols.
(eval_apply): Uncomment most.
* scaffold/tiny-mes.c:
* scaffold/cons-mes.c: Remove cruft.
2017-03-06 07:14:15 +01:00
Jan Nieuwenhuizen
07c4b02fa3
mescc: Fixes for goto.
...
* module/mes/libc-i386.mes (XXjump): New function.
* module/mes/libc-i386.scm: Export it.
* module/language/c99/compiler.mes (case->jump-info, ast->info): Use it.
* scaffold/t.c: Test it.
* GNUmakefile (cons-mes): New target.
* scaffold/cons-mes.c: New file.
* scaffold/mini-mes.c:
2017-04-02 12:13:04 +02:00
Jan Nieuwenhuizen
c210959c49
mescc: Read and display sexp dumped by mes.
...
* lib.c (dump)[MES_HACK]: Dump small hello-world sexp, to be handled by
* doc/examples/tiny-mes.c (display_): New function.
* module/mes/libc-i386.mes (i386:accu->base, i386:mem->accu,
i386:mem+n->accu): New functions.
* module/mes/libc-i386.scm: Export them.
* GNUmakefile (mes-32): New target.
2017-01-10 20:05:47 +01:00
Jan Nieuwenhuizen
6ffca4bf61
mescc: Add open/read C-tests.
...
* scaffold/m.c: New file.
* scaffold/tiny-mes.c: New file.
* GNUmakefile (m, tiny-mes): New targets.
* scaffold/micro-mes.c: Update gcc-libc bits.
* scaffold/mini-mes.c: Likewise.
2017-04-02 12:10:38 +02:00
Jan Nieuwenhuizen
c83ef66265
mescc: Beginning of expression and test template.
...
* scaffold/t.c: New file.
* GNUmakefile (mescc-check, t-check): New targets.
* module/language/c99/compiler.mes (write-any): Catch weirdness.
(make): Add <function> slot.
(.function): New accessor.
(clone): Handle it.
(function->info): Set it.
(ast->info): Make tests generic in if, for, while. Add goto, label,
!, ==, !=, -, &&.
* module/mes/elf-util.mes (lambda/label->list): New function.
(text->list): Use it.
(functions->text, function-prefix): New function.
(function-offset): Use it.
(label-offset): New function.
* module/mes/elf-util.scm (mes): Export them.
* module/mes/elf.mes (make-elf): Use text->list.
* module/mes/libc-i386.mes (eputs, puts): Remove.
(i386:byte-base-sub): Rename from sub-byte-base.
(i386:byte-jump-z): Rename from i386:Xjump-byte-z.
(i386:byte-mem->accu): Rename from i386:Xmem-byte->accu.
(i386:byte-mem->base): Rename from i386:Xmem-byte->base.
(i386:accu->local, i386:accu-non-zero?, i386:accu-zero?,
i386:base-sub, i386:byte-sub-base, i386:jump-c, i386:jump-cz,
i386:jump-nc, i386:jump-ncz, i386:byte-mem->base, i386:sub-base,
i386:test-accu, i386:test-base, i386:test-jump-z, i386:value->base,
i386:xor-zf): New functions.
2017-04-02 12:23:00 +02:00
Jan Nieuwenhuizen
107795b13c
mescc: Compile specific for loop.
...
* module/language/c99/compiler.mes (ast->info): Handle for, pre-inc.
* GNUmakefile (main): New target.
* doc/examples/main.c:
(exit, write, strlen,puts)[__GNUC__]: New functions; import from micro-mes.c
(_start): New function.
2017-01-05 21:24:56 +01:00
Jan Nieuwenhuizen
8989dab8b0
mescc: Scaffolding of Nyacc compile experiments.
...
* scaffold/micro-mes.c: New file.
* scaffold/mini-mes.c: New file.
* GNUmakefile (mini-mes, micro-mes): New targets.
* .gitignore: Ignore them.
2017-04-02 12:01:33 +02:00
Jan Nieuwenhuizen
7ec42c3cc7
mescc: Use Nyacc frontend.
...
* module/language/c99/compiler.mes: New file.
* module/language/c99/compiler.scm: Include it.
* module/mes/elf.mes: Move (mes-use-module) into cond-expand.
* module/mes/elf.scm: New file.
* module/mes/libc-i386.scm: New file.
* module/nyacc/lang/c99/parser.mes: Add missing module includes.
* module/nyacc/lang/util.mes: Add missing module include.
* scripts/mescc.mes: Use Nyacc.
* guile/mescc.scm: New file.
* GNUmakefile (guile-mescc): Run it.
2016-12-31 09:03:07 +01:00
Jan Nieuwenhuizen
04bb0cb79d
Revert "core: Display me debuggor CPS+CC."
...
This reverts commit 6c327b5bdceae6fc59ac8cce4aed99ea0a491846.
2016-12-28 16:37:06 +01:00
Jan Nieuwenhuizen
134f39ce22
core: Display me debuggor CPS+CC.
...
Having display in the core is handy for debugging.
This is a courtesy commit intended to prevent bitrot.
* GNUmakefile (mes.o): Depend on display.
* mes.c: Include display.
* display.c: New file.
2016-12-28 16:35:12 +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
95a7782089
Revert "core: Display me debuggor."
...
This reverts commit 53ec23a0edcfdcb7dd4e32277e5a24e0a8fab5dd.
2016-12-25 11:54:14 +01:00
Jan Nieuwenhuizen
6014e56f68
core: Display me debuggor.
...
Having display in the core is handy for debugging.
This is a courtesy commit intended to prevent bitrot.
* GNUmakefile (mes.o): Depend on display.
* mes.c: Include display.
* display.c: New file.
2016-12-25 11:53:55 +01:00
Jan Nieuwenhuizen
9dcbdf2135
Revert "core: FAT_C_READER: Show your speed."
...
This reverts commit 5a9b9ac36bd33e497272b287ab1f0db715e01d38.
2016-12-25 09:57:19 +01:00
Jan Nieuwenhuizen
d8ea0d593b
core: FAT_C_READER: Show your speed.
...
scripts/nyacc.mes runs in 4s rather than 18s with fat C reader.
This is a courtesy commit intended to prevent bitrot.
* mes.c (quasiquote, unquote, unquote_splicing, syntax, quasisyntax,
unsyntax, unsyntax_splicing): Add symbols.
* reader.c (char_eof, char_nul, char_alarm, char_backspace, char_tab,
char_newline, char_vtab, char_page, char_return,
char_space)[FAT_C_READER]: New global variables.
(make_keyword, read_block_comment, read_character, read_hex,
append_char, read_string, fat_c_lookup_, fat_c_eat_whitespace,
fat_c_read_word): New functions.
(eat_whitespace_, read_word_, lookup_)[FAT_C_READER]: Add hook.
2016-12-25 08:41:27 +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
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
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
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
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
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
8256f2638e
core: Remove quasiquote, quasisyntax.
...
* quasiquote.c: Remove.
* mes.c: Remove callers.
* GNUmakefile (mes.o): Remove dependency on quasiquote.
2016-12-22 15:41:43 +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
c9c44ad63f
Add Nyacc example scripts.
...
* guile/nyacc-calc.scm: New file.
* guile/nyacc.scm: New file.
* scripts/nyacc-calc.mes: New file.
* scripts/nyacc.mes: New file.
* GNUmakefile (mes-check, guile-check): Run them.
2016-12-18 15:44:09 +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
f8bb463da6
Partial srfi-14 support for Nyacc.
...
* module/srfi/srfi-14.mes: New file.
* tests/srfi-14.test: New file.
* GNUmakefile (TESTS): Add it.
2016-12-20 12:26:20 +01:00
Jan Nieuwenhuizen
376435e974
Add missing srfi-1 functions for Nyacc.
...
* module/srfi/srfi-1.scm (fold, fold-right, remove, append-reverse,
remove!): New functions.
* tests/srfi-1.test: New file.
* GNUmakefile (TESTS): Add it.
* module/srfi/srfi-1.upstream.mes: Import bits from Guile-1.8.
* AUTHORS: Mention it.
2016-12-20 10:44:43 +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
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
1aba68dc6a
Silence garbage collector.
...
* GNUmakefile: unexport MES_DEBUG.
2016-12-13 20:55:50 +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
b92a8f17f8
core: use FIXED_PRIMITIVES rather than environment cache.
...
* cache.c: Remove.
* define.c: Remove callers.
* mes.c: Likewise.
(vm_eval_env) [FIXED_PRIMITIVES]: Hardcode car, cdr, cons, null_p.
* GNUmakefile: Update.
2016-12-12 20:35:19 +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
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
61e42e8527
core: Number based cells.
...
* mes.c (scm_t): Change car, string, ref, cdr, macro, vector into g_cell index
[WAS]: scm_t pointer.
* define.c: Update.
* lib.c: Update.
* math.c: Update.
* posix.c: Update.
* quasiquote.c: Update.
* string.c: Update.
* type.c: Update.
* build-aux/mes-snarf.mes Update.
* tests/gc-4.test: New test.
* tests/gc-5.test: New test.
* tests/gc-6.test: New test.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen
99cedbfbde
core: Add garbage collector/jam collector experiment.
...
* mes.c (gc, gc_loop, gc_copy, gc_move, gc_relocate_car,
gc_relocate_cdr, gc_flip): New function.
* tests/gc-0.test: New file.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen
db2eb86a40
test: Run psyntax before record.
...
* GNUmakefile (TESTS): Run psyntax before record.
2016-12-12 20:33:50 +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
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
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
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
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
6a4395869b
Move other post-boot and derived functions to lib.c.
...
* mes.c (c*r, length, last_pair, builtin_list, vector_to_list,
integer_to_char, char_to_integer, builtin_exit): Move to lib.c.
* lib.c: New file.
* GNUmakefile (mes.o): Depend on lib snarf output.
2016-10-22 20:51:32 +02:00
Jan Nieuwenhuizen
e282117de9
Move strings to string.c.
...
* mes.c (string, string_append, list_to_string, string_length,
string_ref, substring, number_to_string, string_to_symbol,
symbol_to_string): Move to string.c
* string.c: New file.
* GNUmakefile (mes.o): Depend on string snarf output.
2016-10-22 20:18:03 +02:00
Jan Nieuwenhuizen
be2f3bc274
Move arithmetic functions to math.c.
...
* mes.c (greater_p, less_p, is_p, minus, divide, modulo, multiply,
logior): Move to math.c.
* math.c: New file.
* GNUmakefile (mes.o): Depend on math snarf output.
2016-10-22 20:07:12 +02:00
Jan Nieuwenhuizen
27247383d7
Move define, define-macro to define.c.
...
* mes.c (define, define-macro): Move to define.c
* define.c: New file.
* GNUmakefile (mes.o): Depend on define snarf output.
2016-10-22 19:36:54 +02:00
Jan Nieuwenhuizen
bd7beddcda
Move quasiquote to quasiquote.c.
...
* mes.c (unquote, unquote_splicing, syntax, unsyntax,
unsyntax_splicing, eval_quasiquote, eval_quasisyntax, add_unquoters,
add_unsyntaxers): Move to quasiquote.c
* quasiquote.c: New file.
* GNUmakefile (mes.o): Depend on quasiquote snarf output.
2016-10-22 19:26:12 +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
3e03a12a4d
Generate C header and includes using snarfing.
...
* mes.c: Move specific renames and n-args to alist annotation.
* build-aux/mes-snarf.scm: New file.
* GNUmakefile (mes.environment.h): Use it.
(mes.h): Remove.
(clean): Update.
(mes.o): New dependency rule.
* .gitignore: Update.
2016-10-21 22:44:50 +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
c8e87f3021
Switch fat-c/boot using environment variable BOOT.
...
* GNUmakefile: check for BOOT, set CFLAGS.
* mes.c: Remove hardcoded BOOT define.
* scripts/include.mes: include loop-0 when BOOT is set.
2016-10-20 22:03:17 +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
d18e50a569
make tests standalone executable.
...
* tests/closure.test: Add shebang and boot-0 include.
* 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.
* GNUmakefile (mes-check): Run tests by exec'ing.
2016-10-19 00:36:12 +02:00
Jan Nieuwenhuizen
219a8cdfbb
make clean: remove symbols.i.
...
* GNUmakefile (clean): remove symbols.i.
2016-10-19 00:36:12 +02:00
Jan Nieuwenhuizen
b5af238305
Update guix hash.
...
* make/install.make (update-hash): New target.
* guix.scm: Prepare for update.
2016-10-18 23:50:09 +02:00
Jan Nieuwenhuizen
3128c4b976
Prepare for 0.1 release: gnu-build-system.
...
* configure: New file.
* make/install.make: New file.
* .gitignore: Ignore generated files.
* build-aux/gitlog-to-changelog: New file.
2016-10-16 00:34:23 +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
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
7ff86c393f
cleanup and doc update.
2016-10-10 23:24:44 +02:00
Jan Nieuwenhuizen
2e1685dc2d
test/match.test: pass.
2016-10-11 18:51:30 +02:00
Jan Nieuwenhuizen
d3fab554d5
let-syntax.mes: implement.
2016-10-10 22:55:37 +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
509bf3956e
mes.c: uniquify symbols.
2016-10-08 08:41:30 +02:00
Jan Nieuwenhuizen
3ff385ce6d
mes-check: separate target.
2016-10-08 08:38:29 +02:00
Jan Nieuwenhuizen
2c7f26dbe6
mescc.scm: first a.out produced from main.c.
2016-08-14 01:44:42 +02:00
Jan Nieuwenhuizen
24291da28e
elf.mes: remove text-free, softcode data-offset.
2016-08-13 19:19:52 +02:00
Jan Nieuwenhuizen
00e000306d
elf.mes: compute text-free, text-offset.
2016-08-13 15:27:02 +02:00
Jan Nieuwenhuizen
1d08cc7f6f
elf.mes: separate-out text, text-free and data sections.
2016-08-13 10:32:07 +02:00
Jan Nieuwenhuizen
355042300c
elf.mes: a.out runs.
2016-08-12 16:38:59 +02:00
Jan Nieuwenhuizen
0829c5762c
mescc/elf.mes: write minimal ELF header.
2016-08-12 14:17:55 +02:00
Jan Nieuwenhuizen
ef874c8fd3
syntax-if.mes: TODO.
2016-07-27 12:16:44 +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
3864d434fc
split-up test suite, implement quasiquote in scheme.
2016-07-25 14:39:56 +02:00
Jan Nieuwenhuizen
384a88dd53
hello.c, hello.S: hello world target for C compiler.
2016-07-26 07:30:53 +02:00
Jan Nieuwenhuizen
f170735edb
mescc: mes parses simplest main with lalr.
2016-07-25 01:12:22 +02:00
Jan Nieuwenhuizen
60a7c9099f
mescc.scm: parse simple main.c.
2016-07-24 23:18:53 +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
07a5f716fc
lalr paren test
2016-07-24 12:08:21 +02:00
Jan Nieuwenhuizen
d4e335b447
mes.c: add syntax, quasisyntax to reader....
2016-07-24 00:40:37 +02:00
Jan Nieuwenhuizen
262c507303
check: resurrect guile-check.
2016-07-23 15:17:03 +02:00
Jan Nieuwenhuizen
5126e16e66
trying to get records up....WIP
2016-07-23 14:39:33 +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
61bbbdffbf
mes.c: move begin_env into eval, decruft.
2016-07-19 18:18:27 +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
d21d4aecfc
guile runs macro-based mes:define-syntax, mes runs but yields *undefined*.
2016-07-17 00:03:14 +02:00
Jan Nieuwenhuizen
be12facd6d
support define-macro inside eval (i.e., inside define-macro)
2016-07-16 23:35:07 +02:00
Jan Nieuwenhuizen
d53ea79a5d
syntax...
2016-10-18 22:19:57 +02:00
Jan Nieuwenhuizen
02dc00d11c
update macro, fix andmap.
2016-07-16 13:24:38 +02:00
Jan Nieuwenhuizen
ddccd4747a
add variable argument append.
2016-07-11 21:50:59 +02:00
Jan Nieuwenhuizen
081cb4a94f
add vectors.
2016-07-11 10:38:02 +02:00