Compilation strategy

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Dec 18 08:54:11 PST 2012


On 12/18/12 10:01 AM, Walter Bright wrote:
> On 12/18/2012 1:43 AM, Dmitry Olshansky wrote:
>> Compared to doing computations on AST tries (and looking up every name
>> in symbol
>> table?), creating fake nodes when the result is computed etc?
>
> CTFE does not look up every (or any) name in the symbol table. I don't
> see any advantage to interpreting bytecode over interpreting ASTs. In
> fact, all the Java bytecode is is a serialized AST.

My understanding is that Java bytecode is somewhat lowered e.g. using a 
stack machine for arithmetic, jumps etc. which makes it more amenable to 
interpretation than what an AST walker would do. Also bytecode is more 
directly streamable because you don't need any pointer fixups.

In brief I agree there's an isomorphism between bytecode and AST 
representation, but there are a few differences that may be important to 
certain applications.


Andrei


More information about the Digitalmars-d mailing list