Live data from Hacker News

Internals of a Turbo Pascal Compiler

turbopascal.org

91–100 of 106 posts

Re: Internals of a Turbo Pascal Compiler

#91

Earlier quoted context omitted.

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

Online as in "hlp file that's shown when you press F1". At the time online meant "not printed" :-)

Ah, yes. Now I get it. I'm kinda slow on the uptake sometimes. ;-)

I stopped with TP5. At that point, I was up to my ears in my thesis project, and was not going to change any of my tools. Plus I'm a real tightwad. By the time I finally finished my degree, got a new job, and a new computer, it was an Apple Mac. And the modern OS's kind of killed my interest in programming for a while.

Re: Internals of a Turbo Pascal Compiler

#92
post #82
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 first used it on a Z-80 CP/M machine.

Actually, the CP/M version was called COMPAS Pascal, but it was very nearly the same code.

Re: Internals of a Turbo Pascal Compiler

#93
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 (…

Indeed. Manuals and object files for the original, BLS Pascal, can be found at http://nascomhomepage.com and the motivated reader can even run it at http://thorn.ws/jsnascom/jsnascom.html (Download http://nascomhomepage.com/lang/Blspas.nas and use "Load NAS" to browse to it. After that type "E1000" return and you should end up in BLS Pascal. Type a program like

BEGIN WRITE('Hi'); END.

hit Ctrl-X and use R to run it.

Re: Internals of a Turbo Pascal Compiler

#94
post #82

Earlier quoted context omitted.

That's correct. I first used it on a Z-80 CP/M machine.

Actually, the CP/M version was called COMPAS Pascal, but it was very nearly the same code.

I think they mean the CP/M version of Turbo Pascal (the Borland-licensed one with the built-in IDE)

Re: Internals of a Turbo Pascal Compiler

#95
post #94

Earlier quoted context omitted.

Actually, the CP/M version was called COMPAS Pascal, but it was very nearly the same code.

I think they mean the CP/M version of Turbo Pascal (the Borland-licensed one with the built-in IDE)

Borland never made CP/M software. This account matches my memory from back then: http://blogs.embarcadero.com/davidi/2008/11/02/38933

Re: Internals of a Turbo Pascal Compiler

#96
post #94

Earlier quoted context omitted.

I think they mean the CP/M version of Turbo Pascal (the Borland-licensed one with the built-in IDE)

Borland never made CP/M software. This account matches my memory from back then: http://blogs.embarcadero.com/davidi/2008/11/02/38933

I think you're misremembering things. I'm pretty sure I ran CP/M Turbo Pascal as a kid and the page you link says:

The final step in November 1983 - Turbo Pascal v1.0 is created for Borland International, Inc. Distributed on a single floppy disk, Turbo Pascal integrated the Pascal compiler, Wordstar-like text editor, runtime library, run in memory, and creation of .COM programs - all within 131,297 bytes in the TURBO.COM file. The whole product was 33k bytes in size and ran in 64k bytes of memory. The product was delivered for CP/M-80 (Z/80, 5.25 and 8 inch floppy disks), CP/M-86, and MS-DOS/PC-DOS.

Re: Internals of a Turbo Pascal Compiler

#97
post #96

Earlier quoted context omitted.

Borland never made CP/M software. This account matches my memory from back then: http://blogs.embarcadero.com/davidi/2008/11/02/38933

I think you're misremembering things. I'm pretty sure I ran CP/M Turbo Pascal as a kid and the page you link says: The final step in November 1983 - Turbo Pascal v1.0 is created for Borland International, Inc. Distributed on a single floppy disk, Turbo Pascal integrated the Pascal compiler, Wordstar-like text editor, runtime library, run in memory, and creation of .COM programs - all within 131,297 bytes in the TURBO…

Blush. I'm delighted to be corrected as I didn't know this. A 15 year old version of me met The Man himself at a trade show where he was demoing COMPAS Pascal, running a maze generator. I've learned a lot from using and disassembling his software.

Re: Internals of a Turbo Pascal Compiler

#98
post #80

Earlier quoted context omitted.

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

Modula-3 semantics married to Python syntax. Now that sounds potentially great. :) Even more so since I've recommended each language. Modula-3 was the second time (since Turbo Pascal) that industry types took Wirth's design ideas, ran with them, and produced an industrial implementation that kicked ass. Was used in SPIN OS w/ type-safe linking where OS and linked code leveraged type system for protection. Python syntax's benefits are well known.

I was a bit concerned about the maturity, compiler complexity, available libraries, and so on about Nim. I figured it might be in alpha quality or something given it's so new. So, I was hesitant to try it. I might give it a go sometime soon reading comments like yours.

Btw, do you have experience with its macro system? Any take-it-to-next-level language needs at least good macros and preferably great ones. Top contenders of my recent research are Racket, Julia, and Red. If Nim is more like Modula3/Python & has good macros, then it might be a credible contender due to mainstream programmers being able to pick it up more easily than really weird languages.

Re: Internals of a Turbo Pascal Compiler

#99
post #73

Earlier quoted context omitted.

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

Yeah the band aids add up. We'd need things such as static analysers anyway for spotting problems, optimizing, etc. However, an extra problem with C/C++ is that the languages are so complex to analyse that people get friggin' PhD's for certifying or formalizing even a subset of them. And the average programmer working against the clock is supposed to make something robust with such a tool? That's ridiculous.

" because either it isn't available on their platform"

I tried to solve that with my tools (lang X) using X-to-C compiler w/ seemless FFI for 3rd party code. Encouraged other languages to do that with many having done it before I got on the scene: Modula, Oberon, Ada, LISP/Scheme, and so on. Let them use good language with hardware/OS of choosing. Ignored it as you said.

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

David Thornley brought this up on Schneier's blog when he said he was distrusting about those who mentioned "C/C++" as if they're same thing. That using modern C++ prevents many C issues if it's used correctly. Now, I abandoned C++ as anything but a compiler target after all the 90's empirical evaluations showed it was garbage. I think my critique that it lets you shoot yourself in foot easily and is hard to analyse probably still applies like it did when I cited them together. It's why I do.

Nonetheless, I honestly don't know how modern C++ developers code when they're doing it "right" with style guides, newer language features, peer review, etc. I think it would be fair in these discussions to do some new, empirical studies comparing proper C++ to Free Pascal, Go, Rust, Ada, etc in various attributes like was done in 90's. Critical that it's used as pro's say it should be so as not to mislead readers about effectiveness (i.e. C++ used like C didn't work). You know any resources I could use to catch up on topic that capture most or all of how pro's do C++ with modern features? Not necessarily most recent standard but what has been used at least past 5 years maybe 10.

Re: Internals of a Turbo Pascal Compiler

#100
post #73

Earlier quoted context omitted.

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

Obligatory:

https://www.gnu.org/fun/jokes/unix-hoax.html

Even a professional and fan of C once admitted that this was great because it could've been true. Ain't that something. ;)

Post reply on HN