[ENH] CCodeGenerator2

Stephan Rudlof sr at evolgo.de
Thu Dec 23 07:08:57 UTC 1999


Dear Andrew,

this is very neat and you are very _fast_, too (nearby christmas...).

It's interesting for me how readable constructs in Smalltak are leading
to tricky constructs in C: This shows that ST has good expressive power
for control structures in comparison with C!

Thank you!

....(see below)

"Andrew C. Greenberg" wrote:
> 
> This is the same changeset posted in an e-mail with a different title
> last night, but without the Y2K postscript.  (I'm going to have to
> stop working until the wee hours on this stuff).
> 
> "Change Set:            CCodeGenerator2
> Date:                   21 December 1999
> Author:                 Andrew C. Greenberg
> 
> Improves compilation of #whileTrue, #whileFalse, #whileTrue: and
> #whileFalse: builtins.  CCodeGenerator (and hence, the named
> primitive sompilers) now generate loops of the following forms, as
> appropriate:
> 
> SMALLTALK EXEMPLAR                      GENERATED CODE
> 
> [cond] whileTrue: [stmtList].           while(cond) do {stmtList}
> 
> [cond] whileFalse: [stmtList].          while(!(cond)) do {stmtList}
> 
> [stmtList. cond]                        do {stmtList} while(cond)
>         whileTrue.
> [stmtList. cond]
>         whileTrue: []
> 
> [stmtList. cond]                        do {stmtList} while(!(cond))
>         whileFalse.
> [stmtList. cond]
>         whileFalse: []
> 
> [stmtListA. cond]                       while(1) {
>         whileTrue: [stmtListB]                  stmtListA;
>                                                 if(!(cond)) break;
>                                                 stmtListB
>                                         }


Indeed this solution is better than the one before:

        exp1.
        while(condition) {
                exp2;
                exp3;
                exp1;
        }



> 
> [stmtListA. cond]                       while(1) {
>         whileFalse: [stmtListB]                 stmtListA;
>                                                 if(cond) break;
>                                                 stmtListB
>                                         }
> 
> "
> 
>                            Name: CCodeGenerator2.4.cs
>    CCodeGenerator2.4.cs    Type: unspecified type (application/octet-stream)
>                        Encoding: base64


Merry Christmas,

Stephan

-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3





More information about the Squeak-dev mailing list