Dan Kegel a écrit :
On Thu, Dec 17, 2009 at 8:32 PM, Dan Kegel dank@kegel.com wrote:
bison it is, then.
I'm thinking of having some ucla students do this, and it occurred to me that using "ply" might be a good way to start. ply is a nice lex/yacc implementation written in python that sounds good for prototyping. Once the grammer is far enough along, it'd be pretty easy to switch to c.
Maybe I'll noodle around with ply and see if I can implement a subset of cmd's language with it. Here's a tiny toy start: http://kegel.com/wine/cmd.py
ply home page: http://www.dabeaz.com/ply/ example of use of ply in compiler course: http://ecee.colorado.edu/~siek/ecen4553/fall08/hw2.pdf
beware that the integration of the parser in the current source code (ie splitting in several small patches) can be tedious so I'd rather see: - implement the parser to be usable command by command (ie from first word, to trigger either the old parser or the yacc one, or something like that) - when all commands are done, then switch to the global parser mode
I don't think writing the grammar itself will be very complicated, but wiring all the code to the grammar will be more tedious
A+