6 ms·
Implement Tcl in Tcl (2007)
- zerr 9y agoPerl 6 (Rakudo, the main implementation) is implemented in its subset - NQP (Not Quite Perl).
- stevefan1999 9y agoA Tcl in Tcl. A Tcl-ception. Is this is also a kind of compiler bootstrapping?
- tyingq 9y agoInterpreter bootstrapping, but probably with no clear motive. This appears to be just for fun, since it would be such a slow beast.
- theoh 9y agoThe word is "metacircular". It's easy in some languages, difficult in others. I never learned Tcl properly but found the rules for quoting and evaluation of program strings to be a confusing aspect. That was 20 years ago, and I thought the language was effectively dead ten years ago.
- isostatic 9y agoIndeed, but this is the third time I've seen a Tcl reference in as many days. Is someone trying to make it come back?
- throwaway7645 9y agoI've seen it pop up a fair amount recently as well and a new book is out that looked quite extensive (Ashok might be the author).
- blacksqr 9y agoTcl never went away. It's everywhere. It's like Clara Oswald, the impossible girl, always behind the scenes giving crucial aid without drawing attention.
- isostatic 9y agoBah, now I have to hate it
- orbifold 9y agoIt is very much alive and kicking in the EDA industry, all the tools use it as their command language.
- dgsb 9y agoReally ? I've found it to be the simplest language ever. It is just defined with 12 rules and that's all. I miss that lovely animal.
- auntienomen 9y agoWhy stop there? Implement Tcl in Tcl in Tcl.
- unkown-unknowns 9y agoIf you've implemented it in itself once then you've also implemented it in itself an infinite amount of times I think. You run your interpreter in the official interpreter, then you run your interpreter in that, in that, in that, in that, ...
- colejohnson66 9y agoInterpreters all the way down? ;)
- pattisapu 9y ago"Yo dawg, I heard you like Tcl..."
- antirez 9y agoClicked on the link to check what it was about, and discovered the implementation was mine. Did not remember at all this stuff.
- teh_klev 9y agoI have vaguely similar experiences when hitting up a google search result on Stack Overflow only to discover the answer/solution I'm looking at is one I wrote years ago.
- jwr 9y agoI can relate to this. I once started searching for an I2C driver for a Kinetis microcontroller, only to have Spotlight find one sitting on my hard drive. I had written one and forgot all about it. This is when I decided to post any reasonably-complete code on GitHub: so that I can easily find it later on.
- zeveb 9y agoOut of curiosity, how come Redis uses Lua instead of TCL? They're both neat, small, fast little languages, and they're both based around a powerful primitive used everywhere (tables in Lua, strings in TCL). I think TCL is a bit more elegant, while Lua is a bit more familiar.
- antirez 9y agoTo maximize familiarity indeed. Lua is more algol like. Moreover while the Tcl implementation is small is nowhere near the ANSI C target of Lua that compiles even into a toaster.
- asperous 9y agoIf anyone is interested in this and haven't heard about it already there's also Python implemented in Python: https://pypy.org/ https://pypy.org/
- coliveira 9y agoFor anyone who learned Prolog, implementing Prolog in Prolog is a classic exercise in the language which can be one in a dozen lines. The goal is to be able to modify the language to handle additional syntax that is problem-specific (think about a macro system that can implement in its own syntax).
- fusiongyro 9y agoEven aside from changing the syntax, you often have to do this to modify the resolution strategy, such as using breadth-first instead of depth-first search, or add probabilistic or fuzzy logic. A lot of papers on Prolog from the 80s start with "what would it be like to use logic-X from Prolog?" You can do a lot of interesting deep cuts like this without a huge amount of work. Prolog even has a built-in context-free parser that works the same way: definite clause grammars.
- fithisux 9y agoPersonally, I would like to see a lisp replicating tcl functionality, in other words an alternative surface syntax that could reuse existing pure tcl libraries or at least be able to transpile them to this lisp.
- mmahemoff 9y agoWikipedia has a long list of languages which have been bootstrapped, including BASIC, C, Python, Perl, Java, Rust. https://en.wikipedia.org/wiki/Bootstrapping_(compilers) https://en.wikipedia.org/wiki/Bootstrapping_(compilers)