Re: constant folding at parse time

markh@csd4.csd.uwm.edu (Hunk)
Mon, 17 Aug 1992 17:28:49 GMT

          From comp.compilers

Related articles
Re: Simple constant folding in bison parser drw@kronecker.mit.edu (1992-08-10)
constant folding at parse time wjw@eb.ele.tue.nl (1992-08-17)
Re: constant folding at parse time markh@csd4.csd.uwm.edu (1992-08-17)
Re: constant folding at parse time twpierce@amhux1.amherst.EDU (Tim Pierce) (1992-08-19)
Re: constant folding at parse time scott@bbx.basis.com (1992-08-20)
Re: constant folding at parse time wjw@eb.ele.tue.nl (1992-08-21)
Re: constant folding at parse time buehlman@iwf.mabp.ethz.ch (1992-08-21)
Re: constant folding at parse time drw@euclid.mit.edu (1992-08-24)
| List of all articles for this month |

Newsgroups: comp.compilers
From: markh@csd4.csd.uwm.edu (Hunk)
Organization: Computing Services Division, University of Wisconsin - Milwaukee
Date: Mon, 17 Aug 1992 17:28:49 GMT
References: 92-08-040 92-08-091
Keywords: parse, attribute

wjw@eb.ele.tue.nl (Willem Jan Withagen) writes:
>Well just a little nit pick here. I do not consider this part of a
>parser. Determining wether an expression is constant or not is part of
>constant folding, which is usually not done while parsing. But the
>taken approach could be made to work.


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.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.