Related articles |
---|
Re: Executing code without generating stack machine c ode himanshu.garg@gmail.com (Himanshu Garg) (2005-04-28) |
Re: Executing code without generating stack machine c ode hombre@gmail.com (Tom Verbeure) (2005-04-30) |
From: | Himanshu Garg <himanshu.garg@gmail.com> |
Newsgroups: | comp.compilers |
Date: | 28 Apr 2005 14:52:19 -0400 |
Organization: | Compilers Central |
References: | <267988DEACEC5A4D86D5FCD780313FBB079181D6@exch-03.noida.hcl tech.com> |
Keywords: | architecture |
Posted-Date: | 28 Apr 2005 14:52:19 EDT |
Thanks for your replies John and Gaurav,
On 4/27/05, Gaurav Gautam, Noida <gauravga@noida.hcltech.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.
Thank You,
Himanshu.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.