Re: simple vs complex languages

tmk@netvision.net.il (Michael Tiomkin)
6 May 2003 01:29:54 -0400

          From comp.compilers

Related articles
[2 earlier articles]
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)
Re: simple vs complex languages torbenm@diku.dk (2003-05-12)
Re: simple vs complex languages spencer@panix.com (David Spencer) (2003-05-12)
Re: simple vs complex languages thant@acm.org (Thant Tessman) (2003-05-12)
Re: simple vs complex languages bear@sonic.net (2003-05-12)
[30 later articles]
| List of all articles for this month |
From: tmk@netvision.net.il (Michael Tiomkin)
Newsgroups: comp.compilers
Date: 6 May 2003 01:29:54 -0400
Organization: http://groups.google.com/
References: 03-04-095
Keywords: syntax, design
Posted-Date: 06 May 2003 01:29:54 EDT

Steve_Lipscombe@amat.com wrote in message news:03-04-095...
> Robert wrote
>
> >The thing that bothers me about all this fancy parsing technology we
> >have developed over the past few decades is that it is solving an
> >artificial problem. If we didn't design our programming languages to
> >have such doggone complicated syntax, then we would be happy to use
> >hand-written recursive-descent parsers.
> >...
> >[I don't see why it's artificial. Human languages have very complex
> >grammars. That's how we're wired to work. Why shouldn't computers
> >adapt to us for a change? -John]
>
> I'm with Robert on this one.
>
> 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?


    Well, in this case you'd better use Lisp or Postscript which have
much simpler syntax. BTW, implementing Pascal with its hierarchical
stack structure used for nested procedures isn't very nice and
efficient.


    Recall that the purpose of inventing a programming language is to
allow relatively short and comprehensible programs. Your primary
target is a human who writes/reads the code. And most humans have a
huge problem to understand things that are too simple and boring
(attention wandering away) or too complicated (giving up).
    It seems that humans need certain level of complexity to be
comfortable with.
    You might be right that a computer would prefer to parse 5K lines of
Lisp than 200 lines of C++. The problem is that nobody asks them what
are their preferences. And if you can save 20K hours of work of
programmers with just 12 hours of your work to make a decent parser
(well, make it 200 hours for C++!-), this is an efficient use of your
time.


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


    I would say that we want to use how clever we are to make things
easier to create/understand. Do we need to use binary code as our
base programming language? I have to read binary code sometimes, and
it's not very enjoyable task.


> 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).


    This can be said about programming as well. Programs use redundant
information, e.g. definitions and declaration of the same entity in
one program. Programs use context to resolve ambiguity, e.g. using
declarations and prototypes in order to derive program semantics.
Making assumptions is sometimes called "assertions" etc. etc.


> 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.


Well, you are invited to parse a typical C one-liner!


BTW, humans are known to perform very well in ambiguous situations.


And naturally, the new languages we invent are similar to those
already programmed inside us, recall Chomsky's assumption of the
language instinct.


    Michael


Post a followup to this message

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