|Re: Executing code without generating stack machine c ode firstname.lastname@example.org (Himanshu Garg) (2005-04-28)|
|Re: Executing code without generating stack machine c ode email@example.com (Tom Verbeure) (2005-04-30)|
|From:||Himanshu Garg <firstname.lastname@example.org>|
|Date:||28 Apr 2005 14:52:19 -0400|
|Posted-Date:||28 Apr 2005 14:52:19 EDT|
Thanks for your replies John and Gaurav,
On 4/27/05, Gaurav Gautam, Noida <email@example.com> wrote:
> Yes, u are right , we can always execute code from parse tree skipping the
> IG and directly generating assembly code.
Actually I don't even want to generate assembly code to be executed by
the processor. I want to get the output of the program
i) either by walking its AST
ii) or by generating stack machine code and executing it.
> I ur case, the programs like calculator this can be done fairly easily, as
> many things are handled by the HLL in which u are writing this program. For
> exapmle in C ur task reduces to identifying only tokens and rules..and
> actual addition can be left on c (or the underlying compiler on which u are
> attepting to write a calculator).
> However when the program gets tougher..this may pose problems..
> Also skipping IG make the compiler less portable and less optimised.
I am using c/lex/yacc. What is the recommended way of doing it. I just
found some fairly descriptive way of doing it using the stack machine
in the chapter on Run Time Environments of The Dragon Book. I am
afraid I don't know how to walk the AST and execute loops, procedures,
if/then/else and goto's.
Return to the
Search the comp.compilers archives again.