2 ms·
It's nice to see that people are interested in this stuff, but it's disappointing to see that both of the top-level comments are attacking me for bothering to p
by kragen 16y ago
It's nice to see that people are interested in this stuff, but it's disappointing to see that both of the top-level comments are attacking me for bothering to point out that cons structures are not as good a way to represent code as some other approaches. I knew this piece was kind of disorganized, but I didn't realize it was that bad.
So I'll try to summarize here, a bit.
Question: How compact can you make a full-featured interactive programming environment? And what techniques would you use to do so?
Methods: Quantitative comparison of some sample code written for 17 different virtual machines, quantitative analysis of the code in a Squeak image to see what operations need to be most compact, and an implementation of a simple dictionary.
Tentative answer: A stack-based bytecode with local variables and special bytecodes for common operations, like Squeak's, provides the best density for high-level code. Polymorphic method dispatch improves code density. You can implement the virtual machine for the Squeak-style bytecode more compactly in Forth-style threaded code than directly in machine code. So you should be able to get an entire working interactive interpreter for a flexible, convenient language into 2000 to 6000 bytes.
Does that help?
I'm sorry my logic appeared to be so "lame", but I think the fault is more in the comprehensibility of the article than in its logic.