Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A REPL #138

Merged
merged 31 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
02a5cf8
initial work on repl
melsman Oct 12, 2023
5bea724
progress
melsman Oct 19, 2023
8737db9
fix
melsman Oct 19, 2023
e2f7022
parse end fixes
melsman Oct 19, 2023
a31a169
support for commands
melsman Oct 20, 2023
8cf0229
menu support and support for flags with arguments
melsman Oct 20, 2023
7941493
mlb-file loading
melsman Oct 22, 2023
d19c888
fix
melsman Oct 22, 2023
4bc3e01
:load help
melsman Oct 23, 2023
727147e
position independet code and Repl inclusion
melsman Oct 23, 2023
02d1ee1
repl testing
melsman Oct 23, 2023
95ba1b5
fix
melsman Oct 23, 2023
e7c3d35
new fix
melsman Oct 23, 2023
2c7db9a
cleanup
melsman Oct 24, 2023
82c13f5
fix
melsman Oct 24, 2023
c968bf0
fix
melsman Oct 24, 2023
88eb1e1
avoid LD_LIBRARY_PATH on Linux
melsman Oct 24, 2023
9551f2c
adding types to global labels to avoid linker warnings
melsman Oct 24, 2023
2b64d37
fix repl linker issue on linux by adding rpath
melsman Oct 24, 2023
0d7a324
fix pretty-printing of negative nans on Linux
melsman Oct 25, 2023
6881c73
repl pretty-printing first go
melsman Oct 30, 2023
58a107c
some fixes
melsman Oct 30, 2023
ea8b5fd
fix
melsman Oct 30, 2023
bfb780b
bug fix
melsman Oct 30, 2023
cddad62
debug
melsman Oct 30, 2023
33cea95
fix Control-d (eof) problem and other cleanup
melsman Oct 31, 2023
ffd9f32
robust type printing for REPL type-indexed pretty-printing
melsman Nov 1, 2023
a63cfcc
no-pretty fix
melsman Nov 1, 2023
5a4622f
buffer resizing
melsman Nov 1, 2023
bf19e91
support for control of printing depth and string printing cutoff
melsman Nov 1, 2023
261b6fd
support for multiple concurrent REPL sessions
melsman Nov 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
make -C test test_mlkit
make -C test test_mlkit_no_gc
make -C test/explicit_regions all
make -C test/repl all
make -C test/parallelism all

- name: Configure SmlToJs
Expand Down
14 changes: 11 additions & 3 deletions basis/Real.sml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ structure Real : REAL =

fun (x:real) / (y:real) : real = prim ("divFloat", (x, y))
fun rem (x:real, y:real) : real = prim ("remFloat", (x, y))
fun to_string_gen (s : string) (x : real) : string =
prim ("generalStringOfFloat", (s,x))
fun toString (x:real) : string = prim ("stringOfFloat", x)

local
fun repair_negnan (s:string) : string =
if s = "~nan" then "nan" else s
in
fun to_string_gen (s : string) (x : real) : string =
repair_negnan (prim ("generalStringOfFloat", (s,x)))
fun toString (x:real) : string =
repair_negnan (prim ("stringOfFloat", x))
end

fun sub_unsafe (s:string, i:int) : char = prim ("__bytetable_sub", (s,i))
fun isNan (x:real) : bool = prim ("isnanFloat", x)

Expand Down
2 changes: 1 addition & 1 deletion basis/basis.mlb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ local

basis Word =
let open General String IntInfRep
basis W = bas WORD.sig Word.sml Word64.sml Word63.sml Word32.sml Word31.sml Word8.sml
basis W = bas WORD.sig Word.sml Word64.sml (*Word63.sml*) Word32.sml Word31.sml Word8.sml
ann safeLinkTimeElimination
in local WordN.sml
in Word16.sml
Expand Down
14 changes: 9 additions & 5 deletions basis/io/text-io.sig
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,15 @@ necessary until one of these conditions holds. (This is the behaviour
of the `input' function prescribed in the 1990 Definition of Standard
ML).

[inputLine istr] returns one line of text, including the terminating
newline character. If end of stream is reached before a newline
character, then the remaining part of the stream is returned, with a
newline character added. If istr is at end of stream or is closed,
then the empty string "" is returned.
[inputLine istr] returns SOME(ln), where ln is the next line of input
in the stream strm. Specifically, ln returns all characters from the
current position up to and including the next newline (#"\n")
character. If it detects an end-of-stream before the next newline, it
returns the characters read appended with a newline. Thus, ln is
guaranteed to always be new-line terminated (and thus nonempty). If
the current stream position is the end-of-stream, then it returns
NONE. It raises Size if the length of the line exceeds the length of
the longest string.

[endOfStream istr] returns false if any elements are available in
istr; returns true if istr is at end of stream or closed; blocks if
Expand Down
2 changes: 2 additions & 0 deletions basis/repl.mlb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
basis.mlb
repl.sml
Loading
Loading