SmaCC Question

David T. Lewis lewis at mail.msen.com
Mon May 24 01:05:23 UTC 2004


On Sun, May 23, 2004 at 07:48:57PM -0500, Colin Putney wrote:
> Hi folks,
> 
> A question for the SmaCC gurus out there. I'm trying to build a parser 
> that will be versioned in Monticello, so I want to keep the code in the 
> parser class as much as possible, and out of the grammar. If I read the 
> tutorial correctly, this ought to be possible.

I'm not sure I understand the problem you are trying to solve, but as
for the grammar, it is stored safely in the form of strings in class
side methods of the generated parser and scanner. So this should be
manageable in whatever version control system you want to use, no
problem.

As for modifying (and keeping versions of) the generated code, don't
do that. Think of those strings in those class side methods as the
source code. Anything labeled as "generated" is like object code that
you should not touch. However, you can easily add your own methods to
the generated classes, keeping your hand-written methods in version
control. You can regenerate your parser and scanner classes with SmaCC
any time, and it will not clobber your hand-written methods. Works
a champ.

Dave




More information about the Squeak-dev mailing list