Language Syntax Suggestion

Hans-Dieter Dreier Ursula.Dreier@ruhr-uni-bochum.de
Sun, 14 Feb 1999 03:25:28 +0100



Matthew Tuck schrieb:

> Jeremy Dunn wrote:
>
> > Language writers seem to be pretty loose about creating mutually
> > contradictory ways of writing things. It is my belief that we must pick
> > a function syntax and stick with it without any exception in the
> > language, > this makes for simpler compilers
>
> While it is certainly a true that it makes compilers more complex, I
> have
> two points to make against this:
> (a) compilers are there to be complex rather than our programs being
> complex, and if extra complexity makes programming better, then so be
> it.
> After all, the least complex compiler is none at all.

But certainly there has to be a balance: If the compiler is too complicated, it
will also be big, slow and buggy; this also indicates that the language it
processes is somewhat complicated and will inevitably contain a lot of special
cases and therefore be hard to understand. See C++. The simpler and more
orthogonal a language, the easier to learn and implement (at least generally
speaking). The art is to get all the functionality you want with as few
different concepts as possible.

> (b) syntax is well understood and is the most easy part of the compiler
> to
> write, if not automatically generate.  Therefore syntax overhead is not
> a
> large issue.
>
> > and reduces the mental overhead that the programmer must keep track of
> > to write code.
>
> I wouldn't agree that this sort of thing creates mental overhead.  It
> exists to make things easier rather than the other way around.  Some
> initial overhead in learning always exists, but you benefit in the long
> run.  Of course, this sort of thing is rarely quantified into data
> contrasting two approaches.

I remember the ol' days when OOP was experimental: The old languages likeFortan
IV and Algol60, later C were a lot easier to learn and you could write decent
programs in them as well. Many things have grown more complicated with the
advent of OOP.

> > I am sure that at first glance that this notation must seem pretty alien
> > but it has the virtue of being consistent in its methodology and results
> > in extremely compact expressions when one gets the hang of it.
>
> APL did too, but it hasn't been copied very often.  It's generally
> considered to be not very readable.

IMHO, you should have pretty good reasons if you deviate too much from what
people are used to. Fact is, they are used to infix notations and some
standards for using special characters. Just show a lisp program to someone who
is not used to their use of ' and he is likely to be confused.

> As you've probably read, we're looking at some sort of
> syntax-independent
> language.  Hence you could write your own syntax like this and be
> largely
> independent of those who don't make the same syntax tradeoffs as you.
> There's a fair amount of work to be done in this area though.  I imagine
> you'll be interested in designing special syntactic support for the
> underlying mathematical functions to support what you've detailed in
> this
> message.

As long as it can be expressed as an AST (abstract syntax tree) and the
underlying VM can handle it, there's no reason why you should not design your
own syntax.

> Have you looked at functional languages before?  If not, definitely do
> so, there's a lot you'd be interested in in them.

I would like the idea to have a functional language subsystem, too. An engine
for such a thing must be interesting to write. Since we will have garbage
collection, it could also fit nicely into our memory model.

Hans-Dieter Dreier