Share

Berkeley Yacc

Tracker: Support Requests

5 Fix -Y option - ID: 712692
Last Update: Comment added ( siebrenzee )

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


Siebren van der Zee ( siebrenzee ) - 2003-03-31 13:34

5

Open

None

Nobody/Anonymous

None

None

Public


Comment ( 1 )




Date: 2003-03-31 20:57
Sender: siebrenzee

Logged In: YES
user_id=744403

Here is a better (and tested) version of the goto.py that I
submitted earlier.


Log in to comment.

Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.