Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!aplcen!haven!udel!new From: new@udel.edu (Darren New) Newsgroups: comp.lang.smalltalk Subject: Re: How does the Smalltalk compiler work? Message-ID: <7677@nigel.udel.EDU> Date: 8 Jan 90 19:20:31 GMT References: <1340@mit-amt.MEDIA.MIT.EDU> <5478@netcom.UUCP> Sender: usenet@udel.EDU Reply-To: new@udel.edu (Darren New) Organization: University of Delaware Lines: 35 In article <5478@netcom.UUCP> schang@netcom.UUCP (Sehyo Chang) writes: >In article <1340@mit-amt.MEDIA.MIT.EDU> adamk@media-lab.media.mit.edu.UUCP (Adam Kao) writes: >For example, expression 'x > 1 ifTrue: [exp1] ifFalse: [exp2]' are normal >smalltalk expression with no control structure. Both 'ifTrue' and 'ifFalse' >methods are in implemented in 'Boolean' class, but differently in 'True' >and 'False' class. For reference, read 1981 Byte articles on smalltalk. True up to a point, but then did you ever look at the whileTrue: message works? In actuallity, the compiler (at least the original ST-80 compiler) had special-case code for ifTrue:, whileTrue:, et al, and generated inline jump instructions (primarily for efficiency). Otherwise, such common stuff would be difficult to do efficiently and while-loops would require recursive implementation, quickly running you out of stack space. >>Basically I just need to know how the Smalltalk compiler is similar to >>(for example) an ordinary C compiler, and how it is different. I also >It is not matter of difference in compliler, it is matter of difference >between compiler(source-host machine) to interpreter(source-VM bytecodes), All the Smalltalk compilers I have studied the internals of use recursive-descent parsing; this topic should be findable in any reasonable compiler book. No tables are used -- basically the program-counter encodes the major state of the parsing. >... There are two cheap ways to do it. (1) Get "little Smalltalk >", or (2) Smalltalk/V from Digitalk. But if you have some money, get a >ParcPlace's Smalltalk, they are more true to the original smalltalk-80. Actually, Smalltalk-80 is only about $200 for Macs and IBMclones and about $400 for Suns if you can get the educational discount; e.g., if your school buys it. I think it is well worth it, myself, and their support is super. Don't quote me on prices. Send mail to info@parcplace.com or info@parcplace.uucp. LossaLuck -- Darren