Re: simple vs complex languages

rafe@cs.mu.oz.au (Ralph Becket)
5 May 2003 23:38:30 -0400

          From comp.compilers

Related articles
Re: simple vs complex languages Steve_Lipscombe@amat.com (2003-04-27)
Re: simple vs complex languages rpboland@math.uwaterloo.ca (Ralph P. Boland) (2003-04-27)
Re: simple vs complex languages alex_mcd@btopenworld.com (Alex McDonald) (2003-04-27)
Re: simple vs complex languages basile@starynkevitch.net (Basile STARYNKEVITCH) (2003-05-05)
Re: simple vs complex languages rafe@cs.mu.oz.au (2003-05-05)
Re: simple vs complex languages hat@se-46.wpa.wtb.tue.nl (Albert Hofkamp) (2003-05-06)
Re: simple vs complex languages Robert@Knighten.org (2003-05-06)
Re: simple vs complex languages scott.moore6@attbi.com (Scott Moore) (2003-05-06)
Re: simple vs complex languages tmk@netvision.net.il (2003-05-06)
Re: simple vs complex languages nmm1@cus.cam.ac.uk (2003-05-12)
Re: simple vs complex languages George.Russell@cis.strath.ac.uk (George Richard Russell) (2003-05-12)
[34 later articles]
| List of all articles for this month |

From: rafe@cs.mu.oz.au (Ralph Becket)
Newsgroups: comp.compilers
Date: 5 May 2003 23:38:30 -0400
Organization: http://groups.google.com/
References: 03-04-095
Keywords: parse
Posted-Date: 05 May 2003 23:38:30 EDT

Steve_Lipscombe@amat.com wrote in message news:03-04-095...
> Robert wrote
>
> If a language is designed with a simple, consistent syntax then it is
> not only easier for the compiler to parse, but (more importantly) it
> is easier for humans to understand and therefore easier to get
> right. Can you guess I like Pascal, which was designed from the outset
> for a single pass RDP?
>
> I'm no expert in these matters (then shut-up, they cried), but it
> seems to me that to express complex ideas we need a rich vocabulary,
> but not a complex syntax. And if not, then why do we do it?


Consider modern declarative languages like Haskell and Mercury. Each
effectively has a core syntax, which is easy to understand on the
small scale and in which one can write programs directly. However,
various items of syntactic sugar (i.e. non-core syntax that is
translated into core syntax) are part of these languages because the
syntactic sugar is so useful.


For example, one does not *need* to use multiple clauses or pattern
matching in the head or syntactic sugar for lists or convenient syntax
for type classes et cetera, but without them programs are harder to
read.


Syntactic sugar is added (conservatively) to simplify common cases. It
is usually not hard to parse and easy to translate into core syntax.


> Why make anything needlessly complicated? Just to prove how clever we are?


Only Lisp programmers think Lisp programs are a model of clarity :-)


> Human languages are too ambiguous for programming. They only work for
> humans because we add redundant information, use context to resolve
> ambiguities, or simply make assumptions (which sometimes/often turn
> out wrong).


Indeed and somebody should tell this to Larry Wall and the little Perl
Wizards.


> Finally, if you want to program in a human language, try parsing this old
> favourite:
>
> Time flies like an arrow, fruit flies like a banana.


Parsing isn't the problem with this old chestnut.


- Ralph


Post a followup to this message

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