HACKER Q&A
📣 amichail

Is it just an accident that Pascal can be compiled extremely fast?


Or was Pascal designed in a way to make this possible?


  👤 Someone Accepted Answer ✓
The latter. http://pascal.hansotten.com/niklaus-wirth/recollections-abou...

“Sophistication in syntax analysis was very much in style in the 1960s, allegedly because of the power and flexibility required to process high-level languages. It occurred to me then that a much simpler and more perspicuous method could well be used, if the syntax of a language was chosen with the process of its analysis in mind. The second attempt at building a compiler therefore began with its formulation in the source language itself, which by that time had evolved into what was published as Pascal in 1970 [Wirth, 1970], The compiler was to be a single-pass system based on the proven top-down, recursive-descent principle for syntax analysis.”


👤 AnimalMuppet
Pascal - the original Pascal, since in a comment you seem to dislike Turbo Pascal - was designed for a one-pass compiler. Things were laid out to make things very easy for that one-pass compiler - everything defined before its use, no back-tracking necessary. Also the grammar was very simple. And the compiler attempted very few (if any) optimizations compared to current compilers.

In short, the language design meant that the compiler didn't have to do much, so what it did, it could do quickly.


👤 bob1029
Turbo pascal was definitely designed on purpose to make things as fast as possible and undercut all the competition. The compiler for this was ultimately developed by the same guy who architected C#.

👤 082349872349872
Designed: industrial programs might be compiled once and run multiple times. Student programs, on the other hand, will likely be run fewer times than they are ever (attempted to be) compiled.

Pascal's original use was the latter case.


👤 throwaway81523
No, not an accident. This article is about Turbo Pascal but discusses some of the topic: https://prog21.dadgum.com/47.html