On Oct 14, 2009, at 4:42 PM, matio wrote:
> to implement an 'if', do you have to use 'ast' like in GardenSnake
GardenSnake was something I wrote years ago. It uses the ast because
GardenSnake ends up generating Python byte code and I could leverage
existing Python data structures and byte code generation to help with
that.
Implementing an 'if' can be done in many ways, so there's no way to
answer than without a lot more context.
Based on your postings, you still have a lot to go before you
understand PLY and how it works, You posted a snippet of code (with
t_ccode_lbrace and t_ccode_rbrace) and asked what it does. It comes
from the PLY documentation, and with a description in the paragraph
before the code.
But to understand that description you have to know why lexers (being
regular grammars) can't on their own handle balanced braces. And to
get that requires some theory background that can be hard for people
to pick up on their own.
I cannot help you there. I learned this through university course
work and a lot of work on my own. There are books on the topic, but
then you'll have to learn how to convert from the syntax used in the
book to using PLY, which isn't always direct. Nor do I have advice on
which books to even look at to get a better understanding.
Best regards,
Andrew
[email protected]
--~--~---------~--~----~------------~-------~--~----~
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 this group at
http://groups.google.com/group/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---