! PATBLSEXT.REQ ! IDENT('X2.0-001') ! ! !++ ! FACILITY: PAT Parser ! ! ABSTRACT: ! ! PATBLSEXT.REQ is the specification for BLISS ! extentions used by the parser. ! ! It also defines the conditionals used for conditional ! compilation tests. ! ! This file is generally language independent although ! some applications may wish to change the manner in ! which the conditionals for conditional compilation are ! implemented. ! ! ENVIRONMENT: VAX/VMS user mode ! ! AUTHOR: H. Alcabes, CREATION DATE: 17-Feb-81 ! ! MODIFIED BY: ! ! Charlie Mitchell, 26-Oct-1981, VERSION X2.0-001 ! 001 - Add macros PATBLSEXT_DEBUGGING and PATBLSEXT_LOCAL_RECOVERY. ! Modify enumeration macro so that can have zero enumeration ! values. Incorporate various modifications for SD_ definitions ! from Brian Hetrick and Becky Will (BASIC). ! !-- macro PATBLSEXT_DEBUGGING = !+ ! Debugging code is generated if this macro has the value ! TRUE. Normally debugging code is generated if running ! BLISS-32 with /DEB unless /VARIANT=1. The /VARIANT option ! permits compilation with Debug symbol table records but without ! the parser debugger. !- (%switches (debug) and %bliss (bliss32) and (%variant neq 1)) %; macro PATBLSEXT_LOCAL_RECOVERY = !+ ! Code is generated to do local error recovery if this ! macro has value TRUE. !- (%bliss (bliss32)) %; macro PATBLSEXT_EXTRA_STACK_FIELD = !+ ! If this macro has value TRUE, an additional field is ! allocated in each element of the parse stack to permit ! application specific information in lexical tokens to be ! associated with particular items in the stack. ! ! Ada uses this field to associate comments with the parse ! stack. A macro in PAT_LANGSP_LIBRARY called LS_LEX_EXTRA_INFO ! returns information from a lexical token that is placed ! this field. See PATPARSER.REQ for information on how ! to access the stacked extra info. !- (%bliss (bliss32)) %; literal NULL = 0; literal TRUE = 1, FALSE = 0; macro ZEROBYTE (CNT, DST) = ch$fill (0, (CNT), (DST)) %; ! ! ! Declarations for manipulations of string descriptors ! %if %bliss (bliss16) %then field SD_BASE = [0, 0, 16, 0], SD_LENGTH = [4, 0, 16, 0], SD_TEXT = [0, 0, 16, 0]; literal SD_SIZE = 4; %else field SD_BASE = [0, 0, 32, 0], SD_LENGTH = [0, 0, 32, 0], SD_TEXT = [4, 0, 32, 0]; literal SD_SIZE = 8; %fi macro SD_FIELDS = SD_BASE, SD_LENGTH, SD_TEXT %; macro SD_STR = block [SD_SIZE, byte] field (SD_FIELDS) %; macro SD_VAL (ST) = ! Create string descriptor for string literal ST %if %bliss (bliss16) %then uplit byte(%string (ST, %remaining)), %charcount (ST, %remaining) %else %charcount(ST, %remaining), uplit byte(%string (ST, %remaining)) %fi %; macro SD_NULL_STRING = ! String descriptor for a null string 0, 0 %; macro SD_REF (ST) = ! Create a pointer to a string descriptor for string literal ST uplit (SD_VAL (ST, %remaining)) %; macro SD_STRING_EQUAL (S1, S2) = begin local D1 : ref SD_STR, D2 : ref SD_STR; D1 = S1; D2 = S2; ch$eql (.D1 [SD_LENGTH], .D1 [SD_TEXT], .D2 [SD_LENGTH], .D2 [SD_TEXT]) end %; ! ! ! Macro to define enumeration types: ! ! Example: ! ! ENUMERATION('ARITY',0,NULLARY,UNARY,BINARY,TERNARY,LIST); ! ! Generates: ! ! LITERAL ! FIRST_ARITY =0, ! NULLARY =0, ! UNARY =1, ! BINARY =2, ! TERNARY =3, ! LIST =4, ! LAST_ARITY =4; macro ENUMERATION (TYPE, STARTVAL) [] = compiletime %name (TYPE) = (STARTVAL); %if %null (%remaining) %then literal %name ('FIRST_', TYPE) = (STARTVAL), %name ('LAST_', TYPE) = (STARTVAL) - 1; %else literal %name ('FIRST_', TYPE) = (STARTVAL), ENUM1 (%name (TYPE), %remaining), %name ('LAST_', TYPE) = %name (TYPE) - 1; %fi %; macro ENUM1 (COUNTER) [ENUMLIT] = %name (ENUMLIT) = COUNTER %assign(COUNTER, COUNTER + 1) %; ! End of PATBLSEXT.REQ