I have used POVray extensively in the past myself. I still have A1
printed images on the walls around me this very minute.
I have also used yacc and ply in projects.
Although I think making an intermediate language and using ply to parse
it would be a good way to go I think, if you are not concerned about
security it would probably be simpler to make the description file
readable by python itself:
building({'firstLevel' : 123, 'ceiling' : 200, 'levels' : 20})
then have a 'building' object generator,
already things comments, includes, compilation and in-line maths all
work.
That style reminds me of python 'sqlalchemy' if you know what I mean.
That said, if you do a few tutorials you will find 'ply' quite easy if
you have used yacc.
Python, because of the native lists and dictionaries lends itself to
much smaller parsers than even yacc and c++ with STL.
------ Original Message ------
From: "Kene Meniru" <[email protected]>
To: [email protected]
Sent: 25/12/2012 9:33:41 AM
Subject: Re: advise on using ply
Joseph S. Tate wrote:
There are lots of examples to crib from. Looking at those is how I
learned how to use PLY:
This is a very very simple example, but is an end to end PLY lexer
and
parser. No matter how big your system gets it still looks like this:
http://www.dalkescientific.com/writings/NBN/parsing_with_ply.html .
It's
an almost trivial example, but you can probably see how you would
extend
the singular "Atom" into different statement objects that you would
define.
Looks like a good example and shows a manual option for comparison.
Exactly
what I would like to play with. Thanks.
These statement objects then would call your python class with the
parameters. Or if you don't need to parse separately from the
execution,
you could just make your calls inside p_*.
Definitely take a look at the examples in the source repo:
https://github.com/dabeaz/ply/tree/master/example . They range from
simple to extremely advanced, but they don't take very long to read
over.
That should get you where you need to go.
--
You received this message because you are subscribed to the Google
Groups "ply-hack" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"ply-hack" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.