Re: Introducing new operators

moss@cs.umass.edu (Eliot Moss)
Wed, 23 Sep 1992 13:02:51 GMT

          From comp.compilers

Related articles
Introducing new operators kjell@cse.ucsc.edu (1992-09-22)
Re: Introducing new operators moss@cs.umass.edu (1992-09-23)
| List of all articles for this month |
Newsgroups: comp.compilers
From: moss@cs.umass.edu (Eliot Moss)
Organization: Dept of Comp and Info Sci, Univ of Mass (Amherst)
Date: Wed, 23 Sep 1992 13:02:51 GMT
References: 92-09-136
Keywords: parse, design, comment

You argue that introducing new operators with new syntax makes code more
readable. I suggest that it is more readable only to the original author,
and quite possibly less readable to others, unless you disallow changes to
precedence and associativity, since they can be so confusing. If you are
to allow new operators, I prefer an approach such as that taken in
Smalltalk, where there is a simple and easy to remember rule about the
precedence and associativity of operators. Another interesting example is
the Larch specification language, which allows new prefix, infix, and
postfix operators to be defined, yet has rules that bascially say that
anything very complicated must be parenthesized to make the intent clear
(sorry, I don't have the detailed rules in front of me).


I think dynamic parsing may well be a solution that creates more practical
problems than it solves. (Which doesn't mean I wouldn't read your paper to
understand how to do it if it ever seems wise.)
--


J. Eliot B. Moss, Associate Professor Visiting Associate Professor
Department of Computer Science School of Computer Science
Lederle Graduate Research Center Carnegie Mellon University
University of Massachusetts 5000 Forbes Avenue
Amherst, MA 01003 Pittsburgh, PA 15213-3891
(413) 545-4206, 545-1249 (fax) (412) 268-6767, 681-5739 (fax)
Moss@cs.umass.edu Moss@cs.cmu.edu
[I have to agree. IMP72 let you add your own syntax on the fly by embedding
BNF in the code. Programs that added much new syntax were completely
unreadable. -John]
--


Post a followup to this message

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