4 ms·
Pascal is generally not an interpreted language. It is a compiled language that is suitable for systems and applications programming.
by einr 5y ago
Pascal is generally not an interpreted language. It is a compiled language that is suitable for systems and applications programming.
- Koshkin 5y agoAs far as I remember, Pascal admitted single-pass analysis. Such languages are especially amenable to being interpreted, i.e. immediately translated into executable actions (vs. some sort of bytecode).
- mikewarot 5y agoI'm not familiar with "single-pass analysis", but I do know that Pascal can be compiled with a single pass recursive descent compiler, which made Turbo Pascal orders of magnitude faster than any other compiler at the time. In an era when C programmers could have coffee while waiting for things to compile, a pascal program hit enter, saw the results, and moved on.
- wahern 5y agoC was also designed for single-pass compilation. Among many other things that people now dislike about C, this is why C requires forward declarations. C compilers became slow because of the optimizations they accreted. Plus, I imagine it just wasn't a priority for the vendors in the way it was for Borland Pascal. I'm curious how the Borland C compiler compared in speed to their Pascal compiler and to other C compilers.
- cb321 5y agoTinyC/tcc [1] still is a single-pass compiler and can go all the way to ELF files (or directly running via tcc -run) in a few milliseconds - sometimes an order of magnitude faster than the minimal start-up time of an interpreter like Python. But yes, gcc will generate faster running object code..a long standing trade off (like -O0 vs -O3, etc.). [1] https://github.com/TinyCC/TinyCC https://github.com/TinyCC/TinyCC
- Koshkin 5y ago> I'm not familiar with "single-pass analysis” Sure, not many programmers are today, sadly. I was referring to syntax analysis, or “parsing.” Some (admittedly, relatively simple) grammars allow syntax analysis to be done in one pass, so that an intermediate representation (e.g. in the form of an AST) becomes unnecessary; the latter is only needed if the grammar is complex and thus requires two or more passes for further analysis and/or machine code generation. Writing an interpreter for a command language is straightforward - exactly because analysis of its syntax can be done in one pass. Pascal is not a command language, but its grammar is (was?) still simple enough for many students of programming having gone through this (still highly recommended) exercise when Pascal was a teaching language.
- zozbot234 5y agoSingle-pass compile was a basic requirement back when your compiler only had access to a 64KB address space for its code and data. But it forces program organization into a clunky bottom-up sequential shape that just doesn't jive with the most basic concerns for larger-scale, professional software development. There's a reason why most of us don't code in FORTH, and why more recently Rust even chose the 'crate' rather than the single program file as its compilation unit.
- Koshkin 5y agoAll is true; note that “compile” is not the same as syntax analysis - because the former implies generation of code whereas the latter does not. (This is why we have two classes of language “translators”, one is compilers and the other, interpreters - although this distinction in modern practice has become somewhat blurry, because an interpreter may generate some sort of byte code which it then immediately executes.)
- pjmlp 5y agoWirth devised P-Code, only as means to ease porting the language into new platforms, it was the UCSD Pascal that based an whole system on it. Most Pascal compilers were actually compiled, either directly, or by converting the above P-Code into machine code via an additional pass, e.g. Corvus Systems https://en.wikipedia.org/wiki/Corvus_Systems https://en.wikipedia.org/wiki/Corvus_Systems
- abetusk 5y agoWhoops! You are correct! For some reason, Pascal sat in my mind as an interpreted language. Maybe my whole arguments falls apart then.