Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
SmaCC compiler compiler
Last updated at 3:32 am UTC on 22 September 2020
As of November 2017 the most recent version you get is the one for Pharo version 5 loadable through the catalog.
For Pharo 6.

 Metacello new
  baseline: 'SmaCC';
  repository: 'github://ThierryGoubier/SmaCC';
  load


From the homepage: http://www.refactoryworkers.com/SmaCC.html

SmaCC (Smalltalk Compiler-Compiler) is a freely available parser generator for Smalltalk. It is a replacement for the T-Gen parser generator. T-Gen has several limitations that make it difficult to produce parsers. SmaCC overcomes T-Gen's limitations. For example, 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.


Get the latest distribution from SqueakMap.
SmaCC in Squeak 3.9

The product of this tool are two classes - a scanner and a parser class. They contain the source code (rules) as strings on the class side which allows to regenerate them even if one hasn't got the original source code.

The tool comes with an easy to use GUI and an excellent tutorial.

Sample classes for parsing C, Java and Smalltalk are included.


Some links


Tutorial
EBNF parser example done with SmaCC
Simple Query language done with SmaCC
How to create a state-machine with SmaCC
SmaCC compiler compiler done with SmaCC



Compiler compiler in Java (has sample quite some sample grammars which might serve as a starting point for a translation to SmaCC grammar rules)

See also

Ohm/S and Gramada