Commit graph

893 commits

Author SHA1 Message Date
Jan Nieuwenhuizen 26e3e41357 core: Remove make_string.
* mes.c (MAKE_STRING): New macro.
  (make_string): Remove.  Update callers.
* string.c: Update callers.
2016-12-23 16:38:07 +01:00
Jan Nieuwenhuizen faed68ed57 core: Remove make_ref.
* mes.c (MAKE_REF): New macro.
  (make_ref): Remove.  Update callers.
2016-12-23 16:31:56 +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 c2a12c4f34 Remove make_function.
* mes.c (make_function): Remove.
2016-12-23 16:02:36 +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 570eec966e core: Do some tail call elimination.
* mes.c (eval_apply): Use goto instead of return.
2016-12-22 16:50:51 +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 cc58cf2e04 core: Remove vm_call_lambda.
* mes.c (vm_call_lambda): Remove.
 (call_lambda): Use begin_env.
2016-12-22 16:16:09 +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 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 527fd253eb core: Disable quasiquote.
* mes.c (QUASIQUOTE): Switch off.
* tests/read.test: Remove quasiquote tests.
2016-12-22 15:36:29 +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 6854627391 core: Bugfix append with one argument.
* mes.c (append): Handle one argument.
* tests/base.test ("append", "append 0" ... "append 5"): New tests.
2016-12-22 14:22:40 +01:00
Jan Nieuwenhuizen 681a541774 core: Do macro expansion only once.
* mes.c (vm_eval_env): I will expand this macro only once.
2016-12-22 08:31:20 +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 9bd403adbe Nyacc example scripts: support Guile-1.8. 2016-12-19 22:14:04 +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 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 23754e6f75 core: Bugfix unread_byte.
* mes.c (unread_byte): Return SCM value instead of stray int.
2016-12-20 22:28:29 +01:00
Jan Nieuwenhuizen e97d99c03a Add ash.
* math.c (ash): New function.
* tests/scm.test (ash, ash -1): New tests.
2016-12-20 20:10:43 +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
Jan Nieuwenhuizen ec63a9c625 Nicer closure and builtin procedure display.
* display.c (display): Show closure as procedure with formal
  parameters.  Display ariry as fake parameters with builtin.
2016-12-20 19:13:31 +01:00
Jan Nieuwenhuizen d08a28cfc1 Add string->number.
* module/mes/scm.mes (string->number): New function.
2016-12-20 19:01:00 +01:00
Jan Nieuwenhuizen 489d7c7f51 Add unless.
* module/mes/scm.mes (unless): New syntax.
2016-12-20 15:48:10 +01:00
Jan Nieuwenhuizen 8e1b25368b Add iota.
* module/mes/scm.mes: (iota): New function.
* tests/scm.test (iota, iota 0, iota -1): New tests.
2016-12-20 19:25:26 +01:00
Jan Nieuwenhuizen 641653563d Partial srfi-43 support for Nyacc.
* module/srfi/srfi-43.mes: New file.
2016-12-20 11:31:46 +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 c07f3e18ca Add delete, delq, vector-copy.
* module/mes/scm.mes (filter, delete, delq, vector-copy): New functions.
2016-12-20 11:19:40 +01:00
Jan Nieuwenhuizen d7d46b9546 Add negative?, positive?, zero?, 1+ 1-.
* module/mes/scm.mes (negative?, positive?, zero?, 1+, 1-): New functions.
2016-12-20 10:57:09 +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