4 ms·
I was (pleasantly) surprised to find out Fossil used a Tcl-like language for templating. Tiny Tcl implementations are fun in general and perhaps easier to pro
by networked 10y ago
I was (pleasantly) surprised to find out Fossil used a Tcl-like language for templating.
Tiny Tcl implementations are fun in general and perhaps easier to produce than tiny Scheme implementations — as long as you are willing to concede that everything really is a string. :-) (I.e., no caching binary representations; you have to parse from scratch each time.) In a similar vein as TH1 but with a little more functionality there are Picol (https://tcl.wiki/Picol https://tcl.wiki/Picol) and LIL (http://runtimeterror.com/tech/lil/ http://runtimeterror.com/tech/lil/).
Disclosure: I maintain an expanded fork of Picol. The original version of it written by antirez was only ~550 LOC but with suchenwi's additions and mine it is now around 3100. There is a link to it on the wiki page. The change that I am most fond of is making it an stb-style (https://github.com/nothings/stb/ https://github.com/nothings/stb/) header library.
- kevin_thibedeau 10y agoYou don't have to treat everything as a string. I've written a Tcl interpreter in VHDL and it avoids the traditional pre 8.0 string interpretation. It parses everything into an AST and interprets that instead. This saves on the overhead of string processing mostly static code inside another interpreter that isn't optimal for such tasks.
- networked 10y ago>You don't have to treat everything as a string. Oh, I agree with you on that. My point was that Tcl makes it especially easy to "cheat" and avoid building an AST. You may do this when you only care about writing an interpreter in few LOC, like the original version of Picol, quickly. A Tcl interpreter in VHDL sounds interesting. Do you have a public repository for it?
- kevin_thibedeau 10y agoI have it up on Github. It's 90% complete waiting for me to get some free time. http://kevinpt.github.io/vertcl/ http://kevinpt.github.io/vertcl/