Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2018-01

Modern Compiler Construction using Pascal

9 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Yves Cloutier

Hi there,

I'd be interested to know if any modern compilers have been written in Pascal (other than the Pascal Compiler).

It's unfortunate that that most Pascal books out there are rather dated. I did recently purchase

Compiler Engineering Using Pascal (by Capon)

https://www.amazon.ca/Compiler-Engineering-Using-Pascal-Capon/dp/0333471555/ref=sr_1_1?ie=UTF8&qid=1514829567&sr=8-1&keywords=Compiler+Engineering+Using+PASCAL

And look forward to getting it in my mailbox.

I also have Brinch Hansen on Pascal Compilers. I did have another book on writing a compiler using pascal but it was using some framework which I was not able to find.

Another great book I have is Introduction to Compiler Construction by Thomas Parsons, but I was not able to follow it all the way through.

My interest for the moment is more for creating a DSL that scans, parses then generates Groff as its target code.

After gaining some experience with the process I would like to venture into writing a transpiler for something like SETL -> Pascal or Oberon -> Pascal. There are other interesting older languages too like BCPL that could be used as the source language. Implementing Icon in Pascal would be interesting as well as its implementation is extremely well documented in the book "Implementing Icon and Unicon" by Clinton Jeffery

I find the Pascal compiler to be really fast and the fact that it is available for so many platforms is very appealing.

Reply by email

greim
to Yves Cloutier: I'd be interested to know if any modern compilers have been written in Pascal (other than…

I guess you already noticed the book of the master himself: Nicklaus Wirth

https://www.inf.ethz.ch/personal/wirth/CompilerConstruction/index.html

Its revised 2017 (!) based on Oberon.

Afaik one of the first editions was based on Pascal.

Markus

Yves Cloutier wrote 45 lines
Hi there, I'd be interested to know if any modern compilers have been written in Pascal (other than the Pascal Compiler). It's unfortunate that that most Pascal books out there are rather dated.  I did recently purchase Compiler Engineering Using Pascal (by Capon) https://www.amazon.ca/Compiler-Engineering-Using-Pascal-Capon/dp/0333471555/ref=sr_1_1?ie=UTF8&qid=1514829567&sr=8-1&keywords=Compiler+Engineering+Using+PASCAL And look forward to getting it in my mailbox. I also have Brinch Hansen on Pascal Compilers. I did have another book on writing a compiler using pascal but it was using some framework which I was not able to find. Another great book I have is Introduction to Compiler Construction by Thomas Parsons, but I was not able to follow it all the way through. My interest for the moment is more for creating a DSL that scans, parses then generates Groff as its target code. After gaining some experience with the process I would like to venture into writing a transpiler for something like SETL -> Pascal or Oberon -> Pascal.  There are other interesting older languages too like BCPL that could be used as the source language.  Implementing Icon in Pascal would be interesting as well as its implementation is extremely well documented in the book "Implementing Icon and Unicon" by Clinton Jeffery I find the Pascal compiler to be really fast and the fact that it is available for so many platforms is very appealing. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Marc Santhoff
to Yves Cloutier: I'd be interested to know if any modern compilers have been written in Pascal (other than…
Yves Cloutier wrote 8 lines
Hi there, I'd be interested to know if any modern compilers have been written in Pascal (other than the Pascal Compiler). It's unfortunate that that most Pascal books out there are rather dated. I did recently purchase mailman/listinfo/fpc-pascal

Pascal purists, please do not read on!

<heresy>

Really good an modern books on writing compilers are those from Terence Parr. They are really readable and understandable, forget about the Dragon Book.

The tool in use is the well known ANTLR, the newer versions implemented in Java. If you want to build real compilers look for version 3, if making DSLs is your target version 4 would be appropriate.

Have a , the books to read are:

"The Definitive ANTLR Reference - Building Domain Specific Languages"

Like the title says, a verbose and well written refernce for using antlr.

The best book on the topic by far is (for me):

"Language Implementation Patterns"

That's a very clear, pragmatic, and analytic view on compiler construction. It is structured modular and easy to read. Guido van Rossum, the creator of Python, writes about it "Throw away your compiler theory book!"
I would really appreciate a translation of the code from the book to pascal. ;)

</heresy>

Sorry for mentioning something nasty like Java on this list.

Marc Santhoff

Reply by email

Santiago A.
to Yves Cloutier: I'd be interested to know if any modern compilers have been written in Pascal (other than…
Yves Cloutier wrote 7 lines
Hi there, I'd be interested to know if any modern compilers have been written in Pascal (other than the Pascal Compiler). It's unfortunate that that most Pascal books out there are rather dated.  I did recently purchase 

The first version of nim language  https://nim-lang.org/ was written in Pascal. Here are the sources
https://github.com/nim-lang/Nim/tree/ea1f1ec6d4d6c776eb0f81c2bebdd4cb4c817ebe/nim

Many times, when compiler is mature, the compiler is re-written in the target language itself. Freepascal compiler is written in Freepascal.

First version of compiler must be written in other language, (of course, the are not compilers for the language ), usually a language that generates binary, compiling is very demanding to rely on virtual machines Probably that is why there are not Java compilers written in Java, or Python or Perl compilers written in Python or Perl . As usual, the most popular language will be most used language: C, C++

Saludos Santiago A.

Reply by email

Yves Cloutier
to Santiago A.: The first version of nim language  https://nim-lang.org/ was written in Pascal. Here are…

Wow, these are all amazing links! Thanks so much. This should keep me busy for a while!

Santiago A. wrote 31 lines
El 01/01/2018 a las 19:17, Yves Cloutier escribió: > Hi there, > > I'd be interested to know if any modern compilers have been written in > Pascal (other than the Pascal Compiler). > > It's unfortunate that that most Pascal books out there are rather > dated. I did recently purchase The first version of nim language https://nim-lang.org/ was written in Pascal. Here are the sources https://github.com/nim-lang/Nim/tree/ea1f1ec6d4d6c776eb0f81c2bebdd4 cb4c817ebe/nim Many times, when compiler is mature, the compiler is re-written in the target language itself. Freepascal compiler is written in Freepascal. First version of compiler must be written in other language, (of course, the are not compilers for the language ), usually a language that generates binary, compiling is very demanding to rely on virtual machines Probably that is why there are not Java compilers written in Java, or Python or Perl compilers written in Python or Perl . As usual, the most popular language will be most used language: C, C++ -- Saludos Santiago A.

Reply by email

leledumbo
to Yves Cloutier: I'd be interested to know if any modern compilers have been written in Pascal (other than…

I used to play with this a bit: https://github.com/lysee/lysee It's written by a Chinese programmer and I remember reading his page about the language using google translate :p
The github page is without documentation, but its older google code page is still accessible (just hope he didn't break anything lately): https://code.google.com/archive/p/lysee/

Reply by email