Newsgroups: comp.lang.python,comp.lang.tcl,comp.lang.scheme,comp.lang.misc,comp.lang.perl
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uchinews!news
From: Charles Fiterman <cef@geodesic.com>
Subject: Re: Comparing syntaxes  (Re: What language would you use?)
Message-ID: <1994Nov16.142946.29274@midway.uchicago.edu>
Sender: news@uchinews.uchicago.edu (News System)
Organization: Geodesic Systems
References: <39b7ha$j9v@zeno.nscf.org> <39umpu$k1b@larry.rice.edu> <1994Nov11.144913.7481@midway.uchicago.edu> <3ab2el$5ks@drax.isi.edu>
Date: Wed, 16 Nov 1994 14:29:46 GMT
Lines: 43
Xref: glinda.oz.cs.cmu.edu comp.lang.python:2671 comp.lang.tcl:21888 comp.lang.scheme:11313 comp.lang.misc:19164 comp.lang.perl:39058

In article <3ab2el$5ks@drax.isi.edu> rogers@drax.isi.edu (Craig Milo Rogers) writes:
>In article <1994Nov11.144913.7481@midway.uchicago.edu> Charles Fiterman <cef@geodesic.com> writes:
>>The problem with this is the binding strengths are numbers in
>>a range so slipping in new ones can be ugly. This seems to
>>be a poor encapsulation that I don't see how to get around.
>
>	This idea (operator strengths expressed as numbers) has been
>around for a long time.  I think first encountered it in the early
>'70s in "advanced" JOVIAL-based compilers.
>
>	The solution to the problem you pose is to name the operator
>precedence levels (remember, seperate levels for right and left sides)
>with labels, and have a table that sequences the precedence levels.
>Here's a simple example:
>
>precedence expr
>precedence expl
>precedence multl
>precedence multr
>precedence addl
>precedence addr
>opcode	"**",expl,expr
>opcode	"*",multl,multr
>opcode	"/",multl,multr
>opcode	"+",addl,addr
>opcode	"-",addl,addr
>
>	A macro (or runtime) preprocessor first assigns numbers to the
>precedence labels, then inserts the numbers in the operator table.
>Note that the exponentiation operator is right-to-left associative,
>while the others are left-to-right, by virtue of the order of their
>split precedence levels.  A more complete example would distinguish
>unary from binary operators.
>
>					Craig Milo Rogers
>
This assumes a single file that knows about all the definitions.
We are trying to distribute things. But you may have hit on the
real problem. We are trying to distribute knowledge that must
be kept in one place.



