|Re: Simple constant folding in bison parser email@example.com (1992-08-10)|
|constant folding at parse time firstname.lastname@example.org (1992-08-17)|
|Re: constant folding at parse time email@example.com (1992-08-17)|
|Re: constant folding at parse time firstname.lastname@example.org.EDU (Tim Pierce) (1992-08-19)|
|Re: constant folding at parse time email@example.com (1992-08-20)|
|Re: constant folding at parse time firstname.lastname@example.org (1992-08-21)|
|Re: constant folding at parse time email@example.com (1992-08-21)|
|Re: constant folding at parse time firstname.lastname@example.org (1992-08-24)|
|From:||email@example.com (Scott Amspoker)|
|Organization:||BASIS International, Ltd., Albuquerque NM USA|
|Date:||Thu, 20 Aug 1992 15:41:14 GMT|
firstname.lastname@example.org (Hunk) writes:
>A expression evaluation routine I wrote for an expression parser in a
>recently released assembler (C-expression syntax is handled) is set up in
>such a way that all constant subexpressions will be reduced to leaf nodes
>during parsing. The question about whether a given expression is constant
>or not doesn't even arise because it's already been handled by the parser.
>Basically, if the expression tree returned by the parser is a leaf node
>then it's a constant, otherwise it's not.
It all depends on what you call a constant. The address of a global
object is a constant and may be used in an initializer list:
char *cp = &c;
The address of c is a constant but cannot be folded by the compiler.
Because of this, we have had to use a flag in a parse tree node to
indicate the 'constant' status of the sub-expression.
Scott Amspoker, Basis International, Albuquerque, NM
[I've worked with compilers that considered a constant to be a numeric
offset plus an optional static symbol address. This can be very convenient
for generating addressing code. -John]
Return to the
Search the comp.compilers archives again.