home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!uwm.edu!rutgers!faatcrl!iecc!compilers-sender
- From: markh@csd4.csd.uwm.edu (Hunk)
- Newsgroups: comp.compilers
- Subject: Re: constant folding at parse time
- Keywords: parse, attribute
- Message-ID: <92-08-097@comp.compilers>
- Date: 17 Aug 92 17:28:49 GMT
- References: <92-08-040@comp.compilers> <92-08-091@comp.compilers>
- Sender: compilers-sender@iecc.cambridge.ma.us
- Reply-To: markh@csd4.csd.uwm.edu (Hunk)
- Organization: Computing Services Division, University of Wisconsin - Milwaukee
- Lines: 16
- Approved: compilers@iecc.cambridge.ma.us
-
- 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.
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-