X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/2b84abb596f52ab2068d52108adc96838ad4340a..31cef89cb428866f787983e68246030321893df4:/usr/src/cmd/pi/pas.y?ds=inline diff --git a/usr/src/cmd/pi/pas.y b/usr/src/cmd/pi/pas.y index 506a7b9ca8..6598e80178 100644 --- a/usr/src/cmd/pi/pas.y +++ b/usr/src/cmd/pi/pas.y @@ -1,14 +1,4 @@ -/* - * 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 @@ -43,7 +33,7 @@ * 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 @@ -74,7 +64,8 @@ YSET YSTRING YTHEN YDOWNTO YTYPE YUNTIL YVAR YWHILE YWITH YBINT YOCT YHEX - YASSERT YCASELAB YILLCH YLAST + YASSERT YCASELAB YILLCH YEXTERN + YLAST /* * PRECEDENCE DECLARATIONS @@ -92,19 +83,25 @@ %left YNOT %{ - /* * 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" @@ -123,9 +120,13 @@ */ 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 ')' ';' @@ -180,6 +181,8 @@ decl: | var_decl = varend(); + | + proc_decl ; /* @@ -268,18 +271,15 @@ Verror: * 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 @@ -708,7 +708,7 @@ element: variable: YID = { - @ return (identis(var, VAR)); + @@ return (identis(var, VAR)); $$ = setupvar($1, NIL); } | @@ -848,7 +848,7 @@ id_list: /* * 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 @@ -863,40 +863,40 @@ id_list: 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)); ;