Handmade or tool-built?
On the evolution of a parser generator written in D.
The parsers of real-world compilers like dmd and clang are hand-written. Does it have to be that way? Tools like Coco and AntLR are too simple or bring additional dependencies. In many such tools support for D is outdated or not available. When I was faced with the task of writing a parser for a programming language, I did not think about it for a long time, and decided to create a hand-written reursive descent parser. But it was immediately clear that this is a tedious job. I came up with the idea to automate the essential part of it. The aim was to achieve convenience before completeness. Repetitive activities should be removed from the programmer's resonsibilities without causing restrictions.
The result is my tool, LLtool. LLtool generates just the body of a parser from a grammar description, relying on conventions to interface with other parts of a compiler. In my talk I show how a grammar and a recursive descent parser relate to each other and create a parser from a grammar description. I also show how limitations of my approach can be solved in a systematic way. A further topic is how to support language variations. For demonstration, I use the grammar of a real programming language.
Kai Nacke is a professional IT architect. In his spare time he likes to develop open source applications. He was maintainer of LDC, the LLVM-based D compiler, and a committer of the LLVM project. His contributions to LDC include ports to different CPU architectures and operating systems. Another interest of him is using D for business applications. He is the developer of the D bindings for SAP. Besides being programmer, he is also the author of "D Web Development" and a speaker at the Free and Open Source Software Developers' European Meeting (FOSDEM).