
Description: Ada:  YACC and LEX Sources (Part 1 of 1)             
From: MRGATE!INFO  Date:  5-DEC-1987

From: CSBVAX::MRGATE!INFO-ADA-REQUEST@SIMTEL20.ARPA@SMTP
Received: from ajpo.sei.cmu.edu by SIMTEL20.ARPA with TCP; Tue, 1 Dec 87 20:44:2
6 MST
Received: by ucbvax.Berkeley.EDU (5.58/1.26)
	id AA05714; Tue, 1 Dec 87 18:50:08 PST
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-ada@ajpo.sei.cmu.edu (info-ada@ajpo.sei.cmu.edu)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 1 Dec 87 19:45:52 GMT
From: shamash!jwabik@umn-cs.arpa  (Jeff Wabik)
Organization: Control Data Corporation, Bloomington, MN.
Subject: Ada:  YACC and LEX Sources (Part 1 of 1)
Message-Id: <1167@shamash.UUCP>
Sender: info-ada-request@ajpo.sei.cmu.edu
To: info-ada@ajpo.sei.cmu.edu
 
 
In the last 10 days I've received about 20 requests to repost the YACC
and LEX goodies for ADA, so here they are again ..  Watch the warnings
and read the READMEs ...  There are definitely a few problems with the
regular expressions defining numerics in the LEX, but, they are obscure
types of errors that accept things they shouldn't rather than not
accepting things that should be.  I'm waaaay busy right now, but will
look at these soon... Of course, if you'd like to fix 'em and send ME
the changes..  ;-)
 
Thanks to those who have sent in bug fixes..   Keep them coming.  I'll
be happy to continue as a moderator for these sources (i.e. I'll make
the fixes and redistribute) should there be the demand.  Good luck!
 
	-Jeff
 
---
Jeff A. Wabik @ Control Data Corporation          Bloomington, MN  55440
UUCP: {rosevax,umn-cs,meccts,ems}!shamash!jwabik  ARPA: jwabik@ub.d.umn.edu
Disclaimer:  My employer doesn't know anything about this.  Shhhhhh.
 
			   Live long and program.
 
 
 
 
------ Cut Here -------------- Cut Here ---------- Cut Here ------------------
echo x - README
sed 's/^X//' >README <<'*-*-END-of-README-*-*'
X
X
X	From:  Jeff Wabik
X	       { umn-cs!shamash!jwabik }
X	       December, 1987
X
X
X
X
XThe Table sizes needed for YACC are as follows:
X
X95/6000 terminals, 238/600 nonterminals
X459/1000 grammar rules, 859/1250 states
X0 shift/reduce, 0 reduce/reduce conflicts reported
X238/700 working sets used
Xmemory: states,etc. 4122/24000, parser 3113/12000
X599/1200 distinct lookahead sets
X946 extra closures
X1234 shift entries, 65 exceptions
X570 goto entries
X1413 entries saved by goto default
XOptimizer space used: input 3372/24000, output 1146/12000
X1146 table entries, 0 zero
Xmaximum spread: 333, maximum offset: 856
X
X
XIf your YACC isn't big enough and you DO have the sources, dig around
Xin /usr/src/usr.bin/yacc and play with the "dextern" file.  As you can
Xsee, my YACC has been converted to a Super-YACC.  
X
XThere is a missing routine called "yyerror".  yyerror should look something
Xlike this:
X
X	yyerror(string)
X	char *string;
X	{
X
X		 extern int yylineno;
X
X		 fprintf(stderr,"Syntax error at line %d near %s.\n",
X			 yylineno,yytext);
X		 if (dABORT)
X		    exit(dSYN_ERROR);
X		 else
X		    return(0);
X
X	}
X
XTake a CLOSE look at memory management in the LEX (i.e.  There is none.)  Each 
Xreturned IDENTIFIER makes a call to calloc() that is never ever cfree()'ed.  
XHow you're going to feed memory to the "$$" and "$?" specs in YACC is up
Xto you, but be warned that if you dont have a virtual machine, this version
Xwill never free up allocated memory.
X
XIf you have questions about what more I did to this, or how my routines
Xwork, please feel free to contact  me:
X
X	Jeff Wabik
X	Control Data Corporation
X	2800 E. Old Shakopee Road
X	Bloominton, MN  55420
X	(612) 853-6811
X
X	{ umn-cs \
XUUCP:		   !shamash!jwabik }
X	{ meccts /
X
X
X=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
XOfficial Disclaimer:
X
XControl Data Corporation is not responsible in any way for the contents of
Xthis Ada Language specification, nor does CDC make a commitment to the 
Xsupport of this Public Domain grammar.  What you see is what you get.
X=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
X
XHope my mods can be helpful to others.  Happy hacking!
X
X			-Jeff
X
*-*-END-of-README-*-*
echo x - ada.l
sed 's/^X//' >ada.l <<'*-*-END-of-ada.l-*-*'
X%{
X/*------------------------------------------------------------------------*/
X/* Lexical input for LEX for LALR(1) Grammar for ANSI Ada                 */
X/*                                                                        */
X/*              Herman Fischer                                            */
X/*            Litton Data Systems                                         */
X/*              March 26, 1984                                            */
X/*                                                                        */
X/* Rewrite:  To a version that a non-supercomputer can handle (8^) by:	  */
X/*           Jeff Wabik, Control Data Corporation, December 1987	  */ 
X/*	     { umn-cs!shamash!jwabik }				 	  */
X/*                                                                        */
X/*------------------------------------------------------------------------*/
X#include "y.tab.h"
X#include <stdio.h>
X#include <ctype.h>
X
X#define Token(a)	(int)a
X
X%}
X
XStringLetter		([^\n']|'')
XWS			([\t\n ])
XWord			([^\n^ ^\t']|'')
X
X%START IDENT Z
X
X%%
X"--".*  ECHO;       		/* ignore comments to end-of-line */
X[\ \t\n]		ECHO;  	/* ignore spaces and tabs */
X"=>"    		{ECHO; BEGIN Z; return(ARROW_);}
X".."    		{ECHO; BEGIN Z; return(DBLDOT_);}
X"**"    		{ECHO; BEGIN Z; return(EXP_);}
X":="    		{ECHO; BEGIN Z; return(ASSIGN_);}
X"/="    		{ECHO; BEGIN Z; return(NOTEQL_);}
X">="    		{ECHO; BEGIN Z; return(GTEQL_);}
X"<="    		{ECHO; BEGIN Z; return(LTEQ_);}
X"<<"    		{ECHO; BEGIN Z; return(L_LBL_);}
X">>"    		{ECHO; BEGIN Z; return(R_LBL_);}
X"<>"    		{ECHO; BEGIN Z; return(BOX_);}
X"&"     		{ECHO; BEGIN Z; return('&'); }
X"("     		{ECHO; BEGIN Z; return('('); }
X")"     		{ECHO; BEGIN IDENT; return(')'); }
X"*"     		{ECHO; BEGIN Z; return('*'); }
X"+"     		{ECHO; BEGIN Z; return('+'); }
X","     		{ECHO; BEGIN Z; return(','); }
X"-"     		{ECHO; BEGIN Z; return('-'); }
X"."     		{ECHO; BEGIN Z; return('.'); }
X"/"     		{ECHO; BEGIN Z; return('/'); }
X":"     		{ECHO; BEGIN Z; return(':'); }
X";"     		{ECHO; BEGIN Z; return(';'); }
X"<"     		{ECHO; BEGIN Z; return('<'); }
X"="     		{ECHO; BEGIN Z; return('='); }
X">"     		{ECHO; BEGIN Z; return('>'); }
X"|"     		{ECHO; BEGIN Z; return('|'); }
X<IDENT>\'  		{ECHO; BEGIN Z; return('\'');}   /* type mark only */
X
X
X[a-z_A-Z][a-z_A-Z0-9]*  	{ ECHO; BEGIN IDENT; return(LookUp(yytext));}
X
X[0-9][0-9_]*([.][0-9_]+)?([Ee][-+]?[0-9_]+)?  
X				{ ECHO; BEGIN Z; return(NUMERIC_LITERAL);}
X
X[0-9][0-9_]*#[0-9a-fA-F_]+([.][0-9a-fA-F_]+)?#([Ee][-+]?[0-9_]+)? 
X				{ ECHO; BEGIN Z; return(NUMERIC_LITERAL);}
X
X
X\"([^"]*(\"\")*)*\" 		{ECHO; BEGIN Z; return(STRING_LITERAL);}
X
X<Z>\'([^']|\'\')\'    		{ECHO; BEGIN Z; return(CHARACTER_LITERAL);}
X
X
X.       			{ECHO; 
X				 printf("Syntax error \"%s\" at line %d.\n\t",
X					 yytext,yylineno); }
X%%
X
Xtypedef struct token_struct {
X   char *token;
X   int tokval;
X} TOKEN;
X
Xyywrap() {
X	return(1);
X}
X
XLookUp(key) 
Xchar *key; 
X/*
X	 Compare what was just read in by LEX to the literal form
X	 of the reserved word..  If its OK, return the TOKEN of the 
X	 reserved word, else return the IDENTIFIER token.
X*/
X{
X	 TOKEN *tokpnt;
X	 extern TOKEN tokens[];
X	 extern unsigned num_tokens;
X	 int TokenCmp();
X	 extern char *MakeUpper();
X
X	 if ((tokpnt = (TOKEN *)bsearch(MakeUpper(key), tokens,num_tokens,
X	      sizeof(TOKEN), TokenCmp)) != NULL)
X	    return(tokpnt->tokval);
X	 else {
X	    yylval.y_str = (char *) calloc(strlen(yytext)+1,sizeof(char));
X	    strcpy(yylval.y_str,yytext);
X	    return(IDENTIFIER);
X	 }
X}
X
Xint TokenCmp(str,tab_ele)
Xchar str[];
XTOKEN *tab_ele;
X{
X	 return(strcmp(str,tab_ele->token));
X}
X
Xchar *MakeUpper(str)
Xchar str[];
X{
X
X	 register int i;
X	 static char up_str[256];
X
X	 for (i=0; str[i] != '\0'; i++)
X	    if (islower(str[i]))
X	       up_str[i] = toupper(str[i]);
X	    else
X	       up_str[i] = str[i];
X	 up_str[i] = '\0';
X	 return up_str;
X}
X
XTOKEN tokens[] = {
X   "ABORT", Token(ABORT_),
X   "ABS", Token(ABS_),
X   "ACCEPT", Token(ACCEPT_),
X   "ACCESS", Token(ACCESS_),
X   "ALL", Token(ALL_),
X   "AND", Token(AND_),
X   "ARRAY", Token(ARRAY_),
X   "AT", Token(AT_),
X   "BEGIN", Token(BEGIN_),
X   "BODY", Token(BODY_),
X   "CASE", Token(CASE_),
X   "CONSTANT", Token(CONSTANT_),
X   "DECLARE", Token(DECLARE_),
X   "DELAY", Token(DELAY_),
X   "DELTA", Token(DELTA_),
X   "DIGITS", Token(DIGITS_),
X   "DO", Token(DO_),
X   "ELSE", Token(ELSE_),
X   "ELSIF", Token(ELSIF_),
X   "END", Token(END_),
X   "ENTRY", Token(ENTRY_),
X   "EXCEPTION", Token(EXCEPTION_),
X   "EXIT", Token(EXIT_),
X   "FOR", Token(FOR_),
X   "FUNCTION", Token(FUNCTION_),
X   "GENERIC", Token(GENERIC_),
X   "GOTO", Token(GOTO_),
X   "IF", Token(IF_),
X   "IN", Token(IN_),
X   "IS", Token(IS_),
X   "LIMITED", Token(LIMITED_),
X   "LOOP", Token(LOOP_),
X   "MOD", Token(MOD_),
X   "NEW", Token(NEW_),
X   "NOT", Token(NOT_),
X   "NULL", Token(NULL_),
X   "OF", Token(OF_),
X   "OR", Token(OR_),
X   "OTHERS", Token(OTHERS_),
X   "OUT", Token(OUT_),
X   "PACKAGE", Token(PACKAGE_),
X   "PRAGMA", Token(PRAGMA_),
X   "PRIVATE", Token(PRIVATE_),
X   "PROCEDURE", Token(PROCEDURE_),
X   "RAISE", Token(RAISE_),
X   "RANGE", Token(RANGE_),
X   "RECORD", Token(RECORD_),
X   "REM", Token(REM_),
X   "RENAMES", Token(RENAMES_),
X   "RETURN", Token(RETURN_),
X   "REVERSE", Token(REVERSE_),
X   "SELECT", Token(SELECT_),
X   "SEPARATE", Token(SEPARATE_),
X   "SUBTYPE", Token(SUBTYPE_),
X   "TASK", Token(TASK_),
X   "TERMINATE", Token(TERMINATE_),
X   "THEN", Token(THEN_),
X   "TYPE", Token(TYPE_),
X   "USE", Token(USE_),
X   "WHEN", Token(WHEN_),
X   "WHILE", Token(WHILE_),
X   "WITH", Token(WITH_),
X   "XOR", Token(XOR_),
X};
X
Xunsigned num_tokens = sizeof(tokens)/sizeof(TOKEN);
*-*-END-of-ada.l-*-*
echo x - ada.y
sed 's/^X//' >ada.y <<'*-*-END-of-ada.y-*-*'
X/*--------------------------------------------------------------------------*/
X/*									    */
X/*			 A LALR(1) grammar for ANSI Ada*		    */
X/*									    */
X/*			 Adapted for YACC (UNIX) Inputs 		    */
X/*									    */
X/*                                                                          */
X/*                             Herman Fischer                               */
X/*                           Litton Data Systems                            */
X/*                       8000 Woodley Ave., ms 44-30                        */
X/*                              Van Nuys, CA                                */
X/*                                                                          */
X/*                              818/902-5139                                */
X/*                           HFischer@eclb.arpa                             */
X/*                        {cepu,trwrb}!litvax!fischer                       */
X/*                                                                          */
X/*                             March 26, 1984                               */
X/*									    */
X/*                   A Contribution to the Public Domain                    */
X/*                                   for                                    */
X/*            Research, Development, and Training Purposes Only             */
X/*                                                                          */
X/*       Any Corrections or Problems are to be Reported to the Author       */
X/*                                                                          */
X/*                                                                          */
X/*                                                                          */
X/*                                                                          */
X/*  Mods to the original: Jeff Wabik, Control Data Corporation		    */
X/*  December, 1987:  Mainly reformatted to make the YACC readable          */
X/*  { umn-cs!shamash!jwabik }					    	    */
X/*  Disclaim:  CDC is not responsible.					    */
X/*                                                                          */
X/*  Note that Herm Fischer's new address, effective 9/23/87, is:            */
X/*  { hermix!fischer@rand-unix.ARPA }					    */
X/*  { {ihnp4,decvax,trwrb,seismo,etc.}!hermix!fischer }			    */
X/*                                                                          */
X/*                                                                          */
X/*                                                                          */
X/*                                                                          */
X/*                              adapted from                                */
X/*                              the grammar                                 */
X/*                                  by:                                     */
X/*									    */
X/*            Gerry Fisher                         Philippe Charles         */
X/*                                                                          */
X/*    Computer Sciences Corporation     &             Ada  Project          */
X/*         4045 Hancock Street                     New York University      */
X/*         San Diego, CA 92121                      251 Mercer Street       */
X/*                                               New York, New York 10012   */
X/*									    */
X/*									    */
X/*    This grammar is organized in the same order as the syntax summary     */
X/* in appendix E of the ANSI Ada Reference Manual.   All reserved words     */
X/* are	 written  in  upper  case  letters.    The  lexical  categories     */
X/* NUMERIC_LITERAL, STRING_LITERAL, etc, are viewed as terminals.   The     */
X/* rules  for  pragmas as  stated in  chapter 2,  section 8,  have been     */
X/* incorporated in the grammar.   Comments are included wherever we had     */
X/* to deviate from the syntax given in appendix E. Different symbols	    */
X/* used here (to comply with yacc requirements) are of note:		    */
X/*	{,something}	is denoted ...something..			    */
X/*	{something}	is denoted ..something..			    */
X/*	[something]	is denoted .something.				    */
X/* Constructs involving                                                     */
X/* meta brackets, e.g., ...IDENTIFIER.. are represented by a nonterminal    */
X/* formed  by  concatenating  the  construct symbols ( as ...IDENTIFIER..   */
X/* in the example)   for  which  the  rules are given at the end.  When     */
X/* reading  this  grammar,  it	is  important to  note that all symbols     */
X/* appearing  in the  rules are  separated by  one or  more  blanks.  A     */
X/* string  such  as   'IDENTIFIER_type_mark   is  actually  a   single      */
X/* nonterminal symbol defined at the end of the rules.  The '/*' symbol     */
X/* is used  to indicate that the rest of  the  line is a comment,  just     */
X/* as in yacc programs.                                                     */
X/*                                                                          */
X/*     This grammar is presented here in a form suitable for input to a     */
X/* yacc parser generator.  It has  been  processed  by the Bell System      */
X/* III lex/yacc combination, and tested against over 400 ACVC tests.        */
X/*									    */
X/* *Ada is a registered trade mark of the  Department of  Defense  (Ada     */
X/* Joint Program  Office).						    */
X/*									    */
X/*--------------------------------------------------------------------------*/
X
X
X/*%terminals -----------------------------------------------------------    */
X
X%{ 
X
X#include <stdio.h>
X#include <ctype.h>
X
Xextern char yytext[];
Xextern int yylineno;
X
X%}
X
X
X%union {
X	char *y_str;
X	int y_num;
X};
X
X%token ABORT_ ABS_ ACCEPT_  ACCESS_ ALL_  AND_ ARRAY_
X%token AT_ BEGIN_  BODY_ CASE_  CONSTANT_
X%token DECLARE_ DELAY_ DELTA_ DIGITS_ DO_ ELSE_ ELSIF_
X%token END_  ENTRY_ EXCEPTION_ EXIT_ FOR_
X%token FUNCTION_ GENERIC_  GOTO_ IF_ IN_  IS_ LIMITED_
X%token LOOP_ MOD_  NEW_ NOT_  NULL_ OF_ OR_
X%token OTHERS_ OUT_  PACKAGE_ PRAGMA_  PRIVATE_
X%token PROCEDURE_  RAISE_  RANGE_ RECORD_ REM_
X%token RENAMES_ RETURN_ REVERSE_  SELECT_  SEPARATE_
X%token SUBTYPE_	TASK_ TERMINATE_	THEN_
X%token TYPE_ USE_ WHEN_ WHILE_ WITH_ XOR_
X
X%token IDENTIFIER NUMERIC_LITERAL STRING_LITERAL CHARACTER_LITERAL
X%token ARROW_ DBLDOT_ EXP_ ASSIGN_ NOTEQL_ GTEQL_ LTEQ_ L_LBL_ R_LBL_ BOX_
X
X%start compilation
X
X%%
X
X
X/* 2.8 */
Xprag		: PRAGMA_ IDENTIFIER .arg_ascs ';' 
X		;
X
Xarg_asc		: expr
X   		| IDENTIFIER ARROW_ expr  
X		;
X
X/* 3.1 */
Xbasic_d  	: object_d
X		| ty_d	       
X		| subty_d
X		| subprg_d       
X		| pkg_d
X		| task_d	       
X		| gen_d
X		| excptn_d       
X		| gen_inst
X		| renaming_d     
X		| number_d
X		| error ';' 
X		;
X
X/* 3.2 */
Xobject_d  	: idents ':' subty_ind ._ASN_expr. ';'
X		| idents ':'  CONSTANT_ subty_ind ._ASN_expr. ';'
X		| idents ':'  c_arr_def ._ASN_expr. ';'
X		| idents ':'  CONSTANT_ c_arr_def ._ASN_expr. ';' 
X		;
X
Xnumber_d  	: idents ':' CONSTANT_ ASSIGN_ expr ';' 
X		;
X
Xidents	 	: IDENTIFIER ...ident..	
X		;
X
X/* 3.3.1 */
Xty_d  		: full_ty_d
X	        | incomplete_ty_d
X		| priv_ty_d  
X		;
X
Xfull_ty_d  	: TYPE_ IDENTIFIER            IS_ ty_def ';'
X   		| TYPE_ IDENTIFIER discr_part IS_ ty_def ';' 
X		;
X
Xty_def	 	: enum_ty_def		
X		| integer_ty_def
X		| real_ty_def			
X		| array_ty_def
X		| rec_ty_def 		
X		| access_ty_def
X		| derived_ty_def 
X		;
X
X/* 3.3.2 */
Xsubty_d  	: SUBTYPE_ IDENTIFIER IS_ subty_ind ';' 
X		;
X
Xsubty_ind  	: ty_mk .constrt. 	
X		;
X
Xty_mk  		: expanded_n 
X		;
X
Xconstrt  	: rng_c
X		| fltg_point_c  
X		| fixed_point_c
X		| aggr 
X		;
X
X/* 3.4 */
Xderived_ty_def	: NEW_ subty_ind 
X		;
X
X
X/* 3.5 */
Xrng_c  		: RANGE_ rng 
X		;
X
Xrng  		: name
X	        | sim_expr DBLDOT_ sim_expr	
X		;
X
X/* 3.5.1 */
Xenum_ty_def     : '(' enum_lit_spec ...enum_lit_spec.. ')' 
X		;
X
X
Xenum_lit_spec   : enum_lit 
X		;
X
Xenum_lit  	: IDENTIFIER  
X		| CHARACTER_LITERAL 
X		;
X
X/* 3.5.4 */
Xinteger_ty_def	: rng_c 
X		;
X
X/* 3.5.6 */
Xreal_ty_def	: fltg_point_c  
X		| fixed_point_c 
X		;
X
X/* 3.5.7 */
Xfltg_point_c  	: fltg_accuracy_def .rng_c. 
X		;
X
Xfltg_accuracy_def	: DIGITS_ sim_expr 
X		;
X
X/* 3.5.9 */
Xfixed_point_c	: fixed_accuracy_def .rng_c. 
X		;
X
Xfixed_accuracy_def	: DELTA_ sim_expr 
X		;
X
X/* 3.6 */
Xarray_ty_def	: uncnstrnd_array_def
X		|  c_arr_def 
X		;
X
Xuncnstrnd_array_def : ARRAY_ '(' idx_subty_def ...idx_subty_def.. ')' OF_
X					 subty_ind 
X		;
X
X
Xc_arr_def	: ARRAY_ idx_c OF_ subty_ind 
X		;
X
X
Xidx_subty_def   : name  RANGE_ BOX_ 
X		;
X
X
Xidx_c  		: '(' dscr_rng ...dscr_rng.. ')' 
X		;
X
Xdscr_rng	: rng
X   		| name rng_c	
X		;
X
X/* 3.7 */
Xrec_ty_def 	: RECORD_ cmpons END_ RECORD_ 
X		;
X
Xcmpons		: ..prag.. ..cmpon_d.. cmpon_d ..prag..
X		|	..prag.. ..cmpon_d.. variant_part ..prag..
X		|    ..prag.. NULL_ ';' ..prag.. 
X		;
X
Xcmpon_d  	: idents ':' cmpon_subty_def ._ASN_expr. ';'  
X		;
X
Xcmpon_subty_def	:  subty_ind 
X		;
X
X/* 3.7.1 */
Xdiscr_part  	: '(' discr_spec ...discr_spec.. ')' 
X		;
X
Xdiscr_spec  	: idents ':' ty_mk ._ASN_expr. 
X		;
X
X/* 3.7.2 */
X/*discr_c	: '(' discr_asc ... discr_asc.. ')' ;                */
X
X/*discr_asc	: .discr_sim_n ..or_discrim_sim_n.. ARROW. expressi */
X/*	 	;							     */
X
X/*"discr_c" is included under "aggr"		     */
X
X
X/* 3.7.3 */
Xvariant_part  	: CASE_ sim_n IS_ ..prag.. variant ..variant..  END_ CASE_ ';' 
X		;
X
Xvariant  	: WHEN_ choice ..or_choice.. ARROW_ cmpons 
X		;
X
Xchoice		: sim_expr
X	        | name rng_c
X	        | sim_expr DBLDOT_ sim_expr
X	        | OTHERS_ 
X		;
X
X/* 3.8 */
Xaccess_ty_def 	: ACCESS_ subty_ind 
X		;
X
X/* 3.8.1 */
Xincomplete_ty_d : TYPE_ IDENTIFIER ';'
X	        | TYPE_ IDENTIFIER discr_part ';'  
X		;
X
X/* 3.9 */
Xdecl_part	: ..basic_decl_item..
X	        | ..basic_decl_item.. body ..later_decl_item.. 
X		;
X
Xbasic_decl_item : basic_d
X		| rep_cl  
X  		| use_cl	
X		;
X
Xlater_decl_item : body
X	        | subprg_d	
X	        | pkg_d
X	        | task_d	
X	        | gen_d
X	        | use_cl		
X	        | gen_inst   
X		;
X
Xbody  		: proper_body 	
X		| body_stub  
X		;
X
Xproper_body  	: subprg_body  
X		| pkg_body  	
X		| task_body	 
X		;
X
X/* 4.1 */
X
Xname  		: sim_n
X	        | CHARACTER_LITERAL  
X	        | op_symbol
X	        | idxed_cmpon
X	        | selected_cmpon 
X	        | attribute 
X	        ;
X
X
Xsim_n  		: IDENTIFIER  
X		;
X
Xprefix		: name  
X		;
X
X/* 4.1.1 */
Xidxed_cmpon  	: prefix aggr  
X		;
X
X/* 4.1.2 */
X
X/* slice  :  prefix '(' dscr_rng ')' ;       */
X/*						   */
X/* included under "idxed_cmpon".		   */
X
X
X/* 4.1.3 */
X
Xselected_cmpon  : prefix '.' selector  
X		;
X
Xselector  	: sim_n
X	        |    CHARACTER_LITERAL  
X	        |  op_symbol  
X	        |  ALL_  
X		;
X
X/* 4.1.4 */
X
Xattribute  	: prefix '\'' attribute_designator 
X		;
X/*  This can be an attribute, idxed cmpon, slice, or subprg call. */
Xattribute_designator : sim_n
X   		| DIGITS_
X   		| DELTA_
X   		| RANGE_	  
X		;
X
X/* 4.3 */
Xaggr  		: '(' cmpon_asc ...cmpon_asc.. ')' 
X		;
X
Xcmpon_asc       : expr
X	        | choice ..or_choice.. ARROW_ expr
X	        | sim_expr DBLDOT_ sim_expr
X	        | name rng_c 
X		;
X
X/* 4.4 */
X
Xexpr  		: rel..AND__rel..  
X		| rel..AND__THEN__rel..
X		| rel..OR__rel.. 
X		| rel..OR__ELSE__rel..
X		| rel..XOR__rel..  
X		;
X
Xrel  		: sim_expr .relal_op__sim_expr.
X   		| sim_expr.NOT.IN__rng_or_sim_expr.NOT.IN__ty_mk 
X		;
X
Xsim_expr  	: .unary_add_op.term..binary_add_op__term.. 
X		;
X
Xterm  		:  factor..mult_op__factor..  
X		;
X
Xfactor		:  pri ._EXP___pri.  
X		|	ABS_ pri  
X		|	NOT_ pri  
X		;
X
Xpri  		: NUMERIC_LITERAL    
X		|  NULL_
X   		|	allocator  
X   		|  qualified_expr
X   		|	name
X   		|	aggr 
X		;
X
X/* "'(' expr ')'" is included under "aggr".  */
X
X
X/* 4.5 */
X
X/* logical_op  	: AND_  
X		| OR_  
X		| XOR_  ;	*/
X/*						*/
X/* This is an unused syntactic class.		*/
X
X
Xrelal_op 	:  '='  
X		|  NOTEQL_  
X		|  '<'  
X		|  LTEQ_  
X		|  '>'  
X		|  GTEQL_  
X		;
X
X
Xbinary_add_op  	:  '+'  
X		|  '-'  
X		|  '&' 
X		;
X
X
Xunary_add_op  	:  '+'  
X		|  '-'  
X		;
X
X
Xmult_op  	:  '*'  
X		|  '/'  
X		|  MOD_  
X		|  REM_  
X		;
X
X
X/* highest_precedence_op	:  EXP_	 
X		|   ABS_   
X		|   NOT_   
X		;	 */
X/*								  */
X/* This is an unused syntactic class.				  */
X
X
X
X/* 4.6 */
X/* ty_cnvr  	:  ty_mk '(' expr ')' ;     */
X/*							  */
X/* The class "ty_cnvr" is included under "name".  */
X
X
X/* 4.7	*/
Xqualified_expr	: ty_mkaggr_or_ty_mkPexprP_ 
X		;
X
X
X
X/* 4.8 */
Xallocator  	: NEW_ ty_mk
X   		| NEW_ ty_mk aggr
X   		| NEW_ ty_mk '\'' aggr  
X		;
X
X/* 5.1 */
Xseq_of_stmts	: ..prag.. stmt ..stmt..  
X		;
X
X
Xstmt  		: ..label.. sim_stmt  
X		| ..label.. compound_stmt
X   		| error    ';'  
X		;
X
Xsim_stmt  	:null_stmt
X   		| assignment_stmt   
X   		| exit_stmt
X   		| return_stmt	  
X   		| goto_stmt
X   		| delay_stmt	  
X   		| abort_stmt
X   		| raise_stmt	  
X   		| code_stmt
X   		| name ';' 
X		;
X
X/* Procedure and ent call stmts are included under "name".   */
X
X
Xcompound_stmt  	: if_stmt   
X		|  case_stmt
X   		|	loop_stmt	  
X   		|  block_stmt
X   		|	accept_stmt  
X   		|	select_stmt  
X		;
X
Xlabel  		:  L_LBL_ sim_n R_LBL_  
X		;
X
Xnull_stmt  	:  NULL_ ';'  
X		;
X
X/* 5.2 */
Xassignment_stmt :  name ASSIGN_ expr ';' 
X		;
X
X/* 5.3 */
X
Xif_stmt  	: IF_ cond THEN_ seq_of_stmts
X		    ..ELSIF__cond__THEN__seq_of_stmts..
X		    .ELSE__seq_of_stmts.
X		    END_ IF_ ';' 
X	        ;
X
Xcond  		:  expr 
X		;
X
X
X/* 5.4 */
Xcase_stmt	: CASE_ expr IS_ case_stmt_alt..case_stmt_alt..  END_ CASE_ ';' 
X		;
X
Xcase_stmt_alt  	: WHEN_ choice ..or_choice.. ARROW_ seq_of_stmts 
X		;
X
X/* 5.5	*/
Xloop_stmt	: .sim_nC.  /*simple name colon */
X		     .iteration_scheme. LOOP_
X			 seq_of_stmts
X		     END_ LOOP_ .sim_n. ';' 
X	        ;
X
Xiteration_scheme: WHILE_ cond
X   		| FOR_ loop_prm_spec 
X		;
X
Xloop_prm_spec   : IDENTIFIER IN_ .REVERSE. dscr_rng 
X		;
X
X/* 5.6 */
Xblock_stmt  	: .sim_nC. .DECLARE__decl_part.  
X			BEGIN_
X			   seq_of_stmts
X			   .EXCEPTION__excptn_handler..excptn_handler...
X			END_ .sim_n. ';' 
X		;
X
X/* 5.7 */
Xexit_stmt	: EXIT_ .expanded_n. .WHEN__cond. ';' 
X		;
X
X/* 5.8 */
Xreturn_stmt  	:  RETURN_ .expr. ';' 
X		;
X
X/* 5.9 */
Xgoto_stmt  	:  GOTO_ expanded_n ';' 
X		;
X
X/* 6.1 */
Xsubprg_d  	:  subprg_spec ';'  
X		;
X
Xsubprg_spec  	: PROCEDURE_ IDENTIFIER 
X   	     	| FUNCTION_ designator .fml_part. RETURN_ ty_mk  
X		;
X
Xdesignator  	:  IDENTIFIER
X		|  op_symbol
X		;
X
X
Xop_symbol  	:  STRING_LITERAL 
X		;
X
Xfml_part  	: '(' prm_spec .._.prm_spec.. ')' 
X		;
X
Xprm_spec  	: idents ':' mode ty_mk ._ASN_expr.  
X		;
X
Xmode  		:  .IN.  
X		|  IN_ OUT_  
X		|  OUT_   
X		;
X
X/* 6.3 */
Xsubprg_body  	: subprg_spec IS_ .decl_part.
X		  BEGIN_
X		     seq_of_stmts
X		     .EXCEPTION__excptn_handler..excptn_handler...
X		  END_ .designator. ';' 
X		;
X
X/* 6.4 */
X/* procedure_call_stmt	: procedure_n .act_prm_part. ';' 
X		;                        */
X
X/* func_call  	: func_n .act_prm.  
X		;    */
X
X/* act_prm_part : '(' prm_asc ... prm_asc .._paren 
X		;                  */
X
X/* prm_asc	: .fml_prm ARROW. act_prm	
X		;   */
X
X/* fml_prm  	: sim_n  
X		;  */
X
X/* act_prm  	: expr  
X	    	|  name  
X		|  ty_mk '(' name ')'
X		;  */
X
X/* "procedure_call_stmt" and "func_call" are included under "name".*/
X
X
X
X/* 7.1 */
X
Xpkg_d  	  	: pkg_spec ';'  
X		;
X
Xpkg_spec  	: PACKAGE_ IDENTIFIER IS_ ..basic_decl_item..
X	    	  .PRIVATE..basic_decl_item...  END_ .sim_n.   
X		;
X
X
Xpkg_body  	: PACKAGE_ BODY_ sim_n IS_
X		     .decl_part.
X		     .BEGIN__seq_of_stmts.EXCEPTION__excptn_handler..excptn_handler...
X		  END_ .sim_n. ';'   
X		;
X
X/* 7.4	*/
Xpriv_ty_d  	: TYPE_ IDENTIFIER IS_ .LIMITED. PRIVATE_ ';'
X      		| TYPE_ IDENTIFIER discr_part IS_ .LIMITED. PRIVATE_ ';' ;
X
X/* defer_const_d: idents : CONSTANT_ ty_mk ';'       
X		;  */
X
X/* 8.4 */
Xuse_cl  	:  USE_ expanded_n ...expanded_n.. ';'  
X		;
X
X/* 8.5 */
Xrenaming_d  	: idents ':' ty_mk      RENAMES_ name ';'
X   		|    idents ':' EXCEPTION_      RENAMES_ expanded_n ';'
X   		|    PACKAGE_ IDENTIFIER        RENAMES_ expanded_n ';'
X   		|    subprg_spec  RENAMES_ name ';'   
X		;
X
X/* idents in the two above rule must contain only one */
X/* IDENTIFIER.						       */
X
X/* 9.1 */
Xtask_d  	:  task_spec ';'  
X		;
X
Xtask_spec  	: TASK_ .TYPE. IDENTIFIER .IS..ent_d_..rep_cl_END.sim_n.
X	        ;
X
Xtask_body  	: TASK_ BODY_ sim_n IS_ .decl_part.
X		  BEGIN_
X		     seq_of_stmts
X		  .EXCEPTION__excptn_handler..excptn_handler...
X		  END_ .sim_n. ';' 
X		;
X
X/* 9.5 */
Xent_d  		: ENTRY_ IDENTIFIER .fml_part. ';'
X   		| ENTRY_ IDENTIFIER '(' dscr_rng ')' .fml_part. ';'  
X		;
X
Xent_call_stmt  	: ..prag.. name ';' 
X		;
X
Xaccept_stmt  	: ACCEPT_ sim_n .Pent_idx_P..fml_part.
X		  .DO__seq_of_stmts__END.sim_n.. ';' 
X		;
X
Xent_idx  	: expr   
X		;
X
X/* 9.6 */
Xdelay_stmt  	: DELAY_ sim_expr ';' 
X		;
X
X/* 9.7 */
Xselect_stmt  	:	selec_wait
X   		|	condal_ent_call	
X   		|  timed_ent_call  
X		;
X
X/* 9.7.1 */
Xselec_wait	: SELECT_ select_alt 
X		  ..OR__select_alt..  
X		  .ELSE__seq_of_stmts.
X        	  END_ SELECT_ ';' 
X		;
X
X
Xselect_alt  	: .WHEN__condARROW.selec_wait_alt  
X		;
X
Xselec_wait_alt  :  accept_alt
X   		|	delay_alt  
X   		|  terminate_alt  
X		;
X
Xaccept_alt  	: accept_stmt.seq_of_stmts.  
X		;
X
Xdelay_alt  	: delay_stmt.seq_of_stmts.  
X		;
X
Xterminate_alt  	:  TERM_stmt   
X		;
X
X/* 9.7.2 */
Xcondal_ent_call	: SELECT_
X			ent_call_stmt
X			.seq_of_stmts.
X		    ELSE_
X			seq_of_stmts
X		    END_ SELECT_ ';' 
X		;
X
X/* 9.7.3 */
Xtimed_ent_call  : SELECT_ ent_call_stmt .seq_of_stmts.
X		  OR_ delay_alt END_ SELECT_ ';' 
X		;
X
X
X/* 9.10  */
X
Xabort_stmt  	: ABORT_ name ...name.. ';'  
X		;
X
X/* 10.1 */
X
Xcompilation 	: ..compilation_unit..   
X		;
X
Xcompilation_unit: context_cl library_unit
X   		| context_cl secondary_unit 
X		;
X
Xlibrary_unit  	: subprg_d	
X		| pkg_d
X   		| gen_d	
X   		| gen_inst
X   		| subprg_body     
X		;
X
Xsecondary_unit	: library_unit_body  
X		| subunit	
X		;
X
Xlibrary_unit_body  : pkg_body_or_subprg_body  
X		;
X
X/* 10.1.1  */
Xcontext_cl      : ..with_cl..use_cl.... 
X		;
X
Xwith_cl  	: WITH_ sim_n ...sim_n.. ';'  
X		;
X
X/* 10.2 */
Xbody_stub  	: subprg_spec IS_ SEPARATE_ ';'
X   		| PACKAGE_ BODY_ sim_n IS_ SEPARATE_ ';'
X   		| TASK_ BODY_ sim_n    IS_ SEPARATE_ ';'   
X		;
X
X
Xsubunit  	: SEPARATE_ '(' expanded_n ')' proper_body  
X		;
X
X/* 11.1 */
X
Xexcptn_d  	: idents ':' EXCEPTION_ ';' 
X		;
X
X/* 11.2 */
X
Xexcptn_handler	: WHEN_ excptn_choice ..or_excptn_choice.. ARROW_
X	    	  seq_of_stmts  
X		;
X
X
Xexcptn_choice   : expanded_n  
X		| OTHERS_	
X		;
X
X
X/* 11.3 */
Xraise_stmt  	: RAISE_ .expanded_n. ';' 
X		;
X
X/* 12.1 */
Xgen_d  		: gen_spec ';'  
X		;
X
Xgen_spec  	: gen_fml_part subprg_spec
X   		| gen_fml_part pkg_spec  
X		;
X
X
Xgen_fml_part    : GENERIC_ ..gen_prm_d..  
X		;
X
X
Xgen_prm_d  	: idents ':' .IN.OUT.. ty_mk ._ASN_expr. ';'
X   		| TYPE_ IDENTIFIER IS_ gen_ty_def ';'
X   		| priv_ty_d
X   		| WITH_ subprg_spec .IS_BOX_. ';' ;
X/* 		| WITH_ subprg_spec .IS_ name. ';'  */
X/*						     */
X/* This rule is included in the previous one.	     */
X
X
Xgen_ty_def	: '(' BOX_ ')'  
X		|  RANGE_ BOX_  
X		|  DIGITS_ BOX_  
X		|  DELTA_ BOX_
X   		| array_ty_def	       
X   		|  access_ty_def	   
X		;
X
X/* 12.3  */
Xgen_inst  	: PACKAGE_ IDENTIFIER IS_ NEW_ expanded_n .gen_act_part. ';'
X   		| PROCEDURE__ident__IS_ NEW_ expanded_n .gen_act_part. ';'
X   		| FUNCTION_  designator IS_ NEW_ expanded_n .gen_act_part. ';'  
X		;
X
Xgen_act_part  	: '(' gen_asc ...gen_asc.. ')'              
X		;
X
X
Xgen_asc	     	: .gen_fml_prmARROW.gen_act_prm 
X		;
X
Xgen_fml_prm  	: sim_n  
X	        | op_symbol  
X		;
X
Xgen_act_prm 	: expr_or_name_or_subprg_n_or_ent_n_or_ty_mk
X	 	;
X
X/* 13.1 */
X
Xrep_cl  	: ty_rep_cl  
X		| address_cl  
X		;
X
Xty_rep_cl  	: length_cl
X   		| enum_rep_cl
X   		| rec_rep_cl	    
X		;
X
X/* 13.2 */
Xlength_cl  	: FOR_ attribute USE_ sim_expr ';' 
X		;
X
X/* 13.3 */
Xenum_rep_cl  	: FOR__ty_sim_n__USE_ aggr ';' 
X		;
X
X/* 13.4  */
Xrec_rep_cl	: FOR__ty_sim_n__USE_ RECORD_ .algt_cl. 
X		  ..cmpon_cl..  END_ RECORD_ ';'   
X		;
X
Xalgt_cl  	:     AT_ MOD_ sim_expr ';' 
X		;
X
Xcmpon_cl  	: name AT_ sim_expr RANGE_ rng ';' 
X		;
X
X/* 13.5 */
Xaddress_cl  	: FOR_ sim_n USE_ AT_ sim_expr ';'  
X		;
X
X/* 13.8 */
X
Xcode_stmt  	: ty_mk_rec_aggr ';' 
X		;
X
X
X/*----------------------------------------------------------------------*/
X
X/* The following rules define semantically qualified symbols under more
X/* general categories.
X
Xty_n_or_subty_n : expanded_n 
X		;
X
X/* An "expanded_n" is used for names that can be written using only*/
X/* selectors.							      */
X
X/*     ... these have been replaced logically to reduce the number    */
X/*         of YACC_ nonterminal "rules"                                */
X
X/* The following rules expand the concatenated constructs and define the */
X/* specially added syntactical classes. 				 */
X
X
X/* 2.1 */
X
X	
X..prag..	: /* empty */
X   		| ..prag.. prag  
X		;
X
X.arg_ascs 	: /* empty */
X   		| '(' arg_ascs ')' 
X		;
X
Xarg_ascs 	: arg_asc
X		| arg_ascs ',' arg_asc 
X		;
X
X
X/* "name" is included under "expr"	*/
X/* 3.1 */
X/*  "defer_const_d" is included under "object_d".*/
X
X._ASN_expr.	: /* empty */
X   		| ASSIGN_ expr  
X		;
X
X...ident..  	: /* empty */
X   		| ...ident.. ',' IDENTIFIER   
X		;
X
X.constrt.  	: /* empty */
X   		| constrt   
X		;
X
X/* "idx_c" and "discr_c" are included under	 */
X/* the class "aggr".						 */
X
Xexpanded_n  	: IDENTIFIER
X	   	| expanded_n '.' IDENTIFIER   
X		;
X
X/*  This expansion generalizes "rng" so that it may include ty and */
X/*  subty names.						       */
X
X...enum_lit_spec.. : /* empty */
X   		| ...enum_lit_spec.. ',' enum_lit_spec 
X		;
X
X.rng_c.  	: /* empty */
X   		| rng_c	
X		;
X
X...idx_subty_def.. : /* empty */
X   		| ...idx_subty_def.. ',' idx_subty_def                
X		;
X
X
X/* To avoid conflicts, the more general class "name" is used.	   */
X...dscr_rng.. : /* empty */
X   		| ...dscr_rng.. ',' dscr_rng  
X		;
X
X/* A_ dscr subty ind given as a ty mk is included under rng*/
X..cmpon_d.. 	: /* empty */
X		| ..cmpon_d.. cmpon_d ..prag..    
X		;
X
X...discr_spec..	: /* empty */
X   		|    ...discr_spec.. ';' discr_spec  
X		;
X
X/* Pragmas that can appear between two consecutive variants are picked	*/
X/* up in the cmpons part of the variants themselves.		*/
X
X..variant..  	: /* empty */
X   		|	..variant.. variant  
X		;
X
X..or_choice.. 	: /* empty */
X   		|    ..or_choice.. '|' choice  
X		;
X
X/* The "sim_expr" by itself may be a "dscr_rng" or a  */
X/* "cmpon_sim_n".					     */
X
X/* A_ body is the only later_decl_item that is not also a	   */
X/* basic_decl_item.	    It is therefore used as the dividing   */
X/* point between the two lists of decl items.			   */
X
X..basic_decl_item.. : ..prag..
X		| ..basic_decl_item.. basic_decl_item ..prag.. 
X		;
X
X..later_decl_item.. : ..prag..
X   		| ..later_decl_item.. later_decl_item ..prag..  
X		;
X
X/* 4.1 */
X/* "slice" is included under "idxed_cmpon".  */
X/* The def of "name" includes "func_call".				*/
X/* A_ prmless func call is recognized as a sim name or a	*/
X/* selected cmpon.	A_ func call with prms is recognized	*/
X/* as an idxed cmpon.						*/
X
X/* Reserved word attribute designators are included in the rules as a	     */
X/* convenience.  Alternativly, since an attribute designator is always preced*/
X/* by an apostrophe, as noted in the RR_ 4.1.4, such usage may be detected    *
/
X/* during lexical analysis thus obviating the need for special rules.	     */
X/*									     */
X/* The univ static expr of an attribute designator is reduced     */
X/* as an "idxed_cmpon".						     */
X
X...cmpon_asc..	: /* empty */
X		| ...cmpon_asc.. ',' cmpon_asc 
X		;
X
X/* Component ascs are generalized to include dscr rngs. 	   */
X/* Thus, an "aggr" can be used for slices and idx and discr  */
X/* constrts.							   */
X
Xrel..AND__rel.. : rel AND_ rel
X		|rel..AND__rel.. AND_ rel	 
X		;
X
Xrel..OR__rel..  : rel OR_ rel
X		| rel..OR__rel.. OR_ rel 
X		;
X
Xrel..XOR__rel.. : rel
X		| ..XOR__rel..  
X		;
X
X..XOR__rel..    : rel XOR_ rel
X		| ..XOR__rel.. XOR_ rel	
X		;
X
Xrel..AND__THEN__rel..  : rel AND_ THEN_ rel
X		| rel..AND__THEN__rel.. AND_ THEN_ rel  
X		;
X
Xrel..OR__ELSE__rel.. : rel OR_ ELSE_ rel
X		| rel..OR__ELSE__rel.. OR_ ELSE_ rel  
X		;
X
X.relal_op__sim_expr.  : /* empty */
X		| relal_op sim_expr  
X		;
X
Xsim_expr.NOT.IN__rng_or_sim_expr.NOT.IN__ty_mk	: sim_expr .NOT. IN_ rng 
X		;
X
X/* The "ty_mk" is included under "rng"  */
X
X.NOT.  :
X       /* empty */
X| NOT_    ;
X
X.unary_add_op.term..binary_add_op__term..  : term
X		| unary_add_op term
X		| .unary_add_op.term..binary_add_op__term..  binary_add_op term 
X		;
X
Xfactor..mult_op__factor.. : factor
X		| factor..mult_op__factor.. mult_op factor 
X		;
X
X._EXP___pri.  	: /* empty */
X   		| EXP_ pri 
X		;
X
X/* "stringsit" is included under "name" as "op_symbol".  */
X/* "func_call" is included under "name".			    */
X/* "ty_cnvr" is included under "name".			    */
X
Xty_mkaggr_or_ty_mkPexprP_  : prefix '\'' aggr 
X		;
X
X/* The "prefix must be a "ty_mk".  The "PexprP_" is an "aggr". */
X/* Here the "qualified_expr" can be given exactly  */
X/* We use the fact that the constrt must be an idx or discr  */
X/* constrt.								 */
X
X/* 5.1 */
X
X
X..stmt..  	: ..prag..
X		| ..stmt.. stmt ..prag.. 
X		;
X
X..label..   	: /* empty */
X		| ..label.. label  
X		;
X
X..ELSIF__cond__THEN__seq_of_stmts..  : /* empty */
X		| ..ELSIF__cond__THEN__seq_of_stmts..  ELSIF_ cond THEN_
X		    seq_of_stmts   
X	        ;
X
X.ELSE__seq_of_stmts. : /* empty */
X		| ELSE_ seq_of_stmts    
X		;
X
Xcase_stmt_alt..case_stmt_alt.. : ..prag..  case_stmt_alt ..case_stmt_alt..  
X		;
X
X..case_stmt_alt.. : /* empty */
X		| ..case_stmt_alt.. case_stmt_alt 
X		;
X
X.sim_nC.	: /* empty */
X		| sim_n ':' 
X		;
X
X.sim_n. 	: /* empty */
X		| sim_n  
X		;
X
X.iteration_scheme. : /* empty */
X		| iteration_scheme  
X		;
X
X.REVERSE. 	: /* empty */
X		| REVERSE_   
X		;
X
X.DECLARE__decl_part. : /* empty */
X   		| DECLARE_ decl_part		
X		;
X
X.EXCEPTION__excptn_handler..excptn_handler... : /* empty */
X		| EXCEPTION_ ..prag.. excptn_handlers	 
X		;
X
Xexcptn_handlers	: excptn_handler
X		| excptn_handlers excptn_handler   
X		;
X
X.expanded_n.  	: /* empty */
X		| expanded_n  
X		;
X
X.WHEN__cond.  	: /* empty */
X   		|	WHEN_ cond	
X		;
X
X.expr.		: /* empty */
X   		| expr   
X		;
X
X/* 6.1 */
X
X.fml_part.  	: /* empty */
X   		| fml_part  
X		;
X
X.._.prm_spec..  : /* empty */
X		| .._.prm_spec.. ';' prm_spec  
X		;
X
X.IN.  		: /* empty */
X		| IN_	  
X		;
X
X.decl_part.	: decl_part	 
X		;
X/* A_ "decl_part" may be empty.		*/
X
X.designator.  	: /* empty */
X		| designator    
X		;
X
X/* 7.1	*/
X
X.PRIVATE..basic_decl_item... : /* empty */
X		| PRIVATE_ ..basic_decl_item.. 
X		;
X
X.BEGIN__seq_of_stmts.EXCEPTION__excptn_handler..excptn_handler...  : /* empty *
/
X		| BEGIN_ seq_of_stmts
X	          .EXCEPTION__excptn_handler..excptn_handler...  
X	        ;
X
X.LIMITED.  	: /* empty */
X		| LIMITED_    
X		;
X
X...expanded_n.. : /* empty */
X		| ...expanded_n.. ',' expanded_n  
X		;
X
X/* 9.1 */
X
X.TYPE.		: /* empty */
X		| TYPE_   
X		;
X
X.IS..ent_d_..rep_cl_END.sim_n.  : /* empty */
X		| IS_ ..ent_d..  ..rep_cl..  END_ .sim_n.	      
X		;
X
X
X..ent_d..  	: ..prag..
X   		|	..ent_d.. ent_d ..prag..	
X		;
X
X..rep_cl..  	: /* empty */
X   		| ..rep_cl.. rep_cl ..prag..	
X		;
X
X.Pent_idx_P..fml_part. : .fml_part.
X   		|    '(' ent_idx ')' .fml_part.  
X		;
X
X.DO__seq_of_stmts__END.sim_n.. : /* empty */
X   		| DO_ seq_of_stmts END_ .sim_n.  
X		;
X
X..OR__select_alt..  : /* empty */
X   		| ..OR__select_alt.. OR_ select_alt	
X   		;
X
X.WHEN__condARROW.selec_wait_alt  : selec_wait_alt
X		| WHEN_ cond ARROW_ selec_wait_alt  
X		;
X
Xaccept_stmt.seq_of_stmts.  : ..prag.. accept_stmt .seq_of_stmts.  
X		;
X
Xdelay_stmt.seq_of_stmts.  : ..prag.. delay_stmt .seq_of_stmts. 
X		;
X
XTERM_stmt   	: ..prag.. TERMINATE_ ';' ..prag..  
X		;
X
X.seq_of_stmts.	: ..prag..
X		| seq_of_stmts	
X		;
X
X...name..	: /* empty */
X		| ...name.. ',' name  
X		;
X
X/* 10.1 */
X
X..compilation_unit.. : ..prag..
X		| ..compilation_unit.. compilation_unit ..prag.. 
X		;
X
Xpkg_body_or_subprg_body   :  pkg_body  
X		;
X
X/* "subprg_body" is already contained in the class "library_unit". */
X
X..with_cl..use_cl.... : /* empty */
X		| ..with_cl..use_cl.... with_cl use_cls 
X		;
X
Xuse_cls  	: ..prag..
X		| use_cls use_cl ..prag..  
X		;
X
X...sim_n..  	: /* empty */
X		| ...sim_n.. ',' sim_n  
X		;
X
X/* 11.1  */
X
X..or_excptn_choice.. : /* empty */
X		| ..or_excptn_choice.. '|' excptn_choice 
X		;
X
X/* 12.1 */
X
X..gen_prm_d..  	: /* empty */
X		| ..gen_prm_d.. gen_prm_d 
X		;
X
X.IN.OUT..  	: .IN.
X		| IN_ OUT_	 
X		;
X
X.IS_BOX_.	: /* empty */
X		| IS_ name
X		| IS_ BOX_ 
X		;
X
XPROCEDURE__ident__IS_ : subprg_spec IS_ 
X		;
X
X/* To avoid conflicts, the more general "subprg_spec" is used.  */
X.gen_act_part.  : /* empty */
X   		| gen_act_part 
X		;
X
X...gen_asc.. 	: /* empty */
X		| ...gen_asc.. ',' gen_asc 
X		;
X
X.gen_fml_prmARROW.gen_act_prm  : gen_act_prm
X		| gen_fml_prm ARROW_ gen_act_prm  
X		;
X
Xexpr_or_name_or_subprg_n_or_ent_n_or_ty_mk : expr  
X		;
X
X/* The above alts are included under "expr". */
X
X
X/* 13.1 */
X
XFOR__ty_sim_n__USE_  : FOR_ sim_n USE_	
X		;
X
X/* The "sim_n" must be a "ty_sim_n". */
X.algt_cl.  	: ..prag..
X		| ..prag.. algt_cl ..prag..   
X		;
X
X..cmpon_cl..  	: /* empty */
X		| ..cmpon_cl.. cmpon_cl ..prag..  
X		;
X
Xty_mk_rec_aggr  :  qualified_expr      
X		;
*-*-END-of-ada.y-*-*
echo x - ada.note
sed 's/^X//' >ada.note <<'*-*-END-of-ada.note-*-*'
XFrom umn-cs!jwabik@ub.D.UMN.EDU Fri Sep  4 08:45:16 1987
XReturn-Path: <umn-cs!jwabik@ub.D.UMN.EDU>
XReceived: by shamash.shamash.UUCP (3.2/SMI-3.2)
X	id AA01185; Fri, 4 Sep 87 08:45:13 CDT
XReceived: by umn-cs.cs.umn.edu (5.51/4.7)
X	id AA10858; Fri, 4 Sep 87 08:31:29 CDT
XReceived: by ub.D.UMN.EDU (5.51/9.7)
X	id AA14727; Fri, 4 Sep 87 08:32:45 CDT
XDate: Fri, 4 Sep 87 08:32:45 CDT
XFrom: umn-cs!jwabik@ub.D.UMN.EDU (Jeff Wabik)
XMessage-Id: <8709041332.AA14727@ub.D.UMN.EDU>
XTo: umn-cs!shamash!jwabik
XStatus: R
X
X>From hermix!fischer@rand-unix.ARPA Thu Sep  3 13:20:44 1987
XReceived: from rand-unix.rand.org (RAND-UNIX.ARPA) by ub.D.UMN.EDU with SMTP (5
.51/9.7)
X	id AA26121; Thu, 3 Sep 87 13:20:35 CDT
XReceived: by rand-unix.rand.org; Thu, 3 Sep 87 10:37:06 PDT
XMessage-Id: <8709031737.AA24314@rand-unix.rand.org>
XFrom: Herm Fischer <hermix!fischer@rand-unix.ARPA>
XReply-To: hermix!fischer@rand-unix.ARPA
XTo: jwabik@ub.d.umn.edu
XSubject: ada grammar
XDate: Thu Sep  3 10:05:57 1987
X
XJeff,
X
Xfollowing two messages are  a shar file of the public domain version of
Xthe ada grammar plus a second message which replaces the lex.
X
XThe version we used here gets pretty deep into the yacc/lex process, replacing
Xthe lexer stack, etc.  Let me know how you do with these, and if you
Xneed more, we can look at the specific stuff done here...
X
X  Herm
X
X
X
*-*-END-of-ada.note-*-*
exit
