home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / compiler / 1398 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  1.4 KB

  1. Path: sparky!uunet!wupost!uwm.edu!rutgers!faatcrl!iecc!compilers-sender
  2. From: markh@csd4.csd.uwm.edu (Hunk)
  3. Newsgroups: comp.compilers
  4. Subject: Re: constant folding at parse time
  5. Keywords: parse, attribute
  6. Message-ID: <92-08-097@comp.compilers>
  7. Date: 17 Aug 92 17:28:49 GMT
  8. References: <92-08-040@comp.compilers> <92-08-091@comp.compilers>
  9. Sender: compilers-sender@iecc.cambridge.ma.us
  10. Reply-To: markh@csd4.csd.uwm.edu (Hunk)
  11. Organization: Computing Services Division, University of Wisconsin - Milwaukee
  12. Lines: 16
  13. Approved: compilers@iecc.cambridge.ma.us
  14.  
  15. wjw@eb.ele.tue.nl (Willem Jan Withagen) writes:
  16. >Well just a little nit pick here. I do not consider this part of a
  17. >parser. Determining wether an expression is constant or not is part of
  18. >constant folding, which is usually not done while parsing. But the
  19. >taken approach could be made to work.
  20.  
  21. A expression evaluation routine I wrote for an expression parser in a
  22. recently released assembler (C-expression syntax is handled) is set up in
  23. such a way that all constant subexpressions will be reduced to leaf nodes
  24. during parsing.  The question about whether a given expression is constant
  25. or not doesn't even arise because it's already been handled by the parser.
  26. Basically, if the expression tree returned by the parser is a leaf node
  27. then it's a constant, otherwise it's not.
  28. -- 
  29. Send compilers articles to compilers@iecc.cambridge.ma.us or
  30. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  31.