SmaCC (Smalltalk Compiler-Compiler) is a freely available parser generator for Smalltalk. It generates LR parsers and is a replacement for the T-Gen parser generator. SmaCC overcomes many of T-Gen's limitations that make it difficult to produce parsers. SmaCC can generate parsers for ambiguous grammars and grammars with overlapping tokens. Both of these are not possible using T-Gen. In addition to handling more grammars than T-Gen, SmaCC has a smaller runtime than T-Gen and is faster than T-Gen. The latest version of SmaCC has support for GLR parsing, generating abstract syntax trees (ASTs), and transforming code.
We have used SmaCC to write custom refactoring and transformation tools for several languages including Java, C#, and Delphi. These tools range from small scale refactorings to large scale migration projects. For example, we have used SmaCC to migrate a 1.5 million line Delphi program to C#.
SmaCC was developed under VisualWorks 7, Dolphin 6.0 Professional, and VASmalltalk 8.6.1 by John Brant and Don Roberts. While it currently only runs on these platforms, it should be relatively easy to port to other platforms.
To get started with SmaCC, you can download the files and read the tutorial. If you want more information than the tutorial provides, we have more detailed sections for the scanner and parser as well as the directives that control the code generation. There is also a booklet for Pharo. While it is written for Pharo, much of the information would be applicable to the other versions.
If you find bugs or have questions about SmaCC, please contact us. We also write custom refactoring or transformation tools using SmaCC, so if your company needs such tools please contact us. Such jobs help us support SmaCC.