Commit graph

626 commits

Author SHA1 Message Date
Jan Nieuwenhuizen 7b476693c2
core: Have core:eval expand macros.
* src/mes.c (core:eval-expand): Remove
  (core:eval-expanded): New variable.
  (eval_apply): Have core:eval expand macros; core:eval-expanded evals
  expanded sexps.
2018-04-28 18:31:10 +02:00
Jan Nieuwenhuizen 1400489a94
Revert "core: Remove pmatch-car, pmatch-cdr hack."
This reverts commit be1e84624ea4a158173f34af923e3c4a3793412a.
2018-04-29 07:46:40 +02:00
Jan Nieuwenhuizen c03449ac5a
core: Remove pmatch-car, pmatch-cdr hack.
* src/mes.c (scm_vm_eval_pmatch_car, scm_vm_eval_pmatch_cdr): Remove
  (eval_apply): Remove cell_vm_eval_pmatch_car,
  cell_vm_eval_pmatch_cdr hack.
  (mes_symbols): Remove cell_symbol_pmatch_car, cell_symbol_pmatch_cdr.
* scaffold/mini-mes.c: Likewise.
* module/mes/guile.scm (mes): Remove pmatch-car, pmatch-cdr.
* module/mes/pmatch.scm (ppat): Use plain car, cdr.
2018-04-28 12:19:40 +02:00
Jan Nieuwenhuizen 98ccaceb25
mes: Remove debugging.
* module/mes/module.mes (mes-load-module-env): Remove debugging.
2018-05-02 22:52:31 +02:00
Jan Nieuwenhuizen 81ed6564cf
mescc: Use file-name as global prefix.
* module/mes/M1.mes (object->M1): Add file-name parameter.
2018-05-03 09:01:00 +02:00
Jan Nieuwenhuizen f8eaebf713
mescc: Fix dumping of strings > M1_STRING_MAX.
* module/mes/M1.mes (object->M1): Skip opening quote.
2018-05-02 15:53:37 +02:00
Jan Nieuwenhuizen a937d18c38
build: Simplify, drop make.scm experiment.
* build.sh: Rewrite.
* build-aux/build-cc.sh: New file.
* build-aux/build-mes.sh: New file.
* build-aux/build-mlibc.sh: New file.
* build-aux/cc.sh: New file.
* build-aux/cc-mes.sh: New file.
* build-aux/cc-mlibc.sh: New file.
* install.sh: Update.
* make.scm: Remove.
* guile/guix/make.scm: Remove.
* guile/guix/records.scm: Remove.
* guile/guix/shell-utilsg.scm: Remove.
2018-04-29 18:38:57 +02:00
Jan Nieuwenhuizen 1b0089111f
mes: Support -C and -L for Guile compatibility.
* module/mes/boot-0.scm): Support -C and -L for Guile compatibility.

Signed-off-by: Jan Nieuwenhuizen <janneke@gnu.org>
2018-04-29 19:06:11 +02:00
Jan Nieuwenhuizen 4ca4e9a6ff
mes: Support -e,--main option.
* module/mes/boot-0.scm: Support -e,--main option.
2018-04-29 18:37:00 +02:00
Jan Nieuwenhuizen 08d6c24263
mes: Upgrade Guile module support.
* module/mes/boot-0.scm (define-module): New macro with minimal Guile support.
  (use-modules): New macro.
2018-04-29 18:35:22 +02:00
Jan Nieuwenhuizen a2e9a6925c
mes: Add srfi-8.
* module/srfi/srfi-8.mes: New file.
2018-04-29 23:31:22 +02:00
Jan Nieuwenhuizen 8d866b6441
mes: string-join: Handle empty list.
* module/mes/boot-0.scm (string-join): Handle empty list.
2018-04-29 18:34:21 +02:00
Jan Nieuwenhuizen b209378fca
mes: Add basename.
* module/mes/posix.mes (basename): New function.
2018-04-29 18:33:14 +02:00
Jan Nieuwenhuizen 4dfe6e00cc
mes: Add delete-duplicates.
* module/srfi/srfi-1.mes (delete-duplicates): New function.
2018-04-29 18:32:35 +02:00
Jan Nieuwenhuizen 75db8bed91
mes: filter-map: Handle two lists.
* module/srfi/srfi-1.mes (filter-map): Handle two lists, add error
  when called with three or more.
2018-04-29 18:29:26 +02:00
Jan Nieuwenhuizen 56ef2f3f2d
mes: Add string-replace.
* module/srfi/srfi-13.mes (string-replace): New function.
* tests/srfi-13.test ("string-replace"): Test it.
2018-04-29 18:27:29 +02:00
Jan Nieuwenhuizen 563d1d92f9
mes: Add string-map.
* module/srfi/srfi-13.mes (string-map): New function.
* tests/srfi-13.test ("string-map"): Test it.
2018-04-29 18:26:46 +02:00
Jan Nieuwenhuizen 59d4d90a90
mes: Add string-trim, string-trim-right, string-trim-both.
* module/srfi/srfi-13.mes (string-trim, string-trimn-right,
  string-trim-both): New function.
* tests/srfi-13.test ("string-trim"): Test it.
  ("string-trim-right"):
  ("string-trim-both"):
2018-04-29 18:24:29 +02:00
Jan Nieuwenhuizen 3c9b5f433d
mes: Add string-contains.
* module/srfi/srfi-13.mes (string-contains): New function.
* tests/srfi-13.test ("string-contains"): Test it.
  ("string-contains not"):
2018-04-29 18:21:52 +02:00
Jan Nieuwenhuizen 1f216444f6
mes: string-drop: Error on negative droppings.
* module/srfi/srfi-13.mes (string-drop, string-take,
  string-drop-right): Error on negative droppings.
* tests/srfi-13.test ("string-drop"): Test it.
2018-04-29 18:15:04 +02:00
Jan Nieuwenhuizen dc24a7f76f
core: Add string ports.
* src/mes.c (type_t): Add TPORT.
  (scm_type_port): New symbol.
  (PORT): New macro.
  (MAKE_STRING_PORT): New macro.
  (eval_apply): Handle string ports in primitive-load.
  (mes_symbols): Add scm_type_port.
* src/posix.c (peekchar): Handle string ports.
  (readchar): New function.  Replace all getchar callers.
  (unreadchar): Likewise.
* module/mes/type-0 (port?): New function.
* module/mes/guile.mes (with-input-from-file): Rewrite.
  (open-input-string): Remove.
* module/mes/guile.scm (guile): Update cell types.
* src/gc.c (gc_loop): Support TPORT.
* src/lib.c (display_helper): Support TPORT.
* module/mes/display.mes (display): Support TPORT.
2018-04-29 17:48:38 +02:00
Jan Nieuwenhuizen c20ef52f6f
mes: assq, assoc-ref: Handle non-A-LISTs.
* src/mes.c (assq): Return #f if A-LIST is not a list.
* module/mes/scm.mes (assoc): Likewise.
2018-04-29 16:17:07 +02:00
Jan Nieuwenhuizen 8911af4aa8
core: Use single definition rule for cell-type.
* src/mes.c (scm_type_char, scm_type_closure, scm_type_continuation,
  scm_type_function, scm_type_keyword, scm_type_macro,
  scm_type_number, scm_type_pair, scm_type_ref, scm_type_special,
  scm_type_string, scm_type_symbol, scm_type_values,
  scm_type_variable, scm_type_vector): New symbol.
  (mes_symbols): Add them.
* module/mes/type-0.mes (<cell:char>, <cell:char>, <cell:closure>,
  <cell:continuation>, <cell:function>, <cell:keyword>, <cell:macro>,
  <cell:number>, <cell:pair>, <cell:ref>, <cell:special>,
  <cell:string>, <cell:symbol>, <cell:values>, <cell:variable>,
  <cell:vector>, <cell:broken-heart): Remove.
* module/mes/boot-0.scm: Likewise.
* module/mes/boot-01.scm: Likewise.
* module/mes/boot-02.scm: Likewise.
* scaffold/boot/20-define-quote.scm: Likewise.
* scaffold/boot/37-closure-lambda.scm: Likewise.
* scaffold/boot/38-simple-format.scm: Likewise.
* scaffold/boot/4c-quasiquote.scm:
* scaffold/boot/4e-string-split.scm: Likewise.
* scaffold/boot/51-module.scm: Likewise.
* scaffold/boot/52-define-module.scm: Likewise.
* scaffold/boot/60-let-syntax.scm: Likewise.
* module/mes/guile.scm: Add some of them.
2018-04-29 13:22:02 +02:00
Jan Nieuwenhuizen e628b311d6
mescc: Create less garbage when dumping M1.
* module/mes/M1.mes (display-join): New function.
* (object->M1): Use it.
2018-04-24 07:26:27 +02:00
Jan Nieuwenhuizen 18d143aa62
core: last_pair: Move to core.
* src/lib.c (last_pair): New function.
* module/mes/scm.mes (last-pair): Remove.
2018-04-24 07:00:35 +02:00
Jan Nieuwenhuizen 9936aa383b
mescc: Use display for dumping M1.
* module/mes/M1.mes (object->M1): Use display for dumping M1.
2018-04-23 06:56:35 +02:00
Jan Nieuwenhuizen 630718f134
mes: Guile-like command-line interface.
* module/mes/boot-0.scm (tty?): Guile-like command-line interface.
* scripts/repl.mes: Remove.
* scripts/mescc.mes: Update.
* tests/*.test: Update scripts.
* module/mes/repl.mes (repl): Add ,quit.
2018-04-22 11:51:28 +02:00
Jan Nieuwenhuizen a26eae418b
mes: getopt-long: Support stop-at-first-non-option.
* module/mes/getopt-long.scm (process-options): Fix parsing `-'.  Add
  parameter: stop-at-first-non-option.
  (getopt-long): Add keyword parameter #:stop-at-first-non-option.
2018-04-22 11:49:30 +02:00
Jan Nieuwenhuizen d3f962c376
mes: display: Display escaped characters.
* module/mes/display.mes (display): Display escaped characters.
2018-04-22 20:08:38 +02:00
Jan Nieuwenhuizen 7ecec93a88
mes: Resurrect macros in repl.
* src/mes.c (scm_vm_begin_expand): Rename to core:begin-expand.
 (eval_apply): Expose it.
* module/mes/repl.mes (repl): Use it to resurrect macros.
2018-04-21 17:30:14 +02:00
Jan Nieuwenhuizen 0be441446e
core: drop global_p from variable.
* src/mes (struct scm): Remove field global_p.
 (VARIABLE_GLOBAL_P): Remove.
 (make_variable_): Remove global_p parameter.  Update callers.
* src/lib.c (display_helper): Drop VARIABLE_GLOBAL_P support.
2018-04-21 13:19:54 +02:00
Jan Nieuwenhuizen 4b6d11e990
core: append2, append_reverse, reverse, reverse!: Create less garbage.
* src/mes.c (append_reverse): New function.
  (reverse_x_): New function.
  (append2): Use them to create less garbage.
* module/mes/scm.mes (reverse): Create less garbage.
* module/srfi/srfi-1.mes (reverse!): Rewrite, use core:reverse!.
  (append-reverse): Remove.
2018-04-20 14:38:24 +02:00
Jan Nieuwenhuizen 3330948a90
core: Optimize vector-map, vector-for-each.
* module/srfi/srfi-43.mes (vector-map): Optimize.
  (vector-for-each): Optimize.
* tests/srfi-43.test: New file.
* tests/srfi-43.test-guile: New file.
* check.sh (tests): Add it.
* make.scm (mes-tests): Add it.
2018-04-20 13:06:00 +02:00
Jan Nieuwenhuizen d052876f85
mes: Add char-whitespace?
* module/srfi/srfi-14.mes (char-whitespace?): New function.
2018-04-15 08:04:09 +02:00
Jan Nieuwenhuizen 0d0c7a415b
mes: Move base-0.mes int boot-0.scm.
* module/mes/boot-02.scm: New file, rename from boot-0.scm.
* module/mes/boot-0.scm: Add base-0.mes.
* module/mes/base-0.mes: Remove.
2018-04-14 22:06:28 +02:00
Jan Nieuwenhuizen b65e57be31
core: Tune debug printing.
* src/mes.c: Tune debug printing.
* src/gc.c: Likewise.
* module/mes/guile.mes: Likewise.
* HACKING: Describe it.
2018-04-09 07:12:38 +02:00
Jan Nieuwenhuizen 72fc46a572
core: Rewrite reader to create less garbage.
* src/reader.c (reader_read_line_comment): Rename from read_line_comment.
(reader_identifier_p): New function.
(reader_end_of_word_p): New function.
(reader_read_identifier_or_number): New function.
(reader_read_sexp_): Rewrite.  Update callers.
(reader_read_list): Rewrite.
(reader_lookup_): Remove.
2018-04-09 08:41:30 +02:00
Jan Nieuwenhuizen ad135d3752 doc: Release udpate.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.12: New file.
* throughout: (janneke) coming out.
2017-11-21 19:22:26 +01:00
Jan Nieuwenhuizen 4958921abc mes: Add string-fold, string-fold-right.
* module/srfi/srfi-13.mes (string-fold, string-fold-right): New
  function.
* tests/srfi-13.test ("string-fold"): Test it.
  ("string-fold-right"): Test it.
2018-04-07 13:37:07 +02:00
Jan Nieuwenhuizen cd0e3f8ba5 mescc: Remove debugging.
* module/language/c99/compiler.mes: Remove debugging.
2018-04-07 13:14:58 +02:00
Jan Nieuwenhuizen 83549786ed mescc: No comments in M1 when running on Mes.
* module/language/c99/compiler.mes (ast-comment): If mes?, return nil.
2018-04-07 13:13:26 +02:00
Jan Nieuwenhuizen 5867ac4afe mescc: Trace globals.
* module/language/c99/compiler.mes (mescc:trace): New function.  Use
  throughout.
2018-04-07 12:56:17 +02:00
Jan Nieuwenhuizen da724cdaa1 Revert "core: Add member."
This reverts commit 921686a0a3b06281f1804d04e6d4a0344dda507a.
2018-04-07 13:15:26 +02:00
Jan Nieuwenhuizen f33d23bca1 core: Add member.
* src/lib.c (member): New function.
* module/mes/scm.mes (member): Remove.
2018-04-07 12:18:50 +02:00
Jan Nieuwenhuizen 5e9c539f57 mescc: trace M1 dumping.
* module/language/c99/compiler.mes (info->object): Add tracing.
* module/mes/M1.mes (object->M1): Add tracing.
2018-04-07 10:24:57 +02:00
Jan Nieuwenhuizen 30262dcdc1 mescc: Also print `parsing: input' when using -E.
* module/language/c99/compiler.mes (c99-input->ast): Print `parsing:
  input'.
  (c99-input->info): Remove that.
2018-04-06 07:18:19 +02:00
Jan Nieuwenhuizen 0a4030838c core: Add equal2?.
* src/lib.c (equal2_p): New function.
* module/mes/base.mes (equal2?): Remove.
2018-04-05 20:01:04 +02:00
Jan Nieuwenhuizen 6a9621ebf3 core: Add memq.
* lib/mes.c (memq): New function.
* module/mes/scm.mes (memq): Remove.
2018-04-05 11:03:09 +02:00
Jan Nieuwenhuizen 76e1b0582f mes: Remove duplicate memq.
* module/mes/base-0.mes (memq): Remove.
2018-04-05 11:02:06 +02:00
Jan Nieuwenhuizen 9fc27ee25a mes: Single environment lookup for variables, SICP chapter 3.
* src/mes.c (t): Add TVARIABLE.
  (scm_vm_eval_deref): New vm special.
  (make_vref_): New internal function.
  (eval_apply): WIP: replace symbols with their variable reference.
* src/gc.c (gc_loop): Handle TVARIABLE.
* src/lib.c (display_helper): Handle TVARIABLE.
* module/mes/type-0.mes (<cell:variable>): New variable.
  (cell:type-alist): Add it.
  (variable?): New function.
* module/mes/display.mes (display): Handle <variable>.
2017-12-09 08:33:50 +01:00