Google
 

Trailing-Edge - PDP-10 Archives - BB-4157D-BM - sources/build.bli
There are 12 other files named build.bli in the archive. Click here to see a list.
MODULE BUILD (STACK(4000)) =
BEGIN



!THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
!  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.

!COPYRIGHT (C) 1972,1977 BY DIGITAL EQUIPMENT CORPORATION
!AUTHOR: T.E. OSTEN
GLOBAL BIND BUILV=2^24 + 0^18 +20;	!VERSION DATE 9-JUN-72
MACRO	TRACE= 1$;OWN DEFLVL,SERLVL,CHRSW,X,START;
STRUCTURE VECTOR [I] = [I] (.VECTOR+.I);
OWN VECTOR BNFTBL[1200];
REGISTER C;
BIND	VECTOR TYPE[0]=BNFTBL[0]<24,12>,
	VECTOR SUBP[0]=BNFTBL[0]<12,12>,
	VECTOR NUMBER[0]=BNFTBL[0]<0,12>;
EXTERNAL
	READ,	%(CHNL)= RETURNS THE N-BIT VALUE(DEPENDING ON THE MODE,
		7 OR 36 BITS) OF THE CHARACTER READ. WILL RETURN -1 IF
		ENDFILE. WILL READ FROM THE TELETYPE IF CHNL=0.
		)%
	OUTMSG,	%(CHNL,TEXT)= WRITES THE GIVEN TEXT OUT ONTO THE
		SPECIFIED CHANNEL. THE TEXT IS GIVEN AS GROUPS OF QUOTED
		STRINGS 5 CHARACTERS LONG, SEPERATED BY COMMAS. THE LAST
		GROUP MUST BE LESS THAN 5 CHARACTERS LONG OR 0.
		)%
	INIT,	%(= PERFORMS A RESET UUO, CLEARS THE CHANNEL TABLE,
		OBTAINS A PARAMETER LIST FROM THE TTY AND SETS UP THE
		TABLE ENTRIES BASED ON THE INFORMATION IT CONTAINS.
		)%
	WRITE,	%(CHNL,CHAR)= WRITES CHAR ONTO THE CHANNEL CHNL. ASCII
		MODE FILES USE ONLY 7 BITS AND BINARY FILES ALL 36. ASCII
		CHARACTERS MUST BE RIGHT JUSTIFIED. THE VALUE OF THIS
		ROUTINE IS ALWAYS ZERO UNLESS THE USER HAS REQUESTED
		THAT OUTPUT ERROR CONDITIONS RETURN TO HIM INSTEAD OF
		FALLING THROUGH TO THE SYSTEM ERROR HANDLER. IN THIS CASE
		, THE VALUE WILL BE ZERO IF NO ERROR OCCURED, OR -1 IF
		AN ERROR OCCURED.
		)%
	OCTOUT,	%(CHNL,WIDTH,VALUE)= WRITES THE ASCII REPRESENTATION
		OF AN OCTAL INTEGER TO THE APPROPRIATE CHANNEL. THE VALUE
		OF WIDTH SPECIFIES THE FIELD WIDTH TO BE USED:
		N > 0 => N-CHARACTERS WIDE (INCLUDING SIGN), ZERO
		SUPPRESSED. N < 0 => N-CHARACTERS WIDE ( INCLUDING SIGN)
		,ZERO FILLED. N = 0 => MINIMUM LENGTH, LEFT JUSTIFIED.
		)%
	DECOUT,	%(CHNL,WIDTH,VALUE)= WRITES THE ASCII REPRESENTATION
		OF A DECIMAL INTEGER TO THE APPROPRIATE CHANNEL. THE VALUE
		OF WIDTH SPECIFIES THE FIELD WIDTH TO BE USED:
		N > 0 => N-CHARACTERS WIDE (INCLUDING SIGN), ZERO
		SUPPRESSED. N < 0 => N-CHARACTERS WIDE ( INCLUDING SIGN)
		,ZERO FILLED. N = 0 => MINIMUM LENGTH, LEFT JUSTIFIED.
		)%
	ENDALL, %(= CLOSES ALL OPEN CHANNELS
		)%
	OUTZ,	%(CHNL,PNTR)= WRITES THE ASCIZ STRING BEGINING AT PNTR ONTO THE SPECIFIED CHANNEL
		)%
	GETSW,	%(CHNL)=RETURNS THE VALUE OF THE SWITCH WORD ASSOCIATED
		WITH CHNL.
		)%
	SET35;	%(CHNL)=MAKES THE BUFFER WORD INTO WHICH THE NEXT
		CHARACTER WILL BE WRITTEN A SEQUENCE NUMBER.
		)%
STRUCTURE STRING[I]=[I*4](.STRING + .I*4);
OWN STRING METANAME [300]:TERMNAME[300]:ACTIONNAME[300];
%(-----------------------------------------------------------------------------------------------------------------
	NOTE THAT THE NAMES "ALL" AND "ONE" ARE USED IN THE FOLLOWING
	MACRO RATHER THAN "AND" AND "OR" AS USED IN THE BNF DESCRIPTION.
	THIS WAS DONE TO ELIMINATE CONFLICT BETWEEN THE BLISS OPERATORS
	"AND" AND "OR".
-----------------------------------------------------------------------------------------------------------------)%

MACRO	META =	1$,	!METASYMBOL CHARACTER STRING, LOCATION, 3
	ALL  =	2$,	!LIST OF REQUIRED ELEMENTS, LOCATION, NUMBER
	ONE  = 	3$,	!LIST OF ALTERNATE ELEMENTS, LOCATION, NUMBER
	OPTION=	4$,	!OPTIONAL ELEMENT(S), LOCATION, NUMBER
	LIST =	5$,	!ELEMENTS SEPARATED BY COMMAS, LOCATION, NUMBER
	REPEAT=	6$,	!ELEMENTS NOT SEPARATED BY COMMAS, LOCATION, NUMBER
	ACTION=	7$,	!CALL A ROUTINE, ROUTINE NAME
	TERMINAL= 8$;	!TERMINAL SYMBOL STRING
MACRO	LSTA  =	1$,	!DSK:FILE.EXT,
	LST  =  2$,	!DSK:FILE.EXT_
	SRC  =	3$;	!DSK:FILE.EXT
BIND	CRLF=PLIT(#015^29+#012^22);
FORWARD
	OUTSTR,		%(STR)= OUTPUTS THE ASCIZ STRING NAMED BY STR
			TO THE TELETYPE. IF STR IS 0 IT OUTPUTS A
			CARRIAGE RETURN, LINE FEED TO THE TELETYPE.
			)%
	ERROR,		%(MSG)= OUTPUT MSG FOLLOWED BY CARRIAGE RETURN,
			LINE FEED TO THE TELETYPE. THEN READ IN AND OUTPUT
			ON THE TELETYPE THE REMAINDER OF THE CURRENT
			BNFDEFINITION UP TO BUT NOT INCLUDING THE
			PERIOD. RETURN WITH THE PERIOD AS THE CURRENT
			CHARACTER.
			)%
	DEC,		%(N)= OUTPUT THE CONTENTS OF N ON THE TELETYPE
			AS A DECIMAL NUMBER.
			)%
	PRODUCTIONS,	%(= INSERTS THE TABLE ENTRIES FOR EACH BNFDEFINITION
			IN THE LANGUAGE. BNFDEFINITION = METASYMBOL "="
			BNFCOMPONENT [COMMENT] "." . THE INDEX OF THE
			METASYMBOL INTO THE METANAME TABLE IS USED TO
			PLACE THE METASYMBOL DEFINITION INTO THE BNF TABLES.
			COMMENTS PRECEEDING AND FOLLOWING THE BNFDEFINITION
			ARE IGNORED.
			)%
	TABLE,		%(TABNAME)= RETURNS AN INDEX INTO TABNAME (TERMNAME,ACTIONNAME
			OR METANAME TABLE) AND INSERTS IF NECESSARY.
			)%
	CHR,		%(= LISTS EACH CHARACTER READ IN AND RETURNS THE
			FIRST SIGNIFICANT CHARACTER WHICH IS NOT A SPACE
			, CARRIAGE RETURN, OR LINE FEED.
			)%
	COPY,		%(N,LT,LS,LN)= COPIES N TRIPLETS FROM THE LOCAL
			BNF TABLES LT (LOCAL TYPE), LS (LOCAL SUBORDINATE
			BLOCK ADDRESS), AND LN (LOCAL NUMBER OF ENTRIES
			IN THE SUBORDINATE BLOCK) TO THE TOP OF THE GLOBAL
			BNF TABLES TYPE, SUBP (SUBORDINATE BLOCK ADDRESS),
			AND NUMBER (NUMBER OF ENTRIES IN THE SUBORDINATE
			BLOCK). THE POINTER TO THE TOP OF THE BNF
			TABLES IS INCREMENTED AND THE PLACE OF COPY IS
			RETURNED.
			)%
	SERIES,		%(TT,SS,NN)= RETURNS AN AND TYPE BNFCOMPONENT
			(TT _ AND; SS _ SUBORDINATE BLOCK ADDRESS;
			NN _ NUMBER OF SUBORDINATE ENTRIES) OR THE
			SUBORDINATE COMPONENT IF THE AND HAD ONLY ONE
			COMPONENT. AND = BNFCOMPONENT *[ BNFCOMPONENT]
			;ALL OF THE BNFCOMPONENTS ARE REQUIRED . SCANS FROM
			THE CURRENT CHARACTER TO THE FIRST ".", ")", "]",
			OR LOWER CASE L (SEPERATES ELEMENTS OF AN OR
			BNFCOMPONENT) ENCOUNTERED AT ITS LEVEL.
			)%
	DEFINITION,	%(TT,SS,NN)= RETURNS A BNFCOMPONENT OF TYPE TERMINAL,
			OR, OPTION, LIST, REPEAT, ACTION, OR META.
			)%
	DECIN;		%(= RETURNS A DECIMAL NUMBER FROM THE TELETYPE AND
			DEFINES START (THE NUMBER OF THE METASYMBOL DEFINITION
			AT WHICH TO START THE TRACE).
			)%
MACHOP	TTCALL =	#051,
	MOVE =	#200,
	SETZ =	#400,
	CAIGE =	#305,
	CAIG =	#307,
	MOVEI =	#201,
	BLT =	#251;
!***************************************************************************
ROUTINE OUTSTR(STR)= IF .STR EQL 0 THEN TTCALL(3,PLIT #064240000000)
				    ELSE TTCALL(3,STR,0,1);
ROUTINE ERROR(MSG)=
BEGIN
	OUTSTR(.MSG);OUTSTR(0);
	OUTZ(LST,CRLF);
	OUTZ(LST,PLIT'****ERROR****');
	OUTZ(LST,CRLF);
	OUTZ(LST,.MSG);
	OUTZ(LST,CRLF);
	DO (TTCALL(1,C);C_CHR()) UNTIL .C EQL "." OR .C EQL -1;
	OUTSTR(0)
END;
!******************************************************************************************************************
ROUTINE DEC(N)=
BEGIN
	LOCAL A;
	A_((.N MOD 10) + "0")^29;
	N_.N / 10;
	IF .N NEQ 0 THEN DEC(.N);
	OUTSTR(A)
END;
!******************************************************************************************************************
ROUTINE PRODUCTIONS =
!BNFDEFINITION	     = METASYMBOL "=" BNFCOMPONENT [ COMMENT ] "." .
BEGIN
	LOCAL L;
	IF TRACE THEN X_0;
	UNTIL (CHR()) LSS 0 DO	!UNTIL EOF
	BEGIN
		!COMMENT	= ";" ASCIISTRING .
		IF .C EQL ";" THEN DO (CHR();IF .C LSS 0 THEN RETURN) UNTIL .C EQL "."
		ELSE
		BEGIN
			IF (L_TABLE (METANAME [0])) LSS 0 THEN RETURN;	!DEFINED SYMBOL
			IF TRACE THEN
				BEGIN
					DEC(X_.X+1);OUTSTR(PLIT' - ');
					OUTSTR(METANAME[.L]);OUTSTR(0);
					IF .X EQL .START THEN CHRSW_1;
				END;
			L_(METANAME[.L]+3)<0,18>_TYPE[0]_.TYPE[0]+1;
			UNTIL .C EQL "=" DO (CHR();IF .C LSS 0 THEN RETURN);
			SERIES (TYPE [.L], SUBP [.L], NUMBER [.L]);
			IF .C EQL #154 % LOWER CASE L % THEN (ERROR(PLIT'OR LIST NOT ENCLOSED IN PARENS');RETURN);
			IF .C EQL ";" THEN DO CHR() UNTIL .C EQL "."
		END
	END
END;
!***************************************************************************
MACRO ALPHANUMERIC(X)=
BEGIN
	REGISTER R1,R2;
	MOVE	(R1,X);	!R1_.X
	SETZ	(R2,0);	!R2_FALSE
	CAIGE	(R1,"A");
	CAIG	(R1,"9");
	MOVEI	(R2,1);	!IF .R1 GEQ "A" OR .R1 LEQ "9" THEN R2_TRUE
	CAIG	(R1,"Z");
	CAIGE	(R1,"0");
	SETZ	(R2,0)	!IF .R1 GTR "Z" OR .R1 LSS "0" THEN R2_FALSE
END$;
!***************************************************************************
ROUTINE TABLE (TABNAME) =
!RETURNS INDEX INTO TABNAME, INSERTS IF NECESSARY
BEGIN
	OWN I: IVAL: J: JVAL: PNTR: PNTR1: TOP;
	STRUCTURE CHRTBL[I]=[I*4](@.CHRTBL + .I*4);
	MAP CHRTBL TABNAME[100];
	TOP_@TABNAME [0];
	TABNAME[.TOP+1]_TABNAME[.TOP+1]+1_TABNAME[.TOP+1]+2_TABNAME[.TOP+1]+3_0;
	PNTR_(TABNAME[.TOP+1]-1)<1,7>;
%(-----------------------------------------------------------------------------------------------------------------