-/*
- * pi - Pascal interpreter code translator
- *
- * Charles Haley, Bill Joy UCB
- * Version 1.0 August 1977
- *
- * pxp - Pascal execution profiler
- *
- * Bill Joy UCB
- * Version 1.0 August 1977
- */
+/* Copyright (c) 1979 Regents of the University of California */
/*
* Yacc grammar for UNIX Pascal
* the same time.
*
* 5) Creates the semantic restriction checking routine yyEactr
- * by processing action lines containing `@'.
+ * by processing action lines containing `@@'.
*
* This compiler uses a different version of the yacc parser, a
* different yyerror which is called yerror, and requires more
YSET YSTRING YTHEN YDOWNTO
YTYPE YUNTIL YVAR YWHILE
YWITH YBINT YOCT YHEX
- YASSERT YCASELAB YILLCH YLAST
+ YASSERT YCASELAB YILLCH YEXTERN
+ YLAST
/*
* PRECEDENCE DECLARATIONS
%left YNOT
\f
%{
-
/*
* GLOBALS FOR ACTIONS
*/
+/* Copyright (c) 1979 Regents of the University of California */
+
+/* static char sccsid[] = "@(#)pas.y 1.3 9/2/80"; */
+
/*
* The following line marks the end of the yacc
* Constant definitions which are removed from
* y.tab.c and placed in the file y.tab.h.
*/
##
+/* Copyright (c) 1979 Regents of the University of California */
-#include "whoami"
+static char sccsid[] = "@(#)pas.y 1.3 9/2/80";
+
+#include "whoami.h"
#include "0.h"
#include "yy.h"
#include "tree.h"
*/
goal:
- prog_hedr decls procs block '.'
- = funcend($1, $4, lineof($5));
+ prog_hedr decls block '.'
+ = funcend($1, $3, lineof($4));
+ |
+ decls
+ = segend();
;
+
prog_hedr:
YPROG YID '(' id_list ')' ';'
|
var_decl
= varend();
+ |
+ proc_decl
;
\f
/*
* PROCEDURE AND FUNCTION DECLARATION PART
*/
-procs:
- /* lambda */
- |
- procs proc
- = trfree();
- ;
-proc:
+proc_decl:
phead YFORWARD ';'
= funcfwd($1);
|
- pheadres decls procs block ';'
- = funcend($1, $4, lineof($5));
+ phead YEXTERN ';'
+ = funcext($1);
+ |
+ pheadres decls block ';'
+ = funcend($1, $3, lineof($4));
;
pheadres:
phead
variable:
YID
= {
- @ return (identis(var, VAR));
+ @@ return (identis(var, VAR));
$$ = setupvar($1, NIL);
}
|
/*
* Identifier productions with semantic restrictions
*
- * For these productions, the character @ signifies
+ * For these productions, the characters @@ signify
* that the associated C statement is to provide
* the semantic restriction for this reduction.
* These lines are made into a procedure yyEactr, similar to
const_id:
YID
- = @ return (identis(var, CONST));
+ = @@ return (identis(var, CONST));
;
type_id:
YID
= {
- @ return (identis(var, TYPE));
+ @@ return (identis(var, TYPE));
$$ = tree3(T_TYID, lineof(yyline), $1);
}
;
var_id:
YID
- = @ return (identis(var, VAR));
+ = @@ return (identis(var, VAR));
;
array_id:
YID
- = @ return (identis(var, ARRAY));
+ = @@ return (identis(var, ARRAY));
;
ptr_id:
YID
- = @ return (identis(var, PTRFILE));
+ = @@ return (identis(var, PTRFILE));
;
record_id:
YID
- = @ return (identis(var, RECORD));
+ = @@ return (identis(var, RECORD));
;
field_id:
YID
- = @ return (identis(var, FIELD));
+ = @@ return (identis(var, FIELD));
;
proc_id:
YID
- = @ return (identis(var, PROC));
+ = @@ return (identis(var, PROC));
;
func_id:
YID
- = @ return (identis(var, FUNC));
+ = @@ return (identis(var, FUNC));
;