11 ms·
Internals of a Turbo Pascal Compiler
- junto 11y agoTurbo Pascal was the first language I was taught in school, although I had already taught myself BASIC on a BBC B Microcomputer as a child. I loved Pascal and wrote a race management program for my local sailing club when I was 16. Fond memories. The whole experience was a voyage of discovery, as I had to write my own "windows" style UI using ASCII codes. I used Delphi later on in university along with Modular2, and C++. I never felt the same passion for these languages as I had had for Turbo Pascal. I later moved on to VB and VBscript, and didn't like them at all but they paid the bills. The next time I felt that same type of passion was for C#. Somehow it just clicked. I think it is about what you can achieve productively with the language, as well as the language itself.
- luso_brazilian 11y agoYou will then be pleased to know that C# development team is led by Anders Hejlsberg, the same Anders mentioned in the article that created what went to become Borland Turbo Pascal. IIRC, he also led the development of Borland Delphi and its language, Object Pascal. He is really a prolific language designer, one of the unsung heroes of that area.
- barrkel 11y agoObject Pascal was originally an Apple invention (with help from Wirth), and made some strides towards ISO standardisation. However it used a value-based OO model that made vtables optional until you added the first virtual method, permitted object slicing, had no common ancestor for all classes, had an odd syntax for calling constructors (using extra parameters to New), etc. Delphi introduced a new object model while retaining the old object model for backward compatibility. The language was renamed to Delphi some time later to reflect this; while Object Pascal in practice meant the language that the Borland compilers compiled, its technical and historical meaning is both broader (more compilers) and more limited (a smaller language with different features).
- junto 11y agoInterestingly I just Googled Borland to see what they do these days: http://www.borland.com/Products http://www.borland.com/Products Seems like they made quite a major pivot?
- 72deluxe 11y agoI used Borland C++ Builder and their version of it in the XP - Windows 7 days, when they released Codegear 7. As far as I knew many of the developers left after they renamed themselves Inprise ("integrating the enterprise" whatever that means), decided to produce odd products that targeted an entirely different audience and after they ditched all the development work on C++ Studio (I think that was what it was called). I remember them introducing Kylix and the disappointment of it being based on Qt and Wine so slow on my old Linux box. The VCL stagnated too (horrible flicker on XP as I recall, to begin with so hacks to disable theming via the application manifest were needed) and the compiler let you do illegal things in C++ in Codegear's C++ Builder 7 (must dig out an example). The installer for C++ Builder 7 took FOREVER to run and also required you keep all of your setup files in your temp directory for later updates to work (???? insane eh!) I remember them releasing a paid PHP editor etc. at the time when you could just grab Netbeans and use that for £0.00 - difficult to compete with that!
- tonyedgecombe 11y agoAfter that PHP editor I vowed to never by another product from them, it was truly awful.
- lucifersam 11y agoYes, quite some time back they split the languages and compilers part out and the rump of Borland became an application lifecycle management company, or something like that. The bit you're probably looking for is at http://www.embarcadero.com/ http://www.embarcadero.com/ now. Some of the old people like David Intersimone are still there. I worked with Delphi for a long time, through versions 3, 5 and 7 (the odd numbers were always better). When .NET came, the whole situation went crazy and never recovered. I can't remember the twists and turns now, but I think they released a .NET only RAD Studio which was awful, then they added the Win32 bits back but Delphi.NET was still awful. Then they dropped .NET and incorporated Remobjects Chrome/Oxygene as Delphi Prism, which was an Object Pascal inspired .NET language. Now they've split again, and Radstudio is all about Firemonkey, a cross-platform UI library. Remobjects are doing their own thing.
- barrkel 11y agoThis site doesn't describe the internals of Borland's Turbo Pascal compiler. It describes a compiler written in Turbo Pascal that can compile some subset of Turbo Pascal's language. Borland's Turbo Pascal compiler was written in 16-bit x86 assembly, mostly by Anders Hejlsberg. There is an explanation of this on the front page of the site, but it's not clear from the headline. (I used to work at Borland on the Delphi compiler, and had access to the source of tpc.exe.)
- jgord 11y ago.. thats the story I was hoping to read, and have been waiting for, for many years. I went from the necessity of A86 assembler, thru the desperation of GW-Basic .. finally finding Turbo Pascal, which was a revelation at the time, just this phenomenal product and superb piece of engineering. Pulldown text menus, draggable text windows, editor out of the box .. fast compilation, wow - to me its one of the great monuments of computer history. I feel intensely nostalgic looking back on it now. And their manuals were first rate.. classy all round.
- Supraperplex 11y agoDesperation of GW-Basic?! Be glad you had that one. The other BASICs of those times where much more limited! GW was a little bit of awesome in it's own way. Oh, and POKE and PEEK.
- insulanian 11y agoYeah, my first lines were in QuickBASIC :)
- analog31 11y agoMy dad, who knew nothing about computers, saw an article in the Wall Street Journal about this guy with a new business model for selling software. On a whim, he got me a copy for my birthday. It was TP version 1. I stuck with TP through version 5, and even convinced my college teachers to let me use it for my programming assignments rather than whatever was on the college mainframe. The manuals were indeed a huge asset. You didn't really need to know anything about the OS, or go digging for third party documentation online, which was important because there was no online.
- huhtenberg 11y ago> Anders Hejlsberg developed Blue Label Pascal... This compiler was later licensed by a software company Borland which added user interface and editor, changed the name to Turbo Pascal and offered it for a competitive price. Nooo... Another account of TP origins was that it was written by Philippe Kahn (the founder of Borland), back when he was just a one-man operation running from a small office on top of a Jaguar car service shop. But apparently it wasn't. Damn.
- jonsen 11y agohttp://blogs.embarcadero.com/davidi/2008/11/02/38933 http://blogs.embarcadero.com/davidi/2008/11/02/38933
- tonyedgecombe 11y agoThe implementation size breakdown for the 12k compiler was: Compiler - 5.5k, On-Screen editor - 1.5k, Runtime library - 4.5k, and Control program 0.5k.
- pjmlp 11y agoI loved Turbo Pascal. When I got to learn C, already had Turbo Pascal 3, 4, 5.5 and 6.0 on my toolbox. Compared with Turbo Pascal, the only thing C had going for it was being available in other systems. Everything else was meh. No memory safe handling, no bounds checking, no units (modules), no namespacing, no proper strings, no OOP support, arrays decaying into pointers, no type safe enumerations, no sets, no generic array indexes... At least C++ allowed me to get some of those Turbo Pascal features back.
- agumonkey 11y agoPascal was off time. A lot of these traits are really worthy, but it wasn't attractive at the time .. was it as 'performant' as C too or was it a very nice environment to craft sound code productively whereas C code could allow you to tap into hardware more aggressively no matter how much headaches that would give you ?
- _0ffh 11y agoGiven the caveat that performance is always a question of how well the implementation performs inside the limits given by the language: Yes Turbo Pascal produced fast code. About as fast as Turbo C. Which was really quite fast. Also, the compilation process itself was very fast compared to other Pascal compilers. About the question you didn't specifically ask: There's no reason (apart from optional stuff, like array bounds checking) that a Pascal compiler couldn't produce code of equivalent speed as a C compiler. (There is one language with a potential speed advantage over Pascal/C/equivalents and that's Fortran.)
- pjmlp 11y agoPascal and C compilers produced similar code quality back then. Everyone praises C compiler quality nowadays. On those home computers, C, Pascal and Modula-2 were good enough for general purpose applications, if one wanted real speed, Assembly was the only way to go. Turbo Pascal, as well as any other Pascal dialects, had the same capabilities to access hardware as C offered. Also the MS-DOS game development scene and the demo scene tools were heavily based in Turbo Pascal, besides the usual Assembly stuff.
- Udo 11y agoTurbo Pascal was my first contact with compiled languages in school, after starting off with Commodore Basic as a kid and graduating to Amos and some other Amiga stuff later. TP was my first contact with real PCs, too. After school I moved to Delphi, which was basically a thin wrapper around the Win32 API with Object Pascal syntax and the nicest IDE I had ever used (and probably will ever use). Delphi really paid my bills as a newbie commercial programmer. That was around the time when the internet took off, and I wrote my first CGI servers in Pascal to make dynamic websites. The Pascal/Delphi language and environment were incredibly versatile and you could write some really fast code with it. Fond memories. In many ways, TP leveled me up as a programmer.
- melling 11y agoI think a lot of people would have claimed that the Amiga was the more powerful Personal Computer. In many ways, it was more interesting than the Mac or Windows computers. It simply didn't have the software support from Microsoft, for example. The Amiga did make its own dent in the universe: http://www.geek.com/games/cgi-first-introduced-to-tv-in-babylon-5-by-mit-presentor-771051/ http://www.geek.com/games/cgi-first-introduced-to-tv-in-baby...
- Udo 11y agoAbsolutely, it took a long time until the games I made on my Amiga could be replicated on the PC. But by the time I was moving away from Amiga, it was clear that its time had passed.
- lobster_johnson 11y agoIn most alternate universes, the Amiga would never could have been a competitor to the PC or even the Mac. The secret to the PC's success was not just the clone market, but the open architecture that permitted endless permutations on interexchangable components: motherboards, graphics cards, hard drives, etc. were all pluggable. Amiga's custom chipset and architecture gave it a huge edge (mostly in multimedia), but the tight coupling made it an evolutionary dead end. Even if they licensed the OS and opened the architecture to clones, the hardware dependency wouldn't have been able to follow suit.
- rottyguy 11y agoI was working at a software store during the mid-late 80's (Babbages if anyone knows it) and had a customer come in asking for a small, lightweight editor... You know like "turbo pascal but w/o the compiler part". First time I ever heard of it and, tbh, had no idea what he was talking about. I later used it to do some work for in my CS class (highschool was teaching programming via Pascal). It's a good language to learn after basic and before C/C++. IIRC correctly, TP used a yellow font (well ascii) on a black background (default)? Didn't it also have some quick key combinations (I recall a ctrl+k for some reason but I'm sure it's just memory...)
- pjmlp 11y ago> IIRC correctly, TP used a yellow font (well ascii) on a black background (default)? Only Turbo Pascal 3.0, afterwards the IDE had other colors.
- bluedino 11y agoTurbo Pascal 2.0 had the yellow/black scheme as seen here: http://imgur.com/utFhJag http://imgur.com/utFhJag Turbo C always had the more complex IDE, which Turbo Pascal didn't get until 4.0: http://imgur.com/kYjwuPA http://imgur.com/kYjwuPA That environment used the Turbo Vision library, and it was later ported to DJGPP and also Linux, there's an editor called RHIDE which uses it. Microsoft used their own IDE in products like QBasic, edit.com, as well as their C and Pascal compilers: http://imgur.com/H6J12Dy http://imgur.com/H6J12Dy
- nathell 11y agoClarification: Turbo Vision was not around until TP 6.0 (TV 1.0 was released with TP 6.0, while TV 2.0, much extended, came with TP 7.0). Turbo Pascal 4.0 through 5.5's IDEs were, TTBOMK, not based on Turbo Vision.
- jablan 11y ago> Didn't it also have some quick key combinations (I recall a ctrl+k for some reason but I'm sure it's just memory...) Exactly. So-called WordStar combinations, which lot of the editors of the time were using. AFAIK, it is still used on some quite popular text editors on Linux (joe?). https://en.wikipedia.org/wiki/WordStar https://en.wikipedia.org/wiki/WordStar
- mahouse 11y agoI'm triggered by the lack of diversity in that story. I am pretty sure Niklaus Wirth was actually black, but that fact was hidden by white male zealots.
- doodpants 11y agohttps://en.wikipedia.org/wiki/Niklaus_Wirth https://en.wikipedia.org/wiki/Niklaus_Wirth
- tedunangst 11y agoYou must be part of the cover up.
- swaits 11y agoFans of Turbo Pascal, or more so Delphi, will be interested in Lazarus. http://www.lazarus-ide.org/ http://www.lazarus-ide.org/
- krylon 11y agoI took over maintenance of an in-house application written in Delphi/ObjectPascal about 18 months ago (as one of my many tasks - I have spent maybe one or two weeks working on it since), and I thought Lazarus was a neat way of getting me started, having no prior Pascal experience whatsoever. Alas, the IDE crashed on me so frequently both under GNU/Linux and OS X that I gave up within a couple of days. Either it is not very stable or I was mistreating it somehow, although I don't know how. The documentation was very helpful, though, in getting to know Pascal. Taking over maintenance of an application written in a languange you can read but hardly write (whatever bad things people might be tempted to say about Pascal, cryptic syntax is not among them, I am certain) is a strange process.
- deleted 11y ago[deleted]