The preprocessor is good enough to use now and I've annotated it with 
plenty of comments. Source is available at 
http://code.google.com/p/ccs-preprocessor/. Usage and source file format 
comments are extracted and put in the 
wiki.<http://code.google.com/p/ccs-preprocessor/>

I used an extra, exclusive, state, 'ccode', in the lexer to handle free 
form text between #rom statements. To switch between lexer states 'ccode' 
and 'INITIAL' (which handles the #rom statements) empty productions are 
used immediately before the terminating token of each state. The action of 
these productions is to switch lexer states. That way the lexer state is 
changed immediately the terminating token of a state has been taken by the 
parser.

Interestingly the code to do the command line decoding and #rom statement 
processing (the *RomHandler *class) are relatively large compared to the 
lexer and parser code. Considering what the parser is doing that seems to 
me a credit to lex/yacc, PLY and of course Python.

I plan to convert the module into a more Pythonic OO framework suitable for 
building such preprocessors more quickly than starting from scratch. But 
that will have to be a couple of months away.

Comments invited,
John


<http://code.google.com/p/ccs-preprocessor/>

-- 
You received this message because you are subscribed to the Google Groups 
"ply-hack" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ply-hack/58cc7302-5352-4242-bcc8-f4d385f286e9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to