![](https://secure.gravatar.com/avatar/a5de4cf6334caef556290f8bcd00f09a.jpg?s=120&d=mm&r=g)
IIRC you have to parse your grammar definition before your entry point for example in the module level somewhere you do try: t = GFILE.read(mode='U') regexs, rules, ToAST = parse_ebnf(t) except ParseError,e: print e.nice_error_message(filename=str(GFILE),source=t) raise parsef = make_parse_function(regexs, rules, eof=True) then parsef can be used inside your entry point. What I mean is, parse_ebnf and make_parse_function are not RPython, so they need to run before translation take place (remember that the pypy translator runs after import time, and it translates rpython from live python objects in memory). On Mon, Apr 18, 2011 at 10:15 PM, Ian Overgard <ian.overgard@gmail.com> wrote:
Hey guys,
I was playing around with using the parser generator in rlib, but I'm having some trouble figuring out how to get it to work in rpython (I did get one working in normal python though). Is there a resource on using it somewhere, or maybe just a few pointers? (I realize it's probably in a pretty beta state, but so far it seems like the only parser-generator that's runnable in rpython without really big changes). I was reading this: http://codespeak.net/pypy/dist/pypy/doc/rlib.html#full-example but it seems to cut off rather abruptly.
It seems like you do something along the lines of instantiating one in normal python, then asking it for its string representation and generating a source file from that. Is that accurate? Or did I just manage to confuse myself terribly while reading the prolog example?
Thanks! Ian
_______________________________________________ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
-- Leonardo Santagada