Compilers - Am I writing one?

Hans Fugal hans at
Mon Jun 30 07:47:42 MDT 2008

Daniel C. wrote:
> I started off on a project to write a simple little program (ha!) that
> would turn files written in a LaTeX-like (but much, much simpler)
> language (called Raskal) into a fully-formed web site.  All of the
> "hard" stuff - i.e. the actual HTML, CSS, document structures, etc.
> will be defined in files elsewhere, and then glued together (and
> filled in with content) according to what's in a bunch of files
> written in Raskal.  All I really have to do is read the Raskal files
> and then parse them and turn them into data trees and hand them off to
> another program (already written) which will take care of turning the
> data tree into actual HTML and putting it where it goes on the server.

You've had some good advice. I think learning all that "painful" stuff 
is immensely valuable, but of course time is our enemy. I think what you 
need to understand to accomplish the task is much less: you need 
parsing, abstract syntax trees (which are already defined for you), and 
the already-written HTML generation. So really, you need parsing. You 
mentioned lisp, so I don't know where to point you for actual tools, but 
if you were using another language I'd recommend you look at  It gets rid of the silly 
distinction between lexing and parsing, it allows you to keep your 
grammar closer to the ideal (what Levi was discussing), and mixing in 
the code (to generate your AST) is syntactically quite workable (based 
on the one or two ports to languages I've looked at).

In short, find yourself a parser generator and learn how to use it. This 
will involve understanding grammars and ASTs and maybe how to tweak a 
grammar to fit the needs of the parser generator. Anything else you 
choose to learn is icing on the cake.

As for the dragon book, it looks like an excellent book for digging 
really deep (I haven't read it but I've perused it). But it doesn't look 
like a practical book for the modern practitioner just looking to get 
things done (it's dated now, and it spends a lot of time on things you 
won't need to worry about). I want to read it sometime.

Hans Fugal ;

There's nothing remarkable about it. All one has to do is hit the
right keys at the right time and the instrument plays itself.
     -- Johann Sebastian Bach

More information about the PLUG mailing list