4 ms·
Pascal also was originally designed for easy parsing and compilation - single pass compiler with simple recursive-descent parser. Maybe Delphi compiler works t
by avodonosov 6y ago
Pascal also was originally designed for easy parsing and compilation - single pass compiler with simple recursive-descent parser.
Maybe Delphi compiler works the same way.
- signaru 6y agoThis is also what I am thinking. Even if I am a fan of Delphi/Lazarus for what they deliver, native GUI programs that generally have no dependencies, I think some parts of the Pascal language were designed for ease of the compiler and less for the programmer. Here are a few features that prevent Pascal from being my go-to language: * Having all function variables declared in var clauses at the start, far away from where they are first used. It eventually gets littered by loop indices and other temporary variables. * "interface" sections that can easily grow (C/C++ header files are also somewhat similarly inconvenient). But then again, these languages have been around when computers are not as powerful. And perhaps, keeping these rules is the price of not breaking what works. Still, I doubt language design alone is enough to make compilation fast (i.e. why FPC is not as fast). There must have been a lot of sorcery in the Borland compilers that we will never know. Also they must have taken advantage of only supporting Windows (and only x86?) back then.
- thu2111 6y agoDon't forget the most irritating restriction of all - no circular dependencies between PAS files. That one could get really painful later on in bigger projects. The Delphi compiler was really great, but it was meant primarily for GUI business apps and not any other kind of coding. Result: the compiler hardly optimised. Borland didn't advertise new Delphi releases by referencing benchmark scores for example, but rather new productivity features. Building fast compiler is not sorcery. Look at Java. JavaC starts out interpreted every time you run it, but it can still compile a large amount of source code very fast. Then at runtime HotSpot C1 can produce machine code from bytecode at a staggering speed. The resulting code even has respectable performance, with the slower (but still fast) C2 compiler only kicking in for where it's really needed.
- pjmlp 6y agoTurbo Pascal has supported circular dependencies since Turbo Pascal 5.5 for MS-DOS.
- signaru 6y agoOh yeah, taking this for granted with C# all the time! This what made C# my go-to prototyping language. Circular dependencies might be "bad", but it takes more planning to avoid them when coding from scratch. C++ is also bit of a pain with this. Furthermore C# doesn't need an equivalent of C/C++ headers or Pascal's interface.
- vintagedave 6y ago> single pass compiler with simple recursive-descent parser. > Maybe Delphi compiler works the same way. Delphi is indeed a single-pass compiler. It does not use a normal recursive-descent parser, but a hand-coded parser. Other than that, yes - the Delphi language today is still designed to be extremely efficient to parse and it compiles a million lines of code in seconds.
- fanf2 6y agoRecursive descent parsers are usually hand-coded and vice versa.