Re: simple vs complex languages

Albert Hofkamp <>
29 May 2003 03:06:32 -0400

          From comp.compilers

Related articles
[23 earlier articles]
Re: simple vs complex languages (2003-05-18)
Re: simple vs complex languages (Jack Crenshaw) (2003-05-24)
Re: simple vs complex languages (Jack Crenshaw) (2003-05-24)
Re: simple vs complex languages (Jack Crenshaw) (2003-05-24)
Re: simple vs complex languages (2003-05-29)
Re: simple vs complex languages (2003-05-29)
Re: simple vs complex languages (Albert Hofkamp) (2003-05-29)
Re: simple vs complex languages (2003-05-29)
Re: simple vs complex languages (2003-06-03)
Re: simple vs complex languages (2003-06-03)
Re: simple vs complex languages (2003-06-03)
Re: simple vs complex languages (2003-06-03)
Re: simple vs complex languages (Jan C.=?iso-8859-1?Q?Vorbr=FCggen?=) (2003-06-05)
[9 later articles]
| List of all articles for this month |

From: Albert Hofkamp <>
Newsgroups: comp.compilers
Date: 29 May 2003 03:06:32 -0400
Organization: Eindhoven University of Technology, The Netherlands
References: 03-04-095 03-05-013 03-05-184
Keywords: parse, design
Posted-Date: 29 May 2003 03:06:32 EDT

On 24 May 2003 20:07:47 -0400, Jack Crenshaw <> wrote:
> Albert Hofkamp wrote:
>> > right. Can you guess I like Pascal, which was designed from the outset
>> > for a single pass RDP?
>> There is a big didactic problem with Pscal imho. The language pushes
>> the top-down design approach, yet I have to write my program
>> bottom-up. I think that is a very big compromise for ease of parsing.
> With respect, that dog won't hunt. I've been hearing this complaint
> for decades, but I still don't buy it.
> I presume you're talking about the requirement in classical Pascal
> that requires a function to be declared before it's referenced. Duh!

No I am not, at least not at the time I was learning Pascal. (at that
time I didn't even have a clue why the forward reference was needed,
it was just a thing you needed to enter when writing recursive
functions (and for recursive functions only I believed then)).

I think in general, a language should support the methodology,
especially a language for learning to program. So imho the Pascal
language should have supported the top-down design approach by first
requiring the main program, followed by the functions called from the
main function, followed by the functions called from the functions,

> What else would anyone expect?

After learning to program in Pascal, I have spent quite a few years
wondering why Pascal had to be written 'upside-down'. It wasn't until
I started learning about compilers that the pieces fell in place.

For an educational language, these things do matter. Even smaller
issues like where to put the ; (before or after the statement) make
the difference between a consistent and a non-consistent language for
a student.

> C used to allow functions to be declared later in the code than the
> calls to them. It doesn't, anymore. Today we use prototypes, which is
> a whole lot better deal. Pascal also allows prototypes -- otherwise
> one could never do forward references. So why is one language
> superior to the other in this respect? How is it that Pascal forces
> you to "write .. bottom-up," where C does not???

Pascal is a language used to teach programming, C is a programming
language aimed at professionals for writing (operating)system-level
programs. Although both languages are equally broken with respect to
forward declarations in a technical sense, the requirements in both
situations are very different. Unlike C, Pascal was written with
education as goal.

For a didactically sound environment, I am not even sure that a 2 pass
compiler wouldn't have been better for Pascal.

> As for me, I have a screen editor. I am perfectly capable of going to
> the bottom of the file instead of the top, if I want to write the main
> program first. It only takes one press of Ctrl-End. I think I can
> manage that.

And after that you are constantly writing upwards, jumping back to the
beginning of the file, and writing another function. Not exactly a
logical approach for writing a program, imho.

It also makes incremental refinement more difficult to spot. You can
only see the refinement by printing both versions, and aligning them at
the bottom (rather than the top, which would more logical for a
student and more in line with the top-down design idea).

Reading a Pascal program is equally awkward, kind of reading a book from
back to front.

> I think you are confusing the design/development approaches of
> software engineering with language syntax features. There is no
> reason one cannot do top-down design in Pascal, C, Forth, or any other
> language.

I agree completely, the argument is only valid in an educational

> [In the versions of Lisp that I know, a function doesn't have to be
> declared or defined until its called. That can make development a lot
> easier. -John]

The same is true for Python, it is indeed a very nice property for a RAD


Post a followup to this message

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