Re-amalgamating and interpreting Janet (tcc-mob) #1127
CosmicToast
started this conversation in
Show and tell
Replies: 1 comment 4 replies
-
Looks neat! Locally I didn't quite get it to work due to header file issues:
Will try again when I'm more awake (^^; |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was wondering if Janet was sufficiently simple to be interpreted...
So I built a re-amalgamator to distribute janet shell as a single source file to be interpreted by tcc.
Instructions: download
janet.h
,janet.c
, andshell.c
.Place this script (e.g as build.sh) in the same directory and run it.
You get out an executable script named
janet
that you can place anywhere and run - it will be interpreted and ran on the fly.Caveat: no dynamic modules, though regular modules work just fine. Also you're limited to the "default"
/usr/local/lib
library location like this, unless you change the defines manually.The script:
It actually runs quite fast and can run some "real" scripts (again, as long as there are no native modules).
The startup time is essentially instant, my native optimized build runs
janet -e (quit)
in 9.12ms, while the tcc-interpreted one does the same in 95.39ms.I find it to be a rather good sign in general when a program written in C (let alone an entire language) can be built by something like tcc, let alone interpreted, so this was a fairly cool ~30m experiment.
Beta Was this translation helpful? Give feedback.
All reactions