Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Writing a Programming Language in Perl

by Corion (Pope)
on Oct 25, 2011 at 22:10 UTC ( #933716=note: print w/replies, xml ) Need Help??

in reply to Writing a Programming Language in Perl

In my opinion a very good book is Compiler Construction (pdf warning) by Niklaus Wirth. I've only used the German edition from 1986, but it introduces a small language and how to build a parser and compiler for it. It only teaches you the technique of recursive descent. Recursive Descent is a technique that is currently enjoying a comeback because it is easier with it to produce meaningful error messages than it is when using lex and yacc or other parsing tools. The German book has 115 pages, the English and more recent edition (from 1996) has 130 pages. This seems to me a good starting point in the sense that little previous knowledge is needed and it gets you a feel for implementing some language with Pascal-like syntax. Actually, in the English PDF, it's an Oberon-like syntax, but that's still close enough.

When I first read the book, I skipped over the chapters 1 to 4, as they concern themselves with the theoretical background of the languages that the approach can handle. Looking back over the chapters, I'm not sure whether it was really necessary to skip over them, as they don't seem as dry to me as they did back then. On the other hand, I now have much more experience and also learned the theory of regular languages and context-free languages in university.

Browsing through the PDF, I see that it also mentions bottom-up (yacc-style) parsing and gives a rough outline of it.

Replies are listed 'Best First'.
Re^2: Writing a Programming Language in Perl
by andal (Hermit) on Oct 26, 2011 at 08:16 UTC
Re^2: Writing a Programming Language in Perl
by programmer99 (Novice) on Oct 25, 2011 at 23:17 UTC
    I scanned through the PDF and it looks really good. I'll get back to you on how good... ;-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://933716]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2018-05-23 13:59 GMT
Find Nodes?
    Voting Booth?