How to translate an ANTLr parser into SmaCC

Suppose you have an ANTLR grammar. How do you get a corresponding SmaCC grammar?

First, download the corresponding grammar archive and parse the .g4 file:

tree := Antlr4Parser parseFile: '/path/to/grammar.g4'.
  

Once you have it you can use the SmaCCRewriteEngine Object subclass: #SmaCCRewriteEngine instanceVariableNames: 'rewriteRule source newStarts newStops properties methods processedNodes outputDirectory outputFilename contextClass' classVariableNames: '' package: 'SmaCC_Rewrite_Engine' to transform it, like this:

fileSystem := FileSystem memory.
rewriteFile := fileSystem / 'antlr.rw'.
ZnClient new
	url: 'https://raw.githubusercontent.com/j-brant/SmaCC/master/rewrites/antlr/antlr.rw';
	downloadTo: rewriteFile.
rewriter := SmaCCRewriteEngine new.
rewriter rewriteRule: (SmaCCRewriteRuleFileParser parseFile: rewriteFile).
rewriter rewriteTree: tree