Open idkjs opened 4 years ago
Thanks for trying this out!
The error indicates that the SML parser can't open its input file. My best guess is that the script needs to create two tempfiles (/tmp/smlformat.XXXXXX), and that is failing for some reason.
Try running
$ echo "fun foo x = 10" > test.sml
$ echo 'SmlFormat.formatToFile "test.sml" "test_output.sml";' | sml -m sources.cm > /dev/null
instead of smlformat
. The smlformat
script is just a small bash wrapper around that second command.
No joy.
~/Github/Programming-Languages-Part-A master
❯ echo "fun foo x = 10" > test.sml
~/Github/Programming-Languages-Part-A master*
❯ echo 'SmlFormat.formatToFile "test.sml" "test_output.sml";' | sml -m sources.cm > /dev/null
/usr/local/smlnj/bin/sml: Fatal error -- Uncaught exception Io with <unknown> raised at Basis/Implementation/IO/text-io-fn.sml:792.25-792.71
~/Github/Programming-Languages-Part-A master*
~/Github/Programming-Languages-Part-A master*
❯ ls | grep test_output.sml
~/Github/Programming-Languages-Part-A master*
❯ ls | grep README
README.md
~/Github/Programming-Languages-Part-A master*
❯ ls | grep test_output
~/Github/Programming-Languages-Part-A master*
❯~/Github/Programming-Languages-Part-A master*
❯ cat test.sml
fun foo x = 10
So looks like test.sml
gets created anyway.
It looks like it's not finding the sources.cm file that it needs to load. Where are you running the command from? If you replace sources.cm
in my initial suggestion SMLFORMAT_DIR/sources.cm
where SMLFORMAT_DIR
is wherever you cloned this repo, does it work?
I also just pushed a fix to a (maybe) separate macOS bug, so it might be worth pulling and trying again.
Thanks for sharing this!
I tried using it and got a
IO.Io: openIn at src/smlnj/Basis/IO/text-io.sml
error. Im on a mac and usingzsh
and Catalina, if that matters.Tried with both
zsh
andbash
.Any ideas?
Thank you, friend.