%{ #include #include "inc.h" #include "extern.h" #include "defines.h" #include "fdvm.h" #include "fm.h" /* We may use builtin alloca */ #include "compatible.h" #ifdef _NEEDALLOCAH_ # include #endif #define EXTEND_NODE 2 /* move the definition to h/ files. */ extern PTR_BFND global_bfnd, pred_bfnd; extern PTR_SYMB star_symb; extern PTR_SYMB global_list; extern PTR_TYPE global_bool; extern PTR_TYPE global_int; extern PTR_TYPE global_float; extern PTR_TYPE global_double; extern PTR_TYPE global_char; extern PTR_TYPE global_string; extern PTR_TYPE global_string_2; extern PTR_TYPE global_complex; extern PTR_TYPE global_dcomplex; extern PTR_TYPE global_gate; extern PTR_TYPE global_event; extern PTR_TYPE global_sequence; extern PTR_TYPE global_default; extern PTR_LABEL thislabel; extern PTR_CMNT comments, cur_comment; extern PTR_BFND last_bfnd; extern PTR_TYPE impltype[]; extern int nioctl; extern int maxdim; extern long yystno; /* statement label */ extern char stmtbuf[]; /* input buffer */ extern char *commentbuf; /* comments buffer from scanner */ extern PTR_BLOB head_blob; extern PTR_BLOB cur_blob; extern PTR_TYPE vartype; /* variable type */ extern int end_group; extern char saveall; extern int privateall; extern int needkwd; extern int implkwd; extern int opt_kwd_hedr; /* added for FORTRAN 90 */ extern PTR_LLND first_unresolved_call; extern PTR_LLND last_unresolved_call; extern int data_stat; extern char yyquote; extern int warn_all; extern int statement_kind; /* kind of statement: 1 - HPF-DVM-directive, 0 - Fortran statement*/ int extend_flag = 0; static int do_name_err; static int ndim; /* number of dimension */ /*!!! hpf */ static int explicit_shape; /* 1 if shape specification is explicit */ /* static int varleng;*/ /* variable size */ static int lastwasbranch = NO; /* set if last stmt was a branch stmt */ static int thiswasbranch = NO; /* set if this stmt is a branch stmt */ static PTR_SYMB type_var = SMNULL; static PTR_LLND stat_alloc = LLNULL; /* set if ALLOCATE/DEALLOCATE stmt has STAT-clause*/ /* static int subscripts_status = 0; */ static int type_options,type_opt; /* The various options used to declare a name - RECURSIVE, POINTER, OPTIONAL etc. */ static PTR_BFND module_scope; static int position = IN_OUTSIDE; static int attr_ndim; /* number of dimensions in DIMENSION (array_spec) attribute declaration */ static PTR_LLND attr_dims; /* low level representation of array_spec in DIMENSION (array_spec) attribute declarartion. */ static int in_vec = NO; /* set if processing array constructor */ %} %union { int token; char charv; char *charp; PTR_BFND bf_node; PTR_LLND ll_node; PTR_SYMB symbol; PTR_TYPE data_type; PTR_HASH hash_entry; PTR_LABEL label; } /* * gram.head * * First part of the Fortran grammar * */ /* Specify precedences and associativities. */ %left COMMA %nonassoc COLON %right EQUAL %left DEFINED_OPERATOR %left BINARY_OP %left EQV NEQV %left OR XOR %left AND %left NOT %nonassoc LT GT LE GE EQ NE %left DSLASH %left PLUS MINUS %left ASTER SLASH %right DASTER %nonassoc UNARY_OP %start program %type addop stop att_type %type letter %type filename %type name opt_unit_name %type progname blokname args arg arglist call comblock namelist_group %type program stat spec exec iffable goto logif %type dcl implicit data common dimension external intrinsic attrib %type equivalence namelist type_dcl end_type static %type intent optional public private sequence allocatable pointer target %type implist impitem %type paramlist paramitem %type dim dims dimlist ubound funarglist funarg funargs opt_expr var %type labellist expr uexpr lhs simple_const lengspec substring %type complex_const vec triplet %type dospec use_name_list %type do_var %type