3 ms·
One system I work with exposes a CLI. The whole system is written in C, and the CLI is basically just a frontend for a bunch of commands that take in [int argc,
by AceJohnny2 7y ago
One system I work with exposes a CLI. The whole system is written in C, and the CLI is basically just a frontend for a bunch of commands that take in [int argc, char argv]. It is, to misquote Greenspun's tenth, an ad-hoc, informally-specified, bug-ridden, slow implementation of a proper REPL.
My secret wish is to replace it with an embedded TCL REPL. TCL isn't perfect, but it's pretty easy to interface with C, and it fits on small targets. My main problem (aside from lack of time) is that I'd actually need a tiny version that would fit within dozens of kilobytes of code. Closest I've found is Jim [1], which is 100-200kB (depending on features). Compare that with Lua, which fits under 100kB (though excluding its standard library).
[1] http://jim.tcl.tk/index.html/doc/www/www/index.html http://jim.tcl.tk/index.html/doc/www/www/index.html
- kbr2000 7y agoI might have some time this summer, feel free to contact and explain ;)
- AceJohnny2 7y agoI wish I could, but it's all for stupid-secret projects :(
- naasking 7y ago> One system I work with exposes a CLI. The whole system is written in C, and the CLI is basically just a frontend for a bunch of commands that take in [int argc, char argv]. It is, to misquote Greenspun's tenth, an ad-hoc, informally-specified, bug-ridden, slow implementation of a proper REPL. Sounds like a poor man's execline: https://skarnet.org/software/execline/ https://skarnet.org/software/execline/
- qznc 7y agoConsider these two simplified TCL derivatives: TH1 https://www.fossil-scm.org/xfer/doc/trunk/www/th1.md https://www.fossil-scm.org/xfer/doc/trunk/www/th1.md Picol http://oldblog.antirez.com/post/picol.html http://oldblog.antirez.com/post/picol.html