Modern Compiler Construction using Pascal

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Modern Compiler Construction using Pascal

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.





_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Modern Compiler Construction using Pascal

Mattias Gaertner
On Mon, 1 Jan 2018 13:17:47 -0500
Yves Cloutier <[hidden email]> wrote:

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

pas2js is written in FPC.

Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Modern Compiler Construction using Pascal

greim
In reply to this post by Yves Cloutier


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




Am 01.01.2018 um 19:17 schrieb 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.
>
>
>
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Modern Compiler Construction using Pascal

Marc Santhoff-2
In reply to this post by Yves Cloutier
On Mon, 2018-01-01 at 13:17 -0500, Yves Cloutier wrote:
> 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 look at antlr.org, 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 <[hidden email]>
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Modern Compiler Construction using Pascal

Santiago A.
In reply to this post by Yves Cloutier
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/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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Modern Compiler Construction using Pascal

Marc Santhoff-2
In reply to this post by Yves Cloutier
On Mon, 2018-01-01 at 13:17 -0500, Yves Cloutier wrote:
> Hi there,
>
> I'd be interested to know if any modern compilers have been written
> in
> Pascal (other than the Pascal Compiler).

A bit outdated, but intresting:

http://pascaland.org/pascall.htm

--
Marc Santhoff <[hidden email]>
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Modern Compiler Construction using Pascal

Yves Cloutier
In reply to this post by Santiago A.
Wow, these are all amazing links!  Thanks so much. This should keep me busy for a while!

On Tue, Jan 2, 2018 at 10:49 AM, Santiago A. <[hidden email]> wrote:
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/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.



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Modern Compiler Construction using Pascal

Free Pascal - General mailing list
In reply to this post by Yves Cloutier
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/



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Modern Compiler Construction using Pascal

Graeme Geldenhuys-6
In reply to this post by Marc Santhoff-2
On 2018-01-02 15:30, Marc Santhoff wrote:
> Sorry for mentioning something nasty like Java on this list.

The more I use Java (and the ecosystem around it) the more I love it. :)

It is expected that any developer these days are proficient in multiple
languages. Object Pascal (Delphi) and Java are good combinations/choices
in my eyes.

Regards,
   Graeme

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal