|
Hello,
My name is Radu Vlasov. I just joined the
SableCC mailing list today.
First I would want to thank Etienne Gagnon for
writing this fine piece of software, SableCC.
I wrote a Perl script that takes the output from
SableCC v.3.2 and `compacts` the alternative and token classes
into a much smaller number of classes. Any classes not found in the source
parser are named Common*
It is a "quick and dirty" approach, that does
not involve changes in the SableCC source code.
I didn't have time to do a lot of testing; it
did work with my grammar.
The script will only work with parser generated
from grammars that do NOT use the * and +
wildcards; see the notes at the
beginning of the script regarding this limitation.
The reason I had to write the script is that
originally I had a Bison/Flex grammar
that I converted to a SableCC. The
conversion was really a straightforward thing to do, but the generated parser consisted in over 600 classes.
After `compacting` them I ended up with less than 25 classes.
I'm posting the script in case somebody may
find it useful.
Unzip the attachment into some directory, then from
a shell/dos box `cd` into that directory and call Perl passing the
script (sccCompact.pl) on the command line.
If you have questions, you think that I missed
something, or if you get errors when running the script, please send
me an email.
Thanks
Radu
|
Attachment:
SableCC_compact.zip
Description: Binary data