Related articles |
---|
Tiger's ESEQ bsingharora@gmail.com (2005-06-30) |
Re: Tiger's ESEQ torbenm@diku.dk (2005-07-02) |
Re: Tiger's ESEQ kenrose@tfb.com (Ken Rose) (2005-07-02) |
From: | torbenm@diku.dk (=?iso-8859-1?q?Torben_=C6gidius_Mogensen?=) |
Newsgroups: | comp.compilers |
Date: | 2 Jul 2005 20:23:00 -0400 |
Organization: | Department of Computer Science, University of Copenhagen |
References: | 05-06-136 |
Keywords: | books, code |
Posted-Date: | 02 Jul 2005 20:23:00 EDT |
bsingharora@gmail.com writes:
> I have been reading Andrew Appel's Modern Compiler Design in "C".
>
> I am afraid I do not understand the ESEQ completely.
>
> I have been looking at other literature like the Dragon book,
> Engineering a compiler, and many more. I have not found the usage of
> ESEQ kind of instructions anywhere in them. I understand the
> ide-effect part, but how do we know for sure that some instruction will
> have a side-effect. How do you define a side-effect?
Think of ESEQ as C's comma operator, as in (x=17, x+y), where the fist
part is a statement that has a side effect and the second part is an
expression that gets evaluated.
The first version of Appel's intermediate language (in Ch. 7)
distinguishes expressions and statements only by expressions having a
result and statements not, but both can have side effects. Statements
can just be expressions, in which case the result is discarded (using
the EXP operator). Expressions can contain statements that are
executed for their side effect, but since expressions must have a
result, you need to specify one such. Hence, ESEQ has both a
statement (side effect only) and an expression (result, potentially
with a side effect) as parameters.
In Ch. 8, Appel wants to have "pure" expressions without side effects,
so he transforms each intermediate expression into an ESEQ of a
statement that does all the side effects of the original impure
expression and a pure expression that returns the result of the
original expression. Side effects are here defined as jumps, labels,
assignments and memory stores.
Torben
Return to the
comp.compilers page.
Search the
comp.compilers archives again.