udem-dlteam / pnut

🥜 A Self-Compiling C Transpiler Targeting Human-Readable POSIX Shell
https://pnut.sh
BSD 2-Clause "Simplified" License
401 stars 12 forks source link

R4RS repl for pnut, compiled with Ribbit #54

Closed leo-ard closed 3 months ago

leo-ard commented 3 months ago

Not working at the moment. Still needs some ajustements.

The repl is inside examples/repl.c. To compile and run it with gcc, you can do :

$ gcc examples/repl.c -o repl.exe
$ ./repl.exe
> (define x (open-output-file "my-file"))
0
> (write "Hello world pnut !" x)
#t
> ^D
$ cat my-file
"Hello world pnut !"
leo-ard commented 3 months ago

@feeley @laurenthuberdeau I finally managed to compile the RVM woohoo ! If you want to try it out, you can use the current file examples/repl.c, it should work with the current version of pnut compiled with : gcc -Dsh -DSUPPORT_INCLUDE -UOPTIMIZE_CONSTANT_PARAM pnut.c -o pnut-sh.exe. I also included the compiled repl into examples/repl.sh

However... the repl seems to be extremely slow. In the linked video, I added a print each time we loop inside of unpack_escape_string and it takes a few seconds.

https://github.com/user-attachments/assets/71357e81-acf6-44c7-8bd2-b120003b8054