Re: Grammars for future languages

jaidi@technet.sg (Nor Jaidi)
Thu, 9 Nov 1995 06:32:37 GMT

          From comp.compilers

Related articles
Grammars for future languages schinz@guano.alphanet.ch (1995-10-22)
Re: Grammars for future languages torbenm@diku.dk (1995-10-24)
Re: Grammars for future languages mfinney@inmind.com (1995-10-24)
Re: Grammars for future languages RWARD@math.otago.ac.nz (Roy Ward) (1995-10-26)
Re: Grammars for future languages wdavis@dw3f.ess.harris.com (1995-10-26)
Re: Grammars for future languages timd@Starbase.NeoSoft.COM (1995-10-30)
Re: Grammars for future languages jaidi@technet.sg (1995-11-09)
Re: Grammars for future languages martelli@cadlab.it (1995-11-04)
Re: Grammars for future languages schinz@guano.alphanet.ch (1995-11-05)
Re: Grammars for future languages ECE@dwaf-hri.pwv.gov.za (John Carter) (1995-11-07)
Re: Grammars for future languages mbbad@s-crim1.daresbury.ac.uk (1995-11-08)
Re: Grammars for future languages szilagyi@szilagyi.mit.edu (1995-11-09)
Re: Grammars for future languages davids@ICSI.Berkeley.EDU (1995-11-10)
[7 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: jaidi@technet.sg (Nor Jaidi)
Keywords: parse, design
Organization: Compilers Central
References: 95-10-103 95-10-140
Date: Thu, 9 Nov 1995 06:32:37 GMT

>what I have done with ReWrite to maintain _some_ consistency of notation,
>is that I have defined operation such as plus, not, etc. and effectively
>defined the infix forms as being equivalent to the prefix ones, so
>
>a+b is _exactly_ equivalent to plus[a,b]
>!a is _exactly_ equivalent to not[a],
>


Mathematica does this too. Mathematica language is very consistent in its
syntax. But it also has syntactic sugaring to make arithmetic expression
more 'natural'. It even has 'no-fix' notation for multiplcation. Thus
x y is _exactly_ equivalent to Times[x, y].
That looks okay.


Prolog (whose inferencing capability I would vote for inclusion in the
languages of the future) allows programmer to define infix and prefix
operators together with their precedence. With this feature, I can define
clauses/ ask queries like:
      list attribute of Something
      list children of Something
      Something has Parts
      etc
A carefully defined set of operators makes the code more readable (well,
only slightly more). But I think Prolog programmers do not use this feature
much as the conventional Prolog syntax feel so natural to them (my
experience, my opinion). Taste can be cultivated.


So I guess it is alright to sweeten the syntax. But careful. Don't overdo
it. Otherwise the future languages would be COBOL and more COBOL :)


Nor Jaidi jaidi@technet.sg
--


Post a followup to this message

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