Live data from Hacker News

Internals of a Turbo Pascal Compiler

turbopascal.org

61–70 of 106 posts

Re: Internals of a Turbo Pascal Compiler

#61
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…

Pascal 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 ?

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 :-)

Re: Internals of a Turbo Pascal Compiler

#62
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 remember at the time that C was more compelling specifically because of the limited strings in Turbo Pascal. At least TP had variable length strings.. older PASCALs did not have this (they had space filled strings instead).

Re: Internals of a Turbo Pascal Compiler

#63
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…

If you haven't played it still, play Planetfall, it has Floyd as an NPC and is one of the greats from the Infocom days.

Re: Internals of a Turbo Pascal Compiler

#64
post #26
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…

I loved playing with the OO "Turbo Vision" framework back then and getting to learn about OO. Only programming Qt in C++ was equally enjoyable. The modern web is difficult to stand in comparison (though Anders is involved in Typescript). And that big fat stack of manuals you got with Borland Pascal (which I recall buying used for perhaps equiv of $60 in 1993 - same price as the used 2400 bps modem).

Turbo Vision was my introduction to OOP frameworks, then I moved into Object Windows Library with TPW 1.5.

However given the nature of Windows APIs, I eventually moved into Turbo C++ for Windows, also with OWL.

Never used the VCL, by then I was already fully into C++.

Then came the experience with Smalltalk, Oberon, Caml, Prolog and many others.

Sadly never had a reason to invest into Delphi.

Re: Internals of a Turbo Pascal Compiler

#65

Earlier quoted context omitted.

Pascal 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 ?

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 that C development with similar safety, readability, and dev speed.

What's the market do? Push all effort into C and C++. Results of that are still with us. (sighs) Go and Rust give me some hope in that they're first mainstream languages that solve some problems. On non-mainstream, Julia is an awesome development that might be re-applied to systems programming. Not to mention Racket's metaprogramming combined with C or assembler generation for a high-level use of low-level, fast language. Ivory language does that with Haskell, for example.

So, not as Worse as usual. Still true overall.

Re: Internals of a Turbo Pascal Compiler

#66
post #60
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…

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)

Re: Internals of a Turbo Pascal Compiler

#67

Earlier quoted context omitted.

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…

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 for better in other areas, open-source, and cross-platform. Best use case is a C or C++ replacement that's safer, easy to read, and supports computers with little resources. Go's not there yet on runtime side.

Re: Internals of a Turbo Pascal Compiler

#68

Earlier quoted context omitted.

My 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 ass…

I learned programming by digging through TP6 online help. That and Ralf Brown's Interrupt List, so I could do something useful.

Oops! What I meant was, there was no such thing as "online" at all, when TP1 came out. ;-)

Re: Internals of a Turbo Pascal Compiler

#69
post #51
post #9

Earlier quoted context omitted.

.. 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 monumen…

Lightspeed Pascal (later renamed THINK Pascal ) was a similarly solid compiler+IDE from about the same era for the early Macintosh.

It all went downhill after they got bought by Symantec.

Re: Internals of a Turbo Pascal Compiler

#70
post #55

Fans of Turbo Pascal, or more so Delphi, will be interested in Lazarus. http://www.lazarus-ide.org/

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

Post reply on HN