Commit graph

85 commits

Author SHA1 Message Date
Alex Shinn
29dd1a3b81 Add more specific warning for error on no import, clarify docs. 2024-01-30 12:31:06 +09:00
Alex Shinn
da53f46c93 Merge branch 'master' of github.com:ashinn/chibi-scheme 2022-12-04 23:32:54 +09:00
Alex Shinn
cadae49fec Fix sexp_contains_syntax_p_bound for synclos in dotted rest position.
Closes #464.
2022-12-04 23:31:25 +09:00
Alex Shinn
8653dddeb3
Merge pull request #856 from dpapavas/static-user-libs
Add support for exporting statically compiled libraries from C
2022-10-31 18:54:40 +09:00
Dimitris Papavasiliou
310a04f701 Add support for user exported C libraries
This uses the existing mechanism for statically compiled C libraries,
to allow the user to export their own C libraries in a similar way.
User exported libraries can be added on top of statically compiled C
libraries or exist on their own (by setting SEXP_USE_STATIC_LIBS_EMPTY).
2022-10-30 14:06:18 +02:00
Alex Shinn
d67fa42d0c
Merge pull request #793 from dpk/string-ref-cache
Add a feature to cache the most recent string index->cursor result
2022-10-19 17:59:08 +09:00
Alex Shinn
0eeeac7650 Make environment immutable and add mutable-environment alternative (issue #863). 2022-10-04 16:07:36 +09:00
Alex Shinn
95827a44ed Add immutable-string with copy-on-write semantics (issue #860). 2022-09-16 18:18:20 +09:00
Alex Shinn
0a50b305bc string-set! should respect immutability (issue #857) 2022-09-04 16:28:04 +09:00
Alex Shinn
35eed62160 the top-level of a macro expansion should preserve the call site source (issue #835) 2022-06-03 13:36:56 +09:00
Daphne Preston-Kendal
7a4e793e49 Move make-variable-transformer to (chibi ast) 2022-03-15 09:25:21 +01:00
Daphne Preston-Kendal
eb8582f5b1 Use sexp_make_procedure to sexp_make_variable_transformer_op 2022-01-03 08:28:40 +01:00
Daphne Preston-Kendal
f63348a4d1 Iteratively expand variable-transformer set! 2022-01-02 08:06:38 +01:00
Daphne Preston-Kendal
d17764be29 Add variable transformers 2021-12-30 10:34:54 +01:00
Daphne Preston-Kendal
770b4d367b Add basic support for identifier macros 2021-12-29 23:52:46 +01:00
Alex Shinn
fc9cf93796 type checks on identifier=? 2021-12-28 08:19:05 +09:00
Daphne Preston-Kendal
c09897c449 Add a feature to cache the most recent string index->cursor result
This is lighter-weight than building a full index->cursor table for
the string, adding a constant two words to the memory required to
store a string, as opposed to one word for every n characters. The
cached cursor is used for any string-ref operation requesting an index
after the most-recently-requested index, making potentially quadratic
repeated string-ref procedures run in linear time. In theory, it could
also use a heuristic to speed up moving backwards through the string
when it thinks that moving the old cursor backwards would be faster
than starting again at the start of the string. In practice, my
logging of when the cached cursor is actually reused during the Chibi
compilation and startup process shows that the most common case of
moving backwards is going back to the start of the string anyway.

Benchmarks to follow.
2021-12-10 21:24:05 +01:00
Alex Shinn
3080087d8c stop after first compile error in an if (fixes #792) 2021-12-05 09:18:54 +09:00
Alex Shinn
182048ed9a adjust for rounding up converting from fixnum to double in exact-integer-sqrt (fixes #786) 2021-11-08 09:27:50 +09:00
Alex Shinn
6cafda8916 Decouple syntax-case from the Chibi core.
This restores third-party (ab)users of the Chibi macro system such
as in https://gist.github.com/baguette/2632464, while allowing us
to break those uses in more interesting ways.

It also keeps the core slightly smaller (both in C and Scheme)
and speeds up the macro expansion process.
2021-08-10 23:19:35 +09:00
Alex Shinn
24fb7585c7 set! should guard against exceptions in the var ref lookup (fixes issue #762) 2021-07-22 21:43:50 +09:00
Alex Shinn
89a77540b4 put system module path in front of user module path 2021-05-10 23:24:18 +09:00
Alex Shinn
3cf62f033a store stack traces directly in top-level exceptions to more consistently be able to report them from C 2021-04-26 21:40:39 +09:00
Alex Shinn
b4dd757e3f more consistently setting renames (issue #453) 2020-12-28 11:55:10 +09:00
Alex Shinn
181b7fe7e4 preserve exactness in sqrt of ratios where possible 2020-11-19 13:13:37 +09:00
Alex Shinn
b89db31e37 typo in env-exports (issue #685) 2020-08-22 16:27:20 +09:00
Alex Shinn
ea370db4b4 fixing some cc warnings 2020-07-24 15:35:31 +09:00
Alex Shinn
983829cab1 better inexact computation for ratios which overflow double (issue #671) 2020-07-15 16:38:56 +09:00
Alex Shinn
3700cfaf91 forgot extern (issue #669) 2020-07-14 20:32:30 +09:00
Alex Shinn
e300659662 don't export sexp_primitive_opcodes (issue #669) 2020-07-14 10:08:21 +09:00
Alex Shinn
361dc48c62 don't verify duplicate formal parameters for more than 100 params 2020-04-19 19:20:01 +09:00
Alex Shinn
197894eb87 fix (expt fixnum flonum) by reverting ce9c60c1 2019-09-09 23:25:27 +08:00
Alex Shinn
0bfc31a1e5 check for too many args to if (issue #561) 2019-08-29 21:56:00 +08:00
Alex Shinn
104811942f fixing read-line on network ports 2019-05-04 13:18:27 +08:00
Alex Shinn
9569460a58 add compile-time option to store precomputed index->cursor tables for strings 2019-01-26 05:35:27 +08:00
Alex Shinn
2b4394ea74 adding initial support for SRFI 160 uniform vectors 2019-01-15 23:43:50 +08:00
Alex Shinn
2c37dfedd3
Merge pull request #500 from mnieper/syntax-case
Implement syntax-case
2018-12-09 04:08:31 +08:00
Alex Shinn
9af77c9b4f adding CHIBI_IGNORE_SYSTEM_PATH=1 env var (fixes issue #501) 2018-12-06 00:54:21 +08:00
Marc Nieper-Wisskirchen
152b20f244 Implement syntax-case 2018-12-01 13:48:25 +01:00
Bertrand Augereau
ce9c60c1e8 Fix (expt 3 -1) when SEXP_USE_BIGNUMS 2018-06-16 09:41:09 +02:00
Alex Shinn
ecbaa9939a require proof of the presence of synclos before stripping them with quote (issue #464) 2018-04-01 21:38:21 +09:00
Alex Shinn
060cfd550e
Merge pull request #465 from jimrees/master
changes from jim rees
2018-04-01 15:32:32 +09:00
Kris Katterjohn
439e35da61 Check for valid "rest" parameters in parameter lists
Checks for invalid parameter names and duplicate parameters were
being performed on parameter lists, but these checks were not
considering any rest parameters.  This means that

  ((lambda (x . x) x) 'foo 'bar)   =>  foo
  ((lambda (x . 0) x) 'foo 'bar)   =>  foo
  ((lambda (x . #t) x) 'foo 'bar)  =>  foo
  ((lambda 0 'foo))                =>  foo
  ((lambda #t 'foo))               =>  foo

and so on.  Now these all produce errors.
2018-03-28 21:11:33 -05:00
Jim Rees
b25e46b11b Introduced a second version of sexp_double_to_ratio, named
sexp_double_to_ratio_2, which converts without introducing
round-off errors the way sexp_double_to_ratio does when it
multiplies by 10.

Changed sexp_inexact_to_exact to use this new function when
a non-zero fractional part of the input exists.
2018-03-22 22:19:39 -04:00
okuoku
e092923aac Win32: Fix win32 port
Try to fix win32 port. Now it runs both on Win32/Win64.

Win64 port currently depends on 128bits arithmetic thus it does not run on
MSVC.

Makefile now have EXCLUDE_POSIX_LIBS knob to exclude posix related library
from build.

Introduce msys PLATFORM for Makefile.detect to use MSYS's POSIX
emulation layer. It is intended for linking against MSYS tools; it is
not for embedding to Win32 applications.
2017-11-11 04:31:06 +09:00
Alex Shinn
56a6a0b0b4 fixing asin/acos when complex numbers are disabled 2017-09-01 16:56:26 +09:00
Alex Shinn
17b7ee3f98 include dlerror if we can't find sexp_init_library 2017-08-26 23:05:33 +09:00
Alex Shinn
da410523b0 fixing peek-char on non-ascii chars 2017-06-26 22:23:38 +09:00
Alex Shinn
8feb1e761e alternate approach to handling renamed forward refs 2017-04-10 22:36:53 +09:00
Alex Shinn
1bd9fe437a don't retroactively resolve unbound renamed references with a renamed definition 2017-04-03 23:13:14 +09:00