Jan Nieuwenhuizen
4dfad613bf
mes: Support equal? with arbitrary number of arguments.
...
* module/mes/base.mes (equal2?): Rename from equal?.
(equal?): Implement.
2018-01-01 23:00:01 +01:00
Jan Nieuwenhuizen
72a4f7eba2
mescc: Use records for mes too.
...
* module/language/c99/info.mes: Use info.scm records, remove
simplistic list data structures.
2018-01-01 22:21:15 +01:00
Jan Nieuwenhuizen
c096a81cb5
mescc.mes: Use write for preprocessing output.
...
* scripts/mescc.mes (source->ast): Use core:write instead of pretty-print.
2018-01-01 21:13:46 +01:00
Jan Nieuwenhuizen
81404179c1
mes: Add write, core:write.
...
* src/lib.c (display_helper, fdisplay_): Add parameter, write_p.
Update callers. When write_p: write quoted strings.
(write_, write_port_): New function.
* module/mes/read-0.mes (write): New function.
2018-01-01 21:10:15 +01:00
Jan Nieuwenhuizen
c092aeb7f7
mes: gc_safety.
2018-01-01 20:00:06 +01:00
Jan Nieuwenhuizen
1262e58199
check-mescc.sh: run with mes.
...
* src/build.sh:
* src/check-mescc.sh: Run with mes.
2018-01-01 16:55:07 +01:00
Jan Nieuwenhuizen
1601bc18cc
mes: Add string-null?.
...
* module/srfi/srfi-13.mes (string-null?): New function.
2018-01-01 16:41:15 +01:00
Jan Nieuwenhuizen
244d11a2af
mes: Add dirname.
...
* module/mes/guile.mes (dirname): New function.
2018-01-01 16:40:23 +01:00
Jan Nieuwenhuizen
08562b168d
test: Add syntax tests.
...
* tests/syntax.test: New file.
* tests/syntax.test-guile: New file.
fixup: 1b0696f9 (Jan Nieuwenhuizen 2018-01-01 15:53:13 +0100 40) , (lambda ()
2018-01-01 15:53:13 +01:00
Jan Nieuwenhuizen
562d91466c
Revert "mes: use array-based stack. WIP: will not survice gc."
...
This reverts commit 7fb653f68c2dbf8bc83cce4bd138439c600b538f.
2017-12-17 07:42:49 +01:00
Jan Nieuwenhuizen
da20d92c77
mes: use array-based stack. WIP: will not survice gc.
...
* src/mes.c (STACK_SIZE)[MES_ARRAY_STACK]: New variable.
(g_stack_array): New variable.
(g_stack): Change type to SCM*.
* (gc_push_frame)[MES_ARRAY_STACK]: Use g_stack_array, g_stack.
(gc_peek_frame): Likewise.
(gc_pop_frame): Likewise.
* src/gc.c (gc_check): Likewise.
(gc): Likewise.
2017-12-14 07:05:53 +01:00
Jan Nieuwenhuizen
90249f595f
mes: Fix assq to improve performance.
...
* src/mes.c (assq): Special case eq_p to improve performance.
2017-12-12 20:25:48 +01:00
Jan Nieuwenhuizen
0f042b6ea6
mes: Reimplement records.
...
* module/srfi/srfi-9.mes (define-record-type): New macro.
* AUTHORS: Update.
* module/mes/record-0.mes: Remove.
* module/mes/record.mes: Remove.
* module/srfi/srfi-9-psyntax.mes: Remove.
* module/srfi/srfi-9.scm: Remove.
* make.scm: Remove them.
2017-12-12 00:12:42 +01:00
Jan Nieuwenhuizen
eb0505300c
mes: Fix display of closure.
...
* module/mes/display.mes (display): Drop extra ( at start of *closure*, *circ*.
* src/lib.c (display_helper): Likewise.
2017-12-11 07:06:21 +01:00
Jan Nieuwenhuizen
30efe5ffbc
mes: Resurrect define, define-macro in C core.
...
* make.scm (bin.gcc, bin.mescc): Use MES_C_READER=1.
* src/mes.c (scm_symbol_define, scm_symbol_define_macro): New symbol.
(scm_vm_eval_define): New special.
(scm_symbol_c_define): New symbol.
(MAKE_MACRO): New define.
(eval_apply)[MES_C_DEFINE]: Handle define, define-macro.
(mes_symbols): Define %c-define for use in read-0.mes.
* module/mes/read-0.mes: Do not implement full scheme define if %c-define.
* module/mes/quasiquote.mes (sexp:define, env:define, env:macro): New function.
(define-macro): New macro. FIXME
* module/mes/psyntax.mes (define): New macro. FIXME
2017-12-09 08:24:38 +01:00
Jan Nieuwenhuizen
065cee9bda
mes: Fix initial display.
...
* module/mes/read-0.mes (display): Fix.
2017-12-10 15:51:35 +01:00
Jan Nieuwenhuizen
aec2f68118
mes: Fix compile warning in reader.
...
* src/reader.c[MES_C_READER]: Declare read_block_comment, read_hash.
Fixes compile warning.
2017-12-11 04:52:00 +01:00
Jan Nieuwenhuizen
a2f6511f5e
mescc: Allow invoking git mescc.mes from elsewhere.
...
* src/mes.c (load_env): Look in MES_PREFIX too. Add debug printing.
* scripts/mescc.mes: Consider MES_PREFIX.
* guile/mescc.scm (%prefix): Consider MES_PREFIX.
* module/mes/base-0.mes (string->list): New function, move from type-0.mes.
(%moduledir): Consider MES_PREFIX.
* module/mes/type-0.mes (string->list): Remove.
2017-12-09 22:38:51 +01:00
Jan Nieuwenhuizen
ccddde9a84
mescc: Output performance hacks: use core:display.
...
* src/lib.c (display_): Write to g_stdout (WAS: STDOUT).
* module/mes/guile.scm (guile): Declare and export core:display core:display-error.
* module/mes/M1.mes (object->M1): Use core:display and string-append
instead of format.
* module/mes/guile.mes (with-input-from-string): Add debugging.
(open-input-string): Likewise.
(read-string): Likewise. Re-implement.
(drain-input): Use read-string.
2017-12-09 20:10:57 +01:00
Jan Nieuwenhuizen
572b45f4cd
mes: Nyacc support: substring/copy, substring/shared.
...
* module/srfi/srfi-13.mes (substring/copy, substring/shared): Define
to substring.
2017-12-09 22:45:38 +01:00
Jan Nieuwenhuizen
85b5422c35
mes: Nyacc support: Read old characters.
...
* src/reader.c (read_character)[MES_C_READER]: Support reading old
characters: #\bel, #\bs, #\vt.
2017-12-09 22:36:53 +01:00
Jan Nieuwenhuizen
18b57b68aa
mes: resurrect running MesCC: handle \t in strings.
...
* src/reader.c (read-string): Handle \t. Fixex M1 output.
2017-12-09 19:33:10 +01:00
Jan Nieuwenhuizen
6a4f601424
mescc: Use small, bootstrappable syntax rather than huge psyntax seed.
...
* module/nyacc/lex.mes (mes): Use syntax (WAS: psyntax).
* module/mes/pmatch.mes (mes): Likewise.
* module/nyacc/lang/c99/parser.mes (srfi-9): Use syntax (WAS: srfi-9-psyntax).
2017-12-09 10:55:46 +01:00
Jan Nieuwenhuizen
2aafee0163
mes: Fix for pmatch on bootstrappable syntax-rules.
...
* module/mes/pmatch.scm (ppat): Do not use let.
* tests/pmatch.test ("pmatch nyacc minimal", "pmatch nyacc"): Test it.
2017-12-09 15:04:32 +01:00
Jan Nieuwenhuizen
49de95fe5d
mlibc: M4 support: robustify headers, add sys/signal.h.
...
* include/errno.h (ERANGE): New define.
* include/stdarg.h (size_t): Undefine before typedef.
* include/stdint.h: Likewise.
* include/stdio.h: Likewise.
* include/stdlib.h: Likewise.
* include/sys/types.h: Likewise.
* include/string.h: Likewise.
(ssize_t): Undefine before typedef.
* include/unistd.h: Likewise.
(off_t): Undefine before typedef.
* include/sys/stat.h (struct stat): New stub.
* include/sys/signal.h: New file.
2017-12-05 19:49:37 +01:00
Jan Nieuwenhuizen
71906fb735
mescc: M4 support: scaffold/tests/82-define.c.
...
* scaffold/tests/82-define.c: New file; inspired by M4. Thanks, Ricardo!
* make.scm ("82-define"): Build it.
* check-mescc.sh: Add 82-define.
2017-12-04 23:19:32 +01:00
Jan Nieuwenhuizen
53695b6124
mlibc: Tinycc support: Avoid hex.
...
* include/00-test.i (main)[__TINYC__]: Do not use $0x.
2017-12-04 22:58:10 +01:00
Jan Nieuwenhuizen
05c33b052a
mlibc: Tinycc support: qsort.
...
* lib/libc+tcc.c (qswap, qpart): New function
(qsort): Implement.
* scaffold/tests/81-qsort.c: Test it.
* make.scm ("81-qsort"): Build it.
2017-12-04 19:01:39 +01:00
Jan Nieuwenhuizen
8b5e1dde3c
mescc: scaffold: misc cleanups.
...
* scaffold/tests/44-switch.c (swits): More case labels.
* scaffold/tests/60-math.c: Discriminate return values.
* scaffold/tests/77-pointer-assign.c (memset)[__TINYC__]: Remove.
* scaffold/tests/79-int-array.c (test): Discriminate return values.
2017-12-03 23:03:09 +01:00
Jan Nieuwenhuizen
7a7bcda79e
mlibc: Tinycc support: __udivdi3, __umoddi3.
...
* lib/libc+tcc-gcc.c (__udivdi3, __umoddi3): Fix signature, do not
crash on simple integer devisions.
2017-12-03 20:40:49 +01:00
Jan Nieuwenhuizen
4ce75e8f4b
mescc: Tinycc support: Respect word size better.
...
* stage0/x86.M1 (movzwl_0x32(%ebp),%eax,movzwl_0x8(%ebp),%eax): New
define.
* module/mes/as-i386.mes (i386:push-word-local-de-ref,
i386:word-local->accu): New function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (push-local-de-ref): Respect word size.
(ident->accu): Likewise.
2017-12-03 16:33:35 +01:00
Jan Nieuwenhuizen
808af5001f
mlibc: New library layout; remove duplication.
...
* lib/libc+tcc-gcc.c: New file: Libc bits for GCC from libc-mes+tcc.c.
* lib/libc+tcc-mes.c: New file: Libc bits for MesCC from libc-mes+tcc.c.
* lib/libc+tcc.c: New file: Libc bits from libc-mes+tcc.c.
* lib/libc.c: New file: Merged from libc-mes.c, libc-gcc.c.
(abtoi): New function: Rename from _atoi.
* lib/linux+tcc-gcc.c: New file: Linux bits from libc-gcc+tcc.c.
* lib/linux+tcc-mes.c: New file: Linux bits from libc-mes+tcc.c.
* lib/linux-gcc.c: New file: Linux bits from libc-gcc.c.
* lib/linux-mes.c: New file: Linux bits from libc-mes.c.
* lib/mini-libc-gcc.c: New file.
* lib/mini-libc.c: New file: Libc bits from mini-libc-mes.c.
* lib/mini-linux-gcc.c: New file.
* lib/mini-linux-mes.c: New file: Linux bits from mini-libc-mes.c.
* lib/libc-gcc.c: Remove duplication using include now.
* lib/libc-mes.c: Likewise.
* lib/mini-libc-mes.c: Likewise.
* include/stdio.h (puts)[POSIX]: Remomve macro.
(fputc, fputs)[!POSIX]: New macro.
(fputc, fputs): Remove declaration.
* scaffold/tests/7j-strtoull.c (strtoull, test): Use abtoi.
* src/lib.c (fputs)[__MESC__]: Remove define.
* guile/guix/make.scm: Update for new library layout.
* make.scm: Likewise.
* build.sh: Likewise.
* install.sh: Likewise.
2017-12-03 13:56:21 +01:00
Jan Nieuwenhuizen
d7b35f6b1e
mlibc: Tinycc support: itoab, for debugging.
...
* lib/libc-gcc.c (itoab): New function.
* lib/libc-mes.c (itoab): New function.
2017-12-03 10:33:05 +01:00
Jan Nieuwenhuizen
3636818b1a
mescc: prefix string labels with _.
...
* module/mes/M1.mes (object->M1): Prefix string lables with _.
2017-12-02 14:04:41 +01:00
Jan Nieuwenhuizen
60b7048e21
mescc: prefix local labels with _.
...
* module/language/c99/compiler.mes (expr->accu): prefix local labels with _.
2017-12-02 12:59:07 +01:00
Jan Nieuwenhuizen
e2b2e5b032
bootstrap: Update build script.
...
* build.sh: Add blood-elf, use -o.
2017-12-02 08:48:34 +01:00
Jan Nieuwenhuizen
01af41e6f7
mlibc: Mescc-tools support: fix for [v]fprintf.
...
* lib/libc-mes+tcc.c (vfprintf): Bugfix: print to fd.
2017-12-02 08:46:41 +01:00
Jan Nieuwenhuizen
c3fdfedb20
mes: resurrect full reader in C core.
...
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 21:42:50 +01:00
Jan Nieuwenhuizen
74c4197467
mescc: Mescc-tools support: char foo[BAR] = {'a', 'b', 'c'}.
...
* stage0/x86.M1 (mov____%al,0x8(%ebp), mov____%al,0x32(%ebp),
mov____%ax,0x8(%ebp), mov____%ax,0x32(%ebp)): New define.
* module/mes/as-i386.mes (i386:accu->local+n,i386:byte-accu->local+n,
i386:word-accu->local+n): New function.
* module/language/c99/compiler.mes (accu->local+n): New function.
(initzer->data): Return char as single byte.
(decl->info): Support char foo[BAR] = {'a', 'b', 'c'}.
* scaffold/tests/66-local-char-array.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-11-27 19:51:18 +01:00
Jan Nieuwenhuizen
49d01a46fa
mlibc: Mescc-tools support: chmod.
...
* stage0/x86.M1 (SYS_chmod): New define.
* lib/libc-gcc.c (chmod): New function.
* lib/libc-mes.c (chmod): New function.
2017-11-26 18:45:10 +01:00
Jan Nieuwenhuizen
e8884d83e1
mlibc: GNU Gcc support: setjmp, longjmp.
...
* stage0/x86.M1 (jmp____*%ebx): New macro.
(mov____0x8(%ebp),%ebp): New macro.
(mov____0x8(%ebp),%esp): New macro.
* include/setjmp.h (jmp_buf): Redefine as struct.
* lib/libc-mes+tcc.c (longjmp, setjmp): Implement.
* scaffold/tests/80-setjmp.c: Test it.
* make.scm ("80-setjmp"): Build it.
* .gitignore: Ignore *.tcc-guile.
2017-11-26 13:10:46 +01:00
Jan Nieuwenhuizen
83f2a55c2c
mlibc: GNU Gcc support: ferror.
...
* lib/libc-mes+tcc.c (ferror): New function.
* include/stdio.h (ferror): Declare it.
2017-11-25 22:57:18 +01:00
Jan Nieuwenhuizen
7ab279bf7b
bootstrap: Add bootstrap build scripts.
...
* build.sh: New file.
* check-mescc.sh: New file.
* check.sh: New file.
* install.sh: New File.
2017-11-24 19:02:58 +01:00
Jan Nieuwenhuizen
c8613299a8
remove obsolete Nyacc link.
...
* guile/nyacc: Remove.
2017-11-23 19:49:12 +01:00
Jan Nieuwenhuizen
0fa18b338d
build: mlib/include to include, move mlib to lib.
...
* include: Move from mlib/include.
* lib: Move from mlib.
* BOOTSTRAP: Update.
* HACKING: Update.
* guile/guix/make.scm: Update.
* make.scm: Update.
* module/language/c99/compiler.mes: Update.
2017-11-22 16:23:48 +01:00
Jan Nieuwenhuizen
1762efc4b9
mes: Resurrect running mes tests tests/*.test with Guile.
...
* tests/tests/base.test-guile: New file to resurrect running Mes test with Guile.
* tests/catch.test-guile: Symlink for same purpose.
* tests/closure.test-guile: Likewise.
* tests/cwv.test-guile: Likewise.
* tests/display.test-guile: Likewise.
* tests/fluids.test-guile: Likewise.
* tests/guile.test-guile: Likewise.
* tests/let-syntax.test-guile: Likewise.
* tests/let.test-guile: Likewise.
* tests/match.test-guile: Likewise.
* tests/math.test-guile: Likewise.
* tests/module.test-guile: Likewise.
* tests/optargs.test-guile: Likewise.
* tests/peg.test-guile: Likewise.
* tests/pmatch.test-guile: Likewise.
* tests/psyntax.test-guile: Likewise.
* tests/quasiquote.test-guile: Likewise.
* tests/read.test-guile: Likewise.
* tests/record.test-guile: Likewise.
* tests/scm.test-guile: Likewise.
* tests/srfi-1.test-guile: Likewise.
* tests/srfi-13.test-guile: Likewise.
* tests/srfi-14.test-guile: Likewise.
* tests/vector.test-guile: Likewise.
* make.scm (add-guile-test): New function. Use it to run running tests/*.test-guile.
2017-11-21 19:13:14 +01:00
Jan Nieuwenhuizen
7fb74feb46
mes: resurrect running MesCC: handle \t in strings.
...
* module/mes/read-0.mes (reader:read-string): Handle \t. Fixex M1 output.
2017-11-20 23:22:53 +01:00
Jan Nieuwenhuizen
e81cb61b87
mes: Nyacc support: with-fluids.
...
* module/mes/fluids.mes (with-fluids): New macro.
* tests/fluids.test ("with-fluids"): Test it.
2017-11-20 23:21:25 +01:00
Jan Nieuwenhuizen
448b167c09
mes: resurrect running MesCC: update info interface.
...
* module/language/c99/info.mes (type?, global?, local?): New function.
(make-global): Remove name parameter.
* module/nyacc/lang/c99/pprint.mes: New file.
2017-11-20 23:17:50 +01:00
Jan Nieuwenhuizen
761ea8b23f
mes: Add last.
...
* module/srfi/srfi-1.mes (last): New funcion.
2017-12-17 13:32:17 +01:00