simplified Python parsing question
Eric S. Johansson
esj at harvee.org
Mon Jul 30 05:57:40 EDT 2012
On 7/30/2012 5:25 AM, Laszlo Nagy wrote:
>
> Did you try to use pygments?
>
> http://pygments.org/docs/api/
>
thanks, I'll take a look.
>
> I would first tokenize the code, then divide it by statement keywords.
> Finally, you just need to find expression/assignment statements in the
> remaining sections. (Maybe there is a better way to do it.)
>
>
>
yeah the problem is also little more complicated than simple parsing of Python
code. For example, one example (from the white paper)
*meat space blowback = Friends and family [well-meaning attempt]
*could that be parsed by the tools you mention? I suspect not but this is what I
need to generate using speech recognition because it's easily spoken. A more
complex example might be something like
new base = OS path-base name (old path)
or
if OS base exists (current path): new base name = OS path base name(current path)
What's particularly cute here is that using the translation technique I can
actually describe the full object method path with a minimum of speaking
overhead. Python is great. :-)
But the questions remain, will these tools are stuff like this?
More information about the Python-list
mailing list