/* Copyright (c) 1979 Regents of the University of California */
* pi - Pascal interpreter code translator
* Charles Haley, Bill Joy UCB
* Version 1.1 February 1978
* pxp - Pascal execution profiler
* Version 1.1 February 1978
* Parser for 'yacc' output.
* Specifially Modified for Berkeley Pascal
int yystate
; /* Current parser state */
unsigned yytshifts
1; /* Number of "true" shifts */
* Parse and parallel semantic stack
* This routine parses the input stream, and
* returns if it accepts, or if an unrecoverable syntax
int paniced
, *panicps
, idfail
;
* Push new state and value.
if (yypv
>= &yyv
[MAXDEPTH
-1]) {
yerror("Parse stack overflow");
* Locate parsing actions for the
p
= &yyact
[ yypact
[yystate
+1] ];
* Search the parse actions table
* for something useful to do.
* While n is non-positive, it is the negation
* of the token we are testing for.
yypw
[1].Wseqid
= yyseqid
;
if (N
== 1 && OY
.Yychar
== YID
&& !yyEactr(n
, yypv
[0])) {
* Use goto table to find next state.
p
= &yygo
[yypgo
[yyr1
[n
]]];
while (*p
!= *ps
&& *p
>= 0)
if ((paniced
|| yyshifts
!= 0) && yyrecover(ps
, idfail
)) {
* Find a state where 'error' is a
if (paniced
&& yyshifts
<= 0 && ps
>= panicps
) {
yypv
=- (ps
- panicps
) + 1;
yypw
=- (ps
- panicps
) + 1;
for (p
= &yyact
[ yypact
[*ps
+1] ] ; *p
<= 0; p
=+ 2)
yerror("Unrecoverable syntax error - QUIT");