Google
 

Trailing-Edge - PDP-10 Archives - bb-4157j-bm_fortran20_v11_16mt9 - fortran-compiler/f72bnf.syn
There are 12 other files named f72bnf.syn in the archive. Click here to see a list.
;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1974, 1987
;ALL RIGHTS RESERVED.
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
;INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
;COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
;OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
;TRANSFERRED.
;
;THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
;AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
;CORPORATION.
;
;DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
;SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

;AUTHORS: F. INFANTE, J. BELL, D. B. TOLMAN, T.F. VASAK/DCE/CKS/RVM/CDM

        THE SYNTAX OF DECsystem-10/20 FORTRAN 77 IN EXTENDED BNF
                        100-310-044-03
                        JUNE 12,1972

        F72BNFV = #10^24 + 0^18 + #2473      !Version date: 28-Sep-84

***** Begin Revision History *****

***** Begin Version 4B *****

1       334     17420   Correct format of DO statement.

***** Begin Version 5B *****

2       653     25441   Unit number for FIND should allow an array reference,
                        (DCE)

3       741     -----   Add warning for array declaration with a / (slash)
                        sererating the upper and lower bounds, (DCE)

***** Begin Version 6 *****

4       760     TFV     1-Mar-80        -----
        F77 I/O statement changes

***** End Revision History *****

***** Begin Version 7 *****

5       1202    DCE     1-JUL-80        -----
        Change syntax to allow expressions on output lists.

6       1203    DCE     24-Nov-80       -----
        Modify 1102 to do I/O lists correctly with GIOLIST

7       1213    TFV     20-may-81
        Fix ONEARRAY so type declarations are var(subs)*length

8       1233    CKS     27-Jun-81
        Replace [ COMMA ] with %OPTCOMMA% in RWSPEC to avoid ambiguity.
        Also occurs in IOSPEC1 and ENCODECODESPEC.  Add ERREOL action routine
        to prevent "TYPE *," from not parsing and also not typing an error
        message.

9       1256    CKS     8-Sep-81
        Modify COMMONGROUP.  The statement COMMON // X contains what used
        to be two slashes and is now a concatenation lexeme.  Modify the
        syntax to allow this.

10      1262    CKS     18-Sep-81
        Modify syntax of EQUIVALENCE to allow character substrings

11      1271    CKS     9-Oct-81
        Add optional comma in DO statement

12      1277    CKS     20-Oct-81
        Modify GOTOSPEC so optional comma in assigned GOTO works: change
        VARIABLESPEC to IDENTIFIER.

13      1410    CKS     28-Oct-81
        Modify COMMONGROUP to allow the comma in COMMON A,/B/C.
        Modify DATA to allow the comma in DATA A/1/,B/1/ to be omitted.

14      1416    CKS     9-Nov-81
        Modify DATA to allow character substrings in DATA statement
        variable lists.

15      1421    CKS     11-Nov-81
        Allow statement function definitions with zero arguments.

16      1464    RVM     26-Jan-82
        Add INTRINSPEC (the BNF for INTRINSIC statements).

17      1465    CKS     22-Jan-82
        Make the BNF for IOSPEC call action routine KEYSCAN.  IOSPEC is
        the syntax for the control information list in READ and WRITE
        statements, and is too hard to do in BNF.

18      1467    CDM     1-Feb-82
        Add SAVESPEC for parsing the SAVE statement.

1510    RVM     14-Mar-82
        Make ONEARRAY allow a dimension bound of an array to be asterisk.

1527    CKS     1-Apr-82
        Modify ONEARRAY to allow constant expressions in array bounds.
        Modify PARAMSPEC to allow F77 parentheses in parameter statement.

1546    CKS     31-May-82
        Modify IO statements to unify READ/WRITE and TYPE/ACCEPT.  Also
        allow expressions as specifiers in TYPE/ACCEPT and "READ f,list"
        forms.

1573    CKS     1-Jul-82
        Make the statement number in "DO 10 I = ..." be optional.  Add
        syntax of DO WHILE statement.

1575    TFV     7-Jul-82
        Fix ONEARRAY for type declarations.  Allow both 'var * len (subs)'
        and 'var (subs) * len' forms.

1656    CKS     22-Oct-82
        Modify parameter form IDENTIFIER EQUAL %CONSTEXPR% to be %PARMASSIGN%
        so we can allow parameter defs to be used later in the same statement
        that defines them.

1677    CKS     12-Nov-82
        Use ENCSPEC and DECSPEC to parse keyword lists in ENCODE and DECODE.
        Use REWSPEC for REWIND and the rest of the utility statements.  Use
        FINDSPEC for FIND.

***** End Revision History *****

***** Begin Version 10 *********

2461	CDM	28-Sep-84
	Add octal and  hexadecimal constants for  the Military  Standard
	MIL-STD-1753 to DATA statements.
	Add action routine OCTHEX.

2473	CDM	26-Oct-84
	Add IMPLICIT NONE for the Military Standard MIL-STD-1753.
	Add action routine IMPCHK.

ENDV10

                THE  INFORMATION IN  THIS MEMORANDUM IS
                SUBJECT TO CHANGE  WITHOUT  NOTICE  AND
                SHOULD NOT BE CONSTRUED AS A COMMITMENT
                BY   DIGITAL  EQUIPEMENT  CORPORATION .


                             **** NOTE ****

          These are things you should know when changing the BNF!


          Everything before  the  first form  feed  is ignored,  so  all
          global comments,  and  the  revision  history  must  be  fully
          contained on the first logical page.

          Starting with page 2, all comments  must be preceded by a  ";"
          (semicolon) in the  first column,  and terminated  with a  "."
          (dot).

          Do not use tabs for spacing, use spaces instead.  The BNF will
          not accept tabs.  Put spaces around all specifications of  the
          grammar to delimit them.

          The .OR.'s are small case l's (as in lucky).

          All  lines  must   end  in  a   period  (.).   (Comments   and
          productions.)

          Action routines are not robust.   There are cases with  action
          routines which will not work  unless the front-end is  "beefed
          up".  An example is: (%A% l  %B%).  The problem is that  there
          are two routines present in the  .OR..  There is only room  at
          present  for  one  action  routine  in  the  lookahead  table.
          Putting one  down  in  a separate  production  does  not  work
          either, the table generators notice this.
;                                                     100-310-044-03
                                                        PAGE 02
.
;THE COMPONENTS OF THE MODIFIED BNF SYNTAX USED IN THE PRODUCTIONS ON THE FOLLOWING PAGES .

BNFDEFINITION      = METASYMBOL "="  BNFCOMPONENT  [ COMMENT ] "." .

BNFCOMPONENT       = ( TERMINAL l
                     METASYMBOL l
                     ONE l
                     ALL l
                     OPTION l
                     LIST l
                     REPEAT l
                     ACTION ) .

TERMINAL           = """ *ALPHANUMERIC """ ;TERMINAL CHARACTER STRING .

METASYMBOL         = [ *LETTER  "-" ] *LETTER  ;AN ELEMENT
                     OF THE SYNTAX DEFINED BY THE SYNTAX OR BY A LEXICAL
                     PROCESS .

ONE                = "(" BNFCOMPONENT *[ "l" BNFCOMPONENT ] ")" 
                     ;ONLY ONE OF THE BNFCOMPONENTS IS REQUIRED .

ALL                = BNFCOMPONENT *[ BNFCOMPONENT ] ;ALL OF THE
                     BNFCOMPONENTS ARE REQUIRED .

OPTION             = "[" BNFCOMPONENT "]" ;USE OF THE BNFCOMPONENT IS
                     OPTIONAL .

LIST               = "+" BNFCOMPONENT ;BNFCOMPONENTS SEPERATED BY
                     COMMAS .

REPEAT             = "*" BNFCOMPONENT ;BNFCOMPONENTS NOT SEPERATED BY
                     COMMAS .

ACTION             = "%" ACTIONNAME "%" ;ACTION TO BE PERFORMED WHEN ENCOUNTERED .

COMMENT            = ";" *ASCIICHARACTER .

;*****************************************************************************************************************
;                                                     100-310-044-03
                                                        PAGE 03
.
;FORTRAN-10 SYNTAX IN MODIFIED BNF .

EXPRESSION     = %EXPRESS% .

VARIABLESPEC       = IDENTIFIER %NOLABELS% [ LPAREN +%EXPRESS% RPAREN ] .

DATA               = *( [ COMMA ] +DATAITEM VALUELIST ) LINEND .
; (This production permits a comma before the first DATALIST as in
        DATA, A/1/
   This error is caught in the semantic routine) .

;FORMAT             = %FORMATSYN% .

; INTEGERSPEC        = DECLARESPEC LINEND .

; REALSPEC           = DECLARESPEC LINEND .

; LOGICALSPEC        = DECLARESPEC LINEND .

; DOUBLEPRECISION    = DECLARESPEC LINEND .

; COMPLEXSPEC        = DECLARESPEC LINEND .

DECLARESPEC        = ( FUNCTIONSPEC l TYPELIST )  LINEND .

FUNCTIONSPEC       = %FUNCTIONSCAN% SUBPROGRAMID .

PARAMSPEC          = %PARMLPAREN% +%PARMASSIGN% %PARMRPAREN% LINEND . 
;                                                     100-310-044-03
                                                        PAGE 04
.
; PROGRAM            =  [ IDENTIFIER ] LINEND .

; BLOCKDATA          =  [ IDENTIFIER ] LINEND .

DIMENSION          = +ONEARRAY LINEND .

SUBROUTINE         = SUBPROGRAMID  LINEND  .  

COMMON             = *COMMONGROUP LINEND .

EQUIVALENCE        = +( LPAREN SUBVARSPEC COMMA +SUBVARSPEC RPAREN ) LINEND .

SUBVARSPEC          = IDENTIFIER %NOLABELS% [ LPAREN
                           %COLNEXP% ( COLON %RPAREXP% RPAREN
                                     l COMMA +%EXPRESS% RPAREN [ SUBSTRSPEC ]
                                     l RPAREN [ SUBSTRSPEC ] ) ] .

SUBSTRSPEC         = LPAREN %COLNEXP% COLON %RPAREXP% RPAREN .

EXTERNSPEC         = +( [ ANDSGN l  ASTERISK  ]  IDENTIFIER  )   LINEND  . 

INTRINSPEC         = +IDENTIFIER LINEND .

; INCLUDESPEC        = LPAREN [ UNITSPEC COMMA ] ( LITSTRING l VARIABLESPEC ) RPAREN LINEND .

;[2473] IMPLICIT  NONE   -  Action   routine   IMPCHK  was   added   with
;[2473] (<implicitspec>) made optional,  since specifying the  characters
;[2473] "NONE" does not work in the BNF - TYPEID reads the NONE, sets  up
;[2473] a global variable (IMPNON) for IMPCHK  to read - If NONE is  seen
;[2473] then IMPCHK fails and we can't have the optional (<implicitspec>)
;[2473] -  If   NONE   isn't   seen,  IMPCHK   returns   true   and   the
;[2473] (<implicitspec>) is no longer optional.

IMPLICIT           = +( %TYPEID% [ %IMPCHK% LPAREN +%IMPLICITSPEC% RPAREN ] ) 
                     LINEND .

SAVESPEC           = [ +( IDENTIFIER l SLASH IDENTIFIER SLASH ) ] LINEND .

; PROTECT            = +ONEARRAY LINEND .

; GLOBALSPEC         = +ONEARRAY LINEND .

NAMELIST           = *( SLASH IDENTIFIER SLASH +IDENTIFIER ) LINEND .

; IMPLICITSPEC       = %LETTER% [ DASH %LETTER% ] .
 
;TYPEID             = ( "SUBSCRIPTINTEGER" l "DOUBLEPRECISION" l
;                     ( "INTEGER" l "REAL" l "LOGICAL" l "COMPLEX" l "BIT" ) [ TIMES CONSTANT ] ) %SETTYPE% .

DATAITEM           = (  SUBVARSPEC l  LPAREN +DATAITEM [ LOOPPART ] RPAREN )  .

OUTPLIST           = %NOTEOL% %GIOLIST% .

LOOPPART           = EQUAL %EXPRESS% COMMA %EXPRESS% [ COMMA %EXPRESS% ] .

SUBPROGRAMID       = IDENTIFIER %PNAMSET% [ LPAREN [ +( IDENTIFIER l ASTERISK l DOLLAR l ANDSGN ) ] RPAREN ]  .

ONEARRAY           = IDENTIFIER %ASTERTYPE% [ 
                     LPAREN +( %ASTEREXPR% [ COLON %ASTEREXPR% ] ) 
                     RPAREN ]  %ASTERTYPE% .

TYPELIST           = +( +ONEARRAY  [ VALUELIST ] ) .

;[2461]	 Octal or hexidecimal constants are allowed for DATA statements;
 O'<octalnumbers>' and Z'<hexnumbers>' is  allowed, <number> *  <octhex>
 is allowed (the case of a repeat count), +/- contstant is not, the  BNF
 does NOT work well for this case with an action routine (when I  tried,
 it was calling the action  routine TWICE because the artificial  lexeme
 created for the action routine was strange and bizarre); Beware if  you
 change this.

VALUELIST          = SLASH 
                         +( %OCTHEX%
                            l LITSTRING
                            l [ PLUS l MINUS ] 
                              ( CONSTLEX [ TIMES ( %OCTHEX% 
                                                   l LITSTRING 
                                                   l [ PLUS l MINUS ] 
                                                       ( CONSTLEX
                                                         l CMPLEXCON )   
                                                 )   
                                         ]
                                l CMPLEXCON )
                          )
                     SLASH  . 

CMPLEXCON          = LPAREN [ PLUS l MINUS ] CONSTLEX COMMA [ PLUS l MINUS ] CONSTLEX RPAREN .
;                                                     100-310-044-03
                                                        PAGE 05
.
COMMONGROUP        = [ SLASH IDENTIFIER SLASH l CONCAT ] +( ONEARRAY %CMNCOMMA% ) .

ASSIGN             = %LABELS% LABELEX %TOQUOTE% VARIABLESPEC LINEND .

GOTO               =  %LABELS% ( LABELEX l GOTOSPEC ) LINEND .

CALL               = IDENTIFIER [ LPAREN %EXPRLIST% RPAREN ] LINEND .

; RETURNSPEC         = [ %EXPRESS% ] LINEND .

;CONTINUE          = LINEND .

; STOP               = [ LITSTRING l CONSTLEX ] LINEND .

; PAUSE              = [ LITSTRING l CONSTLEX ] LINEND .

;END                 = LINEND .

RWSPEC               = %KEY1SPEC%  [ %OPTCOMMA% +OUTPLIST ] LINEND .

IOSPEC1              = %KEY4SPEC% [ %OPTCOMMA% +OUTPLIST ] LINEND .

; ACCEPT             = %LABELS% FORMATID [ COMMA +OUTPLIST ] LINEND .

; PUNCH              = %LABELS% FORMATID [ COMMA +OUTPLIST ] LINEND .

; WRITESPEC          = %LABELS% ( IOSPEC l FORMATID ) [ %OPTCOMMA% +OUTPLIST ] LINEND .

; PRINT              = %LABELS% FORMATID [ COMMA  +OUTPLIST ] LINEND .

; TYPESPEC           = %LABELS% FORMATID [ COMMA  +OUTPLIST ] LINEND .

; ENCODE             = ENCODECODESPEC LINEND .

; DECODE             = ENCODECODESPEC LINEND .

; REREAD             = %LABELS% FORMATID [ COMMA +OUTPLIST ] LINEND .
;                                                     100-310-044-03
                                                        PAGE 06
.
; BACKSPEC           = UTILSPEC .

;  REWIND             = UTILSPEC .

; UNLOAD             = UTILSPEC .

; ENDFILESPEC        = UTILSPEC .

; SKIPSPEC           = UTILSPEC  .

; OPEN               = LPAREN +( IDENTIFIER EQUAL ( VARIABLESPEC l CONSTANT l LITSTRING ) ) RPAREN LINEND .

; CLOSESPEC          = LPAREN ( CONSTANT l VARIABLESPEC )
;                     *[ COMMA IDENTIFIER EQUAL ( VARIABLESPEC l LITSTRING ) ] RPAREN LINEND .

FIND               = LPAREN %FINDSPEC% RPAREN LINEND .

; KEYSPEC          = %NOLABELS% +( IDENTIFIER  EQUAL ( CONSTLEX l VARIABLESPEC l ASTERISK ) ) .

; KEYORUNIT        = %NOLABELS% ( CONSTLEX [ %RECORDMARK% %EXPRESS% ] l 
                   IDENTIFIER [ %RECORDMARK% %EXPRESS% l EQUAL ( CONSTLEX l VARIABLESPEC l ASTERISK ) ] ) .

; KEYORFMT       = %LABELS% ( LABELEX l VARIABLESPEC [ EQUAL %NOLABELS% ( CONSTLEX l VARIABLESPEC l
                     ASTERISK ) ] l ASTERISK ) .

GOTOSPEC           = ( IDENTIFIER [ [ COMMA ] LPAREN +( %LABELS% LABELEX ) RPAREN ] l
                     LPAREN +( %LABELS% LABELEX ) RPAREN [ COMMA ] %EXPRESS% ) .

ENCODECODESPEC     = LPAREN %ENCDECSPEC% RPAREN [ %OPTCOMMA% +OUTPLIST ] LINEND .

; FORMATID           =   ( LABELEX l IDENTIFIER  l ASTERISK ) .

; ACTUALARG          = ( %EXPRESS%  l DOLLAR CONSTLEX ) .


; REPEATEXPR         = +( [ LPAREN ] ( CONSTLEX l VARIABLESPEC ) [ RPAREN ] [ LPAREN ( CONSTLEX l VARIABLESPEC ) RPAREN ] ) .

UTILSPEC         = %REWSPEC% LINEND .
;                                                     100-310-044-03
                                                        PAGE 07
.
STATEFUNCSPEC      = LPAREN  ( RPAREN  l  %NULLCHECK% +%SUBLOCAL% RPAREN )  EQUAL %EXPRESS% LINEND .

ARRAYASSIGNSPEC    = LPAREN +%EXPRESS% RPAREN   EQUAL %EXPRESS%  LINEND .

LOGICALIFSPEC      = LPAREN %EXPRESS% RPAREN .

ARITHIFSPEC        = LPAREN %EXPRESS% RPAREN %LABELS% LABELEX COMMA %LABELS% LABELEX [ COMMA %LABELS% LABELEX ] LINEND .

ASSIGNSPEC         = IDENTIFIER  EQUAL %EXPRESS%  LINEND .

DOSPEC             = %LABELS% [ LABELEX [ COMMA ] ] %NOLABELS% IDENTIFIER EQUAL
                     %EXPRESS% COMMA %EXPRESS% [ COMMA %EXPRESS% ] LINEND .

DOWHILE            = %LABELANDWHILE% LPAREN %EXPRESS% RPAREN LINEND .