Language Documentation and Compilers

A few years ago, I had the great pleasure of working on a compiler for a proprietary programming language. The first thing I had to do was document the language, because it consisted mostly of a set of LISP functions that acted as an interpreter, whereas I had to create a high performance compiler for a more traditional runtime environment. It was a beautiful language but a bit complicated with many variations on argument types, specifically lists, “atoms” (the LISP word for keywords, sort of) and other functions. I wrote a detailed syntactical and semantic specification, and then pretty much converted that into a series of functions in a more conventional programming language. It was also necessary, because of the limitations of my development environment, to think of the parsing and processing of the language as purely linear rather than being loadable into an entire expression in a memory tree and parse it from there.

The good thing is that it actually worked, and I was able to build a very fast compiler for this beautiful programming language; but had I not documented it first, it would have been very, very difficult to build an efficient compiler in that very un-LISP-like programming environment. So it was quite an exciting project and, in my own opinion, very successful, and a real pleasure to both document and build a compiler for this lovely language. Yet another reason why I enjoy technical writing so much! Please feel free to write with any questions or post comments. I keep track of them!

Thanks for reading,
Andy Schaub

Leave a comment