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.
 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.


On Mon, Dec 24, 2012 at 4:30 PM, Kene Meniru <[email protected]> wrote:

> Joseph S. Tate wrote:
>
> > You could do this in pure python, but this kind of thing is perfect for
> > PLY.
>
> I thought as much. I am willing to do the work but I can't seem to wrap my
> mind around the PLY examples I have not seen examples on exactly what I am
> proposing. This is why I am posting here. Can you give me a very simple
> example of reading a single line of text and calling a python class with
> the
> parameters?
>
>  I am not knowledgeable at all in this area so I need some help. I may be
> wrong but I do not think it is like compiling but more like interpreting.
> Thanks.
>
> --
> 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.
>
>
>


-- 
Joseph Tate
Personal e-mail: jtate AT dragonstrider DOT com
Web: http://www.dragonstrider.com

-- 
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.


Reply via email to