Commit Graph

14 Commits

Author SHA1 Message Date
Kamil Shakirov
cce312bb15 Check for EOF when reading from an input port
1) Check for EOF when reading from an input port (Chez backend).

2) Fix `getLine` to read and return a string without the trailing newline.
2020-04-24 12:32:58 +06:00
Matus Tejiscak
41ef3fdd2a Don't use exact-floor in cast-string-int. 2020-04-14 22:44:32 +02:00
Matus Tejiscak
c3b6b130fd Also fix up cast-string-int. 2020-04-14 22:44:32 +02:00
Matus Tejiscak
7a3ebd9a2f Use exact-floor. 2020-04-14 22:44:32 +02:00
Matus Tejiscak
18962eeacf Fix casting in integral division. 2020-04-14 22:44:32 +02:00
Matus Tejiscak
cf177f95a4 Fix conversion from Double to integral types. 2020-04-14 22:44:32 +02:00
Matus Tejiscak
16e027218b Use cond and equal? in destroy-prefix. 2020-03-29 22:26:42 +02:00
Matus Tejiscak
2cadbd2cd1 Fix runtime error in (the Int (cast "")). 2020-03-29 20:33:46 +02:00
Kamil Shakirov
c8c0c5fb49 Add getChar, putChar and putCharLn to prelude 2020-03-05 14:55:20 +06:00
Edwin Brady
e69c1529d9 Bitwise operators 2020-01-31 16:25:19 +00:00
Edwin Brady
bb246a072a Experimenting with a new FFI
Functions can be declared as %foreign with a list of calling
conventions, which a backend will work through until it finds one it can
understand. Currently implemented only in Chez backend. If this works
out, I'll implement it for Racket too, and remove the old primitive
functions.

There's a bit more boiler plate here than before, but it has the benefit
of being more extensible and portable between different back ends.

Some examples, pending proper documentation:

%foreign "C:puts,libc" "scheme:display"
putline : String -> PrimIO ()

%foreign "C:exp, libm.so.6, math.h"
fexp : Double -> Double

%foreign "C:initscr, ncurses_glue.so, ncurses.h"
prim_initscr : PrimIO ()
2019-09-02 17:10:48 +01:00
Edwin Brady
2bb496f74b Chapter 11 examples now working 2019-07-08 23:46:20 +02:00
Edwin Brady
4ab543b83d A bit more library support, for Chapter 9
Also a tweak to errors when compiling to scheme, so that it properly
reports an error then quits if it's supposed to crash.
2019-07-05 17:24:15 +01:00
Edwin Brady
0fa61f7c4f Add compiler support files 2019-06-02 17:31:59 +01:00