I saw that using the -Y option won't result in a
working parser in python. The problem appears to be the
nature of the yyparser() function jumping back and
forth, and of the way an yyerror macro is supposed to
work. Nice to see these problems can be overcome in
perl, where at least you can name loops.
In python, you'll need some more trickery. The
attached file demonstrates a possible approach.
One more thing you need to know: the function below
assigns to a local variable. When the function
returns, the local variable is discarded:
def yyclearin():
yychar = -1
In python, all lvariables that you assign to are local,
unless
explicitely state otherwise. It should be like this:
def yyclearin():
global yychar
yychar = -1
Nobody/Anonymous
None
None
Public
|
Date: 2003-03-31 20:57 Logged In: YES |
Copyright © 2010 Geeknet, Inc. All rights reserved. Terms of Use