Live data from Hacker News

Internals of a Turbo Pascal Compiler

turbopascal.org

71–80 of 106 posts

Re: Internals of a Turbo Pascal Compiler

#71
post #4

This 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…

I have very fond memories of just how blazingly fast Turbo Pascal was at compiling on my Mac. It stunned me every time. I remember spending most of one summer writing a text adventure game with it, based in the Australian Gold Rush. It even had NPCs which was quite advanced for text adventures of the day (I think the only NPCs in adventure games that I had encountered up to that point were those in the Hobbit, and of…

I didn't realize Turbo Pascal was ever released for the Mac. Apparently (according to Wikipedia) it was, but it was soon discontinued. Lightspeed/THINK Pascal/C ruled the roost on the Mac for a long time (thanks in large parts to just how horrible working with MPW was) until the PowerPC when Metrowerks took their place.

Re: Internals of a Turbo Pascal Compiler

#73

Earlier quoted context omitted.

Worse is Better seems to be an ongoing theme in the programming industry. (Pascal was much more readable and safe than C, and about the same speed - e.g., I could cobble up pointer arithmetic in TP if I have to with the address-of operator and increment/sizeof pseudo-functions) First it was shitty C code in the 90s, and now the Java language. At least I'm not totally burned out on Javascript yet :-)

Very. Gabriel might go back and forth but I was sold on the concept first read of paper. Let's take Turbo Pascal or even Delphi. People were griping at one point about all C's problems and C++'s similar + new problems. They wanted a more productive, safer, easier-to-integrate systems language. I cited Wirth already built half a dozen and Borland industrialized them. Hell, even industrial BASIC's had less problems tha…

> What's the market do? Push all effort into C and C++. Results of that are still with us.

Not to mention the amount of money spent writing band aids for them., in form of static and memory analysers and more recently CPU instructions (Intel MPX).

Which not everyone uses, because either it isn't available on their platform, or they choose not to use them anyway.

Just like coders that despite C++ safety improvements over C, use it as C with C++ compiler.

Re: Internals of a Turbo Pascal Compiler

#74
post #60

Earlier quoted context omitted.

Turbo Pascal was originally written for and targeted the (8-bit) Z80, unless Wikipedia has it backwards. https://en.wikipedia.org/wiki/Turbo_Pascal#CP.2FM_and_DOS_ve... The Turbo Pascal compiler was based on the Blue Label Pascal compiler originally produced for the NasSys cassette-based operating system of the Nascom microcomputer in 1981 by Anders Hejlsberg. Borland licensed Hejlsberg's "PolyPascal" compiler core (…

That's correct, I even have a version of it for the Z80 Softcard on the Apple II. Even in that day, the license was still only for 1 CPU and you had to mail in a license registration card to be able to use the software (I don't think that sort of EULA is legally enforceable, though)

How did that licensing work? Like any self-respecting 11-year-old, my Apple ][ CP/M copy of Turbo Pascal was pirated.

Re: Internals of a Turbo Pascal Compiler

#75
post #18

Earlier quoted context omitted.

Turbo Pascal was also available on CP/M (so 8080/Z80 8-bit). It was the most powerful language on Amstrad CPC 6128, the only 8-bit low cost computer to offer CP/M compatibility.

> the only 8-bit low cost computer to offer CP/M compatibility. The Commodore 128 also offered CP/M compatibility (through a second CPU...), though rarely used.

I rememeber the CP/M floppy ... I booted it once or twice but did not know what to do with it, so I ignored it. I usually booted my C128 in C64 mode to play games.

Re: Internals of a Turbo Pascal Compiler

#76
post #27
post #12

Turbo 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…

I 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-baby...

In 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.

Re: Internals of a Turbo Pascal Compiler

#77
post #8

Earlier quoted context omitted.

Interestingly I just Googled Borland to see what they do these days: http://www.borland.com/Products Seems like they made quite a major pivot?

Yes, 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/ 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…

Don't forget the first pivot: Inprise.

Borland decided that the new shiny thing was "enterprise client/server middleware" — whatever that was. The new Inprise products were oriented towards building distributed client/server database apps using DCOM and the all-too-obviously-dead-on-arrival CORBA.

This was right around the time the web took off, but before the inane "enterprise Java application server" market exploded. Borland had a hard time competing with Java, and they started to neglect the stuff that had made Delphi such a powerful proposition in the first place.

Re: Internals of a Turbo Pascal Compiler

#78

Earlier quoted context omitted.

I've been working with Delphi for the last 18 months; previously Java and .Net many years before that, but Delphi in the distant, distant past. In my opinion, Delphi needs to just die, and the people/companies that have code bases built on it need to rewrite. There are lots of choices for software development these days, I don't think Delphi stands out for any particular use case in the modern world. But hey, maybe I…

Compared to VC++, it was easier to learn, read, write, make reliable apps, and extend. I could teach anyone a Wirth language. The Go community is learning the benefits of Pascal-style design. People wanting a new Delphi should probably use Go. Just because Delphi stagnated and died off. Anyone wanting Pascal/Delphi today should use Lazaurus IDE w/ Free Pascal Compiler. Compatible with Delphi where it mattered, aiming…

Most people writing Delphi code in 2015 do it to maintain legacy Windows desktop applications. I don't think you can do that with Go. The most logical replacement would still be C# (or another language running on .net) with WinRT (or more likely WPF: I mean if you are still using Delphi you are probably not using Windows 8/10...).

Re: Internals of a Turbo Pascal Compiler

#79
post #7

I 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 generi…

30 years ago, the AP Computer Science test was given in Pascal. I thought it was perfect for its time. I think it moved to C few years after I took it, then eventually Java.

It was in C++ when I took it in 2002. I remember being told it was the last year they were doing C++, and they'd be switching to Java the next year.

Re: Internals of a Turbo Pascal Compiler

#80

Earlier quoted context omitted.

I've been working with Delphi for the last 18 months; previously Java and .Net many years before that, but Delphi in the distant, distant past. In my opinion, Delphi needs to just die, and the people/companies that have code bases built on it need to rewrite. There are lots of choices for software development these days, I don't think Delphi stands out for any particular use case in the modern world. But hey, maybe I…

Compared to VC++, it was easier to learn, read, write, make reliable apps, and extend. I could teach anyone a Wirth language. The Go community is learning the benefits of Pascal-style design. People wanting a new Delphi should probably use Go. Just because Delphi stagnated and died off. Anyone wanting Pascal/Delphi today should use Lazaurus IDE w/ Free Pascal Compiler. Compatible with Delphi where it mattered, aiming…

> People wanting a new Delphi should probably use Go. Just because Delphi stagnated and died off.

Or, for that matter, Nim, which also has a huge amount of Pascal heritage.

Go is a hybrid of Oberon and C (with semantics leaning more towards Oberon and syntax more towards C, but they're both mixed in), and Nim is Modula-3 semantics married to Python syntax (with the best parts of a bunch of other languages thrown in). Both Oberon and Modula-3 are descended from Modula-2, which in turn is descended from Pascal.

Personally, I'm more in the Nim camp, partially because I prefer Modula-3 to Oberon, partially because I prefer Nim's Pythonesque syntax to Go's C/Oberon mashup syntax, and partially because Nim's metaprogramming features are truly beautiful.

Post reply on HN