Re: Definable operators (was: Problems with Hardware, Languages, and Compilers)

malcolm@sedi8.nag.co.uk (Malcolm Cohen)
16 Mar 1997 23:34:24 -0500

          From comp.compilers

Related articles
Problems with Hardware, Languages, and Compilers hrubin@stat.purdue.edu (1997-03-07)
Definable operators (was: Problems with Hardware, Languages, and Compi rrogers@cs.washington.edu (1997-03-09)
Re: Definable operators (was: Problems with Hardware, Languages, and C sethml@ugcs.caltech.edu (1997-03-13)
Re: Definable operators (was: Problems with Hardware, Languages, and C rrogers@cs.washington.edu (1997-03-13)
Re: Definable operators (was: Problems with Hardware, Languages, and C creedy@mitretek.org (1997-03-14)
Re: Definable operators (was: Problems with Hardware, Languages, and C nmm1@cus.cam.ac.uk (1997-03-16)
Re: Definable operators (was: Problems with Hardware, Languages, and C andy@cs.Stanford.EDU (1997-03-16)
Re: Definable operators (was: Problems with Hardware, Languages, and C malcolm@sedi8.nag.co.uk (1997-03-16)
Re: Definable operators (was: Problems with Hardware, Languages, and C apardon@rc4.vub.ac.be (1997-03-18)
Re: Definable operators (was: Problems with Hardware, Languages, and C jenglish@crl.com (1997-03-18)
Re: Definable operators (was: Problems with Hardware, Languages, and C nmm1@cus.cam.ac.uk (1997-03-21)
| List of all articles for this month |

From: malcolm@sedi8.nag.co.uk (Malcolm Cohen)
Newsgroups: comp.compilers,comp.lang.misc,comp.arch.arithmetic
Date: 16 Mar 1997 23:34:24 -0500
Organization: The Numerical Algorithms Group Ltd., Oxford, U.K.
References: 97-03-037 97-03-051
Keywords: design

Richard Rogers <rrogers@cs.washington.edu> wrote:
>In fact, I might go as far as to say that
>
>(mnvs \oplus k1 \dot k2) \otimes ijq4
>
>is better code than
>
>frop (glort ( foo (mnvs, k1), k2), ijq4)
>
>if only because it's easier for humans to parse


You must be joking, not to mention biasing the question.


The bias: you should have used the same names for both, e.g.
    (mnvs \foo k1 \glort k2) \frop ijq4


And this human did not find it easier to parse the above, i.e. is that
    ((mnvs \foo k1) \glort k2) \frop ijq4
or
    (mnvs \foo (k1 \glort k2)) \frop ijq4


(Ok, more familiarity with TeX might have helped me here - I haven't a clue
what its precedence rules are).


> with a restricted set of operators, your're forced to chose
> something at least a little better than "frop."


Well sure, if you cannot invent new operators but only overload the
existing ones, it is not longer any harder to parse than before
(though understanding the semantics may have suffered).


But if you can invent new operator names
    (a) the language cannot force you to make those sensible
    (b) unless the precedence rules are *very* simple - e.g. one level and always
            left-to-right (like your example seems to imply) or always lowest
            precedence and left-to-right associative (like Fortran 90) - you have
            upped the ante on merely parsing the expression, and on code maintenance.


Cheers,
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
                                                      (malcolm@nag.co.uk)
--


Post a followup to this message

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