From: HENRY::IN%"info-ada-request%ada20.isi.edu%ada20.isi.edu%csnet-relay.CSNET%relay.cs.net@RCA.COM" 28-SEP-1987 00:51 To: info-ada@ada20.isi.edu Subj: Ada YACC & LEX A few days ago I posted an offering of "tweaked" version of the Ada LEX and YACC that Herm Fischer has been distributing. Response has been overwhelming (I counted 18 requests today alone!). I started mailing out goodies today, but since 95% of the addresses bounced (I dont know whose fault it is .. ), I've decided to post all the stuff here. Here goes: This distribution will be in three parts: 1) READMEs, ada.doc, etc, etc 2) ada.y 3) ada.l The first package is a shar -- the rest are straight code. Please read thru the READMEs, and the other docs before trying to use this stuff. I made made some modifications to both that were unique to my application that I removed before posting to make it generic, there may be a few anomalies in the code.. (i.e. Its not "Ready to roll!", and will require a good 30 minutes of hacking to get a parser working... 8^) I'll be happy to answer any questions that come up.. Please use the address provided in the .signature below -- this node is new to the world and not in many maps yet. Enjoy! -Jeff =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Jeff A. Wabik (HQM207B) { umn-cs \ Control Data Corporation UUCP: -> !shamash!jwabik } Bloomington, MN 55440 { meccts / Disclaimer of the day: Of course my employer has no idea what I'm doing .. Moral of the day: Live long and program. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= echo x - DISTRIBUTION sed 's/^X//' >DISTRIBUTION <<'*-*-END-of-DISTRIBUTION-*-*' X X X X XHere is a list of everyone who requested the Ada YACC and LEX. This list Xis distributed with the idea of everyone keeping in touch if there are Xproblems/etc. Of course, I'd be happy to be a central coordinator for Xproblems/questions/etc.. X X X Jeff Wabik X Control Data Corporation X X UUCP: umn-cs!shamash!jwabik X ARPA: jwabik@ub.d.umn.edu X X============================================================================== X============================================================================== XJim Walker UUCP: ...!harvard!bunny!jjw1 XGTE Laboratories CSNET: jjw1@gte-labs XWaltham, MA X============================================================================== Xdaven@lll-crg.arpa X -OR- Xdaven@crg.llnl.gov X============================================================================== X-Mike Ramnarine X X UUCP: ...{ulowell,mit-erl,mit-eddie,yale,uw-beaver,decvax}!apollo!ramnarine X USPS: Apollo Computer, 330 Billerica Rd., Chelmsford MA 01824 X ARPA: apollo!ramnarine@eddie.mit.edu X Xci-dandelion!ulowell!apollo!ramnarine X============================================================================== XFrom: PAYRE%M_SMRVX2%sdr.slb.com@RELAY.CS.NET XX-Vms-To: MRGATE::M_SDR::IN%"jwabik@ub.d.umn.edu" X XMy ARPA address is : X PAYRE%M_SMRVX1@SDR.SLB.COM on ARPA. X XMy phone number is : X [33] (1) 47 46 66 88. This is in Paris, France. X XHenri Payre. X============================================================================== X XARPA: hermix!fischer@rand-unix.arpa XUUCP: {ihnp4,decvax,trwrb,seismo,etc.}!hermix!fischer X============================================================================== X X matthews@wwu.edu X XGeoffrey Matthews XComputer Science department XWestern Washington Unviersity XBellingham, WA 98225 X(206)676-3797 X============================================================================== X XFrom: umix!itivax!mnetor!lsuc!geac!daveb@RUTGERS.EDU (Dave Collier-Brown) X X David Collier-Brown. {mnetor|yetti|utgpu}!geac!daveb X Geac Computers International Inc., | Computer Science loses its X 350 Steelcase Road,Markham, Ontario, | memory (if not its mind) X CANADA, L3R 1B3 (416) 475-0525 x3279 | every 6 months. X============================================================================== X XFrom: hwang%uicsgva.LOCAL@uxc.cso.uiuc.edu (David Hwang) X X hwang%uicsg.csg.uiuc.edu@a.cs.uiuc.edu X X============================================================================== X XFrom: "Harry S. Delugach" X XHarry S. Delugach University of Virginia, Dept. of Computer Science X UUCP: ..!uunet!virginia!uvacs!hsd X INTERNET: hsd@cs.virginia.edu X BITNET: hsd2x@virginia X ARPANET: hsd2x@nrao-nrao1.arpa X============================================================================== XFrom: Asheem Chandna X Xuucp: {decvax,sun,cbosgd}!mandrill!asheem Xarpa: asheem%mandrill.cwru.edu@berkeley.edu Xcsnet: asheem@mandrill.cwru.edu X============================================================================== *-*-END-of-DISTRIBUTION-*-* echo x - README sed 's/^X//' >README <<'*-*-END-of-README-*-*' X X X From: Jeff Wabik X { umn-cs!shamash!jwabik } X September, 1987 X X X XThanks to everyone who responded to my posting. 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 future Xsuport 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 X -Jeff X *-*-END-of-README-*-* echo x - ada.doc sed 's/^X//' >ada.doc <<'*-*-END-of-ada.doc-*-*' X X A LALR(1) grammar for ANSI Ada* X X November 17, 1983 X Gerry Fisher X X Computer Sciences Corporation X 4045 Hancock Street X San Diego, CA 92121 X X X Phillipe Charles X Ada Project X New York University X 251 Mercer Street X New York, New York 10012 X X 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. 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 Ada programs. X X X X X X X This grammar is presented here in a form suitable for input to a XLALR parser generator. It has been processed by the NYU Parser XGenerator and tested against Version 1.3 of the ACVC Test Suite. X X *Ada is a registered trade mark of the Department of Defense (Ada X Joint Program Office). X X=========================================================================== XThis is what the grammar used to look like. Blech. X=========================================================================== X X Xterminals ------------------------------------------------------------- X X ABORT ABS ACCEPT ACCESS ALL AND ARRAY AT BEGIN BODY CASE CONSTANT X DECLARE DELAY DELTA DIGITS DO ELSE ELSIF END ENTRY EXCEPTION EXIT FOR X FUNCTION GENERIC GOTO IF IN IS LIMITED LOOP MOD NEW NOT NULL OF OR X OTHERS OUT PACKAGE PRAGMA PRIVATE PROCEDURE RAISE RANGE RECORD REM X RENAMES RETURN REVERSE SELECT SEPARATE SUBTYPE TASK TERMINATE THEN X TYPE USE WHEN WHILE WITH XOR X X identifier numeric_literal string_literal character_literal X X & ' ( ) * + , - . / : ; < = > '|' => .. ** := /= >= <= << >> <> X X X%start ----------------------------------------------------------------- X X compilation X X%rules ----------------------------------------------------------------- X X X-- 2.8 X Xpragma ::= X PRAGMA identifier [(argument_association{,argument_association})] ; X Xargument_association ::= X [argument_identifier=>]expression__|__[argument_identifier=>]name X X X X-- 3.1 X Xbasic_declaration ::= X deferred_constant_declaration__|__object_declaration X | type_declaration | subtype_declaration X | subprogram_declaration | package_declaration X | task_declaration | generic_declaration X | exception_declaration | generic_instantiation X | renaming_declaration | number_declaration X X X X-- 3.2 X Xobject_declaration ::= X identifier_list : [CONSTANT]subtype_indication [:=expression] ; X | identifier_list : [CONSTANT]constrained_array_definition X [:=expression] ; X X Xnumber_declaration ::= X identifier_list : CONSTANT := universal_static_expression ; X X Xidentifier_list ::= identifier {,identifier} X X X-- 3.3.1 X Xtype_declaration ::= X full_type_declaration X | incomplete_type_declaration X | private_type_declaration X Xfull_type_declaration ::= X TYPE identifier [discriminant_part]IS type_definition ; X X Xtype_definition ::= X enumeration_type_definition | integer_type_definition X | real_type_definition | array_type_definition X | record_type_definition | access_type_definition X | derived_type_definition X X X-- 3.3.2 X Xsubtype_declaration ::= X SUBTYPE identifier IS subtype_indication ; X X Xsubtype_indication ::= type_mark [constraint] X X Xtype_mark ::= type_name__|__subtype_name X X Xconstraint ::= X range_constraint X | floating_point_constraint | fixed_point_constraint X | index_constraint__|__discriminant_constraint X X X X-- 3.4 X Xderived_type_definition ::= NEW subtype_indication X X X-- 3.5 X Xrange_constraint ::= RANGE range X Xrange ::= X range_attribute__|__simple_expression..simple_expression X X X-- 3.5.1 X Xenumeration_type_definition ::= X ( enumeration_literal_specification X {,enumeration_literal_specification} ) X X Xenumeration_literal_specification ::= enumeration_literal X Xenumeration_literal ::= identifier | character_literal X X X-- 3.5.4 X Xinteger_type_definition ::= range_constraint X X X-- 3.5.6 X Xreal_type_definition ::= X floating_point_constraint | fixed_point_constraint X X X-- 3.5.7 X Xfloating_point_constraint ::= X floating_accuracy_definition [range_constraint] X X Xfloating_accuracy_definition ::= X DIGITS static_simple_expression X X X-- 3.5.9 X Xfixed_point_constraint ::= X fixed_accuracy_definition [range_constraint] X X Xfixed_accuracy_definition ::= X DELTA static_simple_expression X X X-- 3.6 X Xarray_type_definition ::= X unconstrained_array_definition | constrained_array_definition X X Xunconstrained_array_definition ::= X ARRAY ( index_subtype_definition {,index_subtype_definition} ) OF X component_subtype_indication X X Xconstrained_array_definition ::= X ARRAY index_constraint OF component_subtype_indication X X Xindex_subtype_definition ::= type_mark__RANGE__<> X X Xindex_constraint ::= ( discrete_range {,discrete_range} ) X X Xdiscrete_range ::= discrete_subtype_indication__|__range X X X X-- 3.7 X Xrecord_type_definition ::= X RECORD X component_list X END RECORD X X Xcomponent_list ::= X component_declaration{component_declaration} X | {component_declaration}variant_part X | NULL; X X Xcomponent_declaration ::= X identifier_list : component_subtype_definition [:=expression] ; X X Xcomponent_subtype_definition ::= subtype_indication X X X X-- 3.7.1 X Xdiscriminant_part ::= X ( discriminant_specification {;discriminant_specification} ) X X Xdiscriminant_specification ::= X identifier_list : type_mark [:=expression] X X X-- 3.7.2 X X-- discriminant_constraint ::= X-- ( discriminant_association {, discriminant_association} ) X-- X-- discriminant_association ::= X-- [discriminant_simple_name {| discriminant_simple_name} =>] expression X-- X-- "discriminant_constraint" is included under "aggregate" X X X-- 3.7.3 X Xvariant_part ::= X CASE discriminant_simple_name IS X variant{variant} X END CASE ; X X Xvariant ::= X WHEN choice {|choice} => X component_list X X Xchoice ::= simple_expression__|__discrete_range__|__component_simple_name X | OTHERS X X X X-- 3.8 X Xaccess_type_definition ::= ACCESS subtype_indication X X X-- 3.8.1 X Xincomplete_type_declaration ::= X TYPE identifier [discriminant_part]; X X-- 3.9 X Xdeclarative_part ::= X {basic_declarative_item}{later_declarative_item} X X Xbasic_declarative_item ::= X basic_declaration X | representation_clause | use_clause X X Xlater_declarative_item ::= body X | subprogram_declaration | package_declaration X | task_declaration | generic_declaration X | use_clause | generic_instantiation X Xbody ::= proper_body | body_stub X Xproper_body ::= X subprogram_body | package_body | task_body X X X X-- 4.1 X Xname ::= simple_name X | character_literal | operator_symbol X | indexed_component__|__slice X | selected_component | attribute X X Xsimple_name ::= identifier X X Xprefix ::= name__|__function_call X X X X-- 4.1.1 X Xindexed_component ::= X prefix(expression{,expression}) X X X-- 4.1.2 X X-- slice ::= prefix ( discrete_range ) X-- X-- included under "indexed_component". X X X-- 4.1.3 X Xselected_component ::= prefix . selector X Xselector ::= simple_name X | character_literal | operator_symbol | ALL X X X X-- 4.1.4 X Xattribute ::= prefix ' attribute_designator X X Xattribute_designator ::= X simple_name[(universal_static_expression)] X X X X-- 4.3 X Xaggregate ::= X ( component_association {,component_association} ) X X Xcomponent_association ::= X [choice{|choice}=>]expression X X X X-- 4.4 X Xexpression ::= X relation{AND__relation} | relation{AND__THEN__relation} X | relation{OR__relation} | relation{OR__ELSE__relation} X | relation{XOR__relation} X X Xrelation ::= X simple_expression [relational_operator__simple_expression] X | simple_expression[NOT]IN__range__|__simple_expression[NOT]IN__type_mark X X Xsimple_expression ::= X [unary_adding_operator]term{binary_adding_operator__term} X X Xterm ::= factor{multiplying_operator__factor} X X Xfactor ::= primary [**__primary] | ABS primary | NOT primary X X Xprimary ::= X numeric_literal | NULL X | allocator | qualified_expression X | name__|__string_literal__|__function_call__|__type_conversion X | aggregate__|__(expression) X X X X-- 4.5 X X-- logical_operator ::= AND | OR | XOR X-- X-- This is an unused syntactic class. X X Xrelational_operator ::= = | /= | < | <= | > | >= X X Xbinary_adding_operator ::= + | - | & X X Xunary_adding_operator ::= + | - X X Xmultiplying_operator ::= * | / | MOD | REM X X X-- highest_precedence_operator ::= ** | ABS | NOT X-- X-- This is an unused syntactic class. X X X X-- 4.6 X X-- type_conversion ::= type_mark ( expression ) X-- X-- The class "type_conversion" is included under "name". X X X-- 4.7 X Xqualified_expression ::= X type_mark'aggregate__|__type_mark'(expression) X X X X-- 4.8 X Xallocator ::= X NEW__subtype_indication | NEW__qualified_expression X X X X-- 5.1 X Xsequence_of_statements ::= statement{statement} X X Xstatement ::= X {label} simple_statement | {label} compound_statement X X Xsimple_statement ::= null_statement X | assignment_statement | exit_statement X | return_statement | goto_statement X | delay_statement | abort_statement X | raise_statement | code_statement X | procedure_call_statement__|__entry_call_statement X X Xcompound_statement ::= X if_statement | case_statement X | loop_statement | block_statement X | accept_statement | select_statement X X Xlabel ::= << label_simple_name >> X X Xnull_statement ::= NULL ; X X X-- 5.2 X Xassignment_statement ::= variable_name := expression ; X X X-- 5.3 X Xif_statement ::= X IF condition THEN X sequence_of_statements X {ELSIF__condition__THEN__sequence_of_statements} X [ELSE__sequence_of_statements] X END IF ; X X Xcondition ::= boolean_expression X X X-- 5.4 X Xcase_statement ::= X CASE expression IS X case_statement_alternative{case_statement_alternative} X END CASE ; X X Xcase_statement_alternative ::= X WHEN choice {|choice} => X sequence_of_statements X X X-- 5.5 X Xloop_statement ::= X [loop_simple_name:] X [iteration_scheme] LOOP X sequence_of_statements X END LOOP [loop_simple_name] ; X X X Xiteration_scheme ::= X WHILE condition X | FOR loop_parameter_specification X X Xloop_parameter_specification ::= X identifier IN [REVERSE] discrete_range X X X-- 5.6 X Xblock_statement ::= X [block_simple_name:] X [DECLARE__declarative_part] X BEGIN X sequence_of_statements X [EXCEPTION__exception_handler{exception_handler}] X END [block_simple_name] ; X X X-- 5.7 X Xexit_statement ::= X EXIT [loop_name] [WHEN__condition] ; X X X-- 5.8 X Xreturn_statement ::= RETURN [expression] ; X X X-- 5.9 X Xgoto_statement ::= GOTO label_name ; X X X X-- 6.1 X Xsubprogram_declaration ::= subprogram_specification ; X X Xsubprogram_specification ::= X PROCEDURE identifier [formal_part] X | FUNCTION designator [formal_part] RETURN type_mark X X Xdesignator ::= identifier | operator_symbol X X Xoperator_symbol ::= string_literal X X Xformal_part ::= X ( parameter_specification {;parameter_specification} ) X X Xparameter_specification ::= X identifier_list : mode type_mark [:=expression] X X Xmode ::= [IN] | IN OUT | OUT X X X X-- 6.3 X Xsubprogram_body ::= X subprogram_specification IS X [declarative_part] X BEGIN X sequence_of_statements X [EXCEPTION__exception_handler{exception_handler}] X END [designator] ; X X X-- 6.4 X X-- procedure_call_statement ::= X-- procedure_name [actual_parameter_part] ; X-- X-- function_call ::= X-- function_name [actual_parameter] X-- X-- actual_parameter_part ::= X-- ( parameter_association {, parameter_association }) X-- X-- parameter_association ::= X-- [formal_parameter =>] actual_parameter X-- X-- formal_parameter ::= parameter_simple_name X-- X-- actual_parameter ::= X-- expression | variable_name | type_mark ( variable_name ) X-- X-- "procedure_call_statement" and "function_call" are included under "name". X X X X-- 7.1 X Xpackage_declaration ::= package_specification ; X Xpackage_specification ::= X PACKAGE identifier IS X {basic_declarative_item} X [PRIVATE{basic_declarative_item}] X END [package_simple_name] X X Xpackage_body ::= X PACKAGE BODY package_simple_name IS X [declarative_part] X[BEGIN__sequence_of_statements[EXCEPTION__exception_handler{exception_ Xhandler}]] X END [package_simple_name] ; X X X X-- 7.4 X Xprivate_type_declaration ::= X TYPE identifier [discriminant_part]IS [LIMITED] PRIVATE ; X X-- deferred_constant_declaration ::= X-- identifier_list : CONSTANT type_mark ; X-- X-- Included under "object_declaration". X X X X-- 8.4 X Xuse_clause ::= USE package_name {,package_name} ; X X X X-- 8.5 X Xrenaming_declaration ::= X identifier:type_mark RENAMES object_name ; X | identifier:EXCEPTION RENAMES exception_name ; X | PACKAGE identifier RENAMES package_name ; X | subprogram_specification RENAMES subprogram_or_entry_name ; X X X-- 9.1 X Xtask_declaration ::= task_specification ; X Xtask_specification ::= X TASK [TYPE] identifier X [IS{entry_declaration}{representation_clause}END[task_simple_name]] X X Xtask_body ::= X TASK BODY task_simple_name IS X [declarative_part] X BEGIN X sequence_of_statements X [EXCEPTION__exception_handler{exception_handler}] X END [task_simple_name] ; X X X-- 9.5 X Xentry_declaration ::= X ENTRY identifier [(discrete_range)][formal_part] ; X X Xentry_call_statement ::= X entry_name[actual_parameter_part] ; X X Xaccept_statement ::= X ACCEPT entry_simple_name [(entry_index)][formal_part] X [DO__sequence_of_statements__END[entry_simple_name]] ; X X Xentry_index ::= expression X X X-- 9.6 X Xdelay_statement ::= DELAY simple_expression ; X X X-- 9.7 X Xselect_statement ::= selective_wait X | conditional_entry_call | timed_entry_call X X X-- 9.7.1 X Xselective_wait ::= X SELECT X select_alternative X {OR__select_alternative} X [ELSE__sequence_of_statements] X END SELECT ; X X Xselect_alternative ::= X [WHEN__condition=>]selective_wait_alternative X X Xselective_wait_alternative ::= accept_alternative X | delay_alternative | terminate_alternative X X Xaccept_alternative ::= X accept_statement[sequence_of_statements] X X Xdelay_alternative ::= X delay_statement[sequence_of_statements] X X Xterminate_alternative ::= TERMINATE; X X X-- 9.7.2 X Xconditional_entry_call ::= X SELECT X entry_call_statement X [sequence_of_statements] X ELSE X sequence_of_statements X END SELECT ; X X X X-- 9.7.3 X Xtimed_entry_call ::= X SELECT X entry_call_statement X [sequence_of_statements] X OR X delay_alternative X END SELECT ; X X X-- 9.10 X Xabort_statement ::= ABORT task_name {,task_name} ; X X X-- 10.1 X Xcompilation ::= {compilation_unit} X X Xcompilation_unit ::= X context_clause library_unit X X | context_clause secondary_unit X X Xlibrary_unit ::= X subprogram_declaration | package_declaration X | generic_declaration | generic_instantiation X | subprogram_body X X Xsecondary_unit ::= X library_unit_body | subunit X X Xlibrary_unit_body ::= X package_body__|__subprogram_body X X X X-- 10.1.1 X Xcontext_clause ::= {with_clause{use_clause}} X X Xwith_clause ::= WITH unit_simple_name {,unit_simple_name} ; X X X-- 10.2 X Xbody_stub ::= X subprogram_specification IS SEPARATE ; X | PACKAGE BODY package_simple_name IS SEPARATE ; X | TASK BODY task_simple_name IS SEPARATE ; X X Xsubunit ::= SEPARATE ( parent_unit_name ) proper_body X X X X-- 11.1 X Xexception_declaration ::= identifier_list : EXCEPTION ; X X X-- 11.2 X Xexception_handler ::= X WHEN exception_choice {|exception_choice} => X sequence_of_statements X X Xexception_choice ::= exception_name | OTHERS X X X-- 11.3 X Xraise_statement ::= RAISE [exception_name] ; X X X X-- 12.1 X Xgeneric_declaration ::= generic_specification ; X Xgeneric_specification ::= X generic_formal_part subprogram_specification X | generic_formal_part package_specification X X Xgeneric_formal_part ::= GENERIC {generic_parameter_declaration} X X Xgeneric_parameter_declaration ::= X identifier_list : [IN[OUT]] type_mark [:=expression] ; X | TYPE identifier IS generic_type_definition ; X | private_type_declaration X | WITH subprogram_specification [IS<>] ; X-- | WITH subprogram_specification [IS name] ; X-- X-- This rule is included in the previous one. X X Xgeneric_type_definition ::= X ( <> ) | RANGE <> | DIGITS <> | DELTA <> X | array_type_definition | access_type_definition X X X-- 12.3 X Xgeneric_instantiation ::= X PACKAGE identifier IS X NEW generic_package_name [generic_actual_part] ; X | PROCEDURE__identifier__IS X NEW generic_procedure_name [generic_actual_part] ; X | FUNCTION designator IS X NEW generic_function_name [generic_actual_part] ; X X Xgeneric_actual_part ::= X ( generic_association {,generic_association} ) X X Xgeneric_association ::= X [generic_formal_parameter=>]generic_actual_parameter X X Xgeneric_formal_parameter ::= X parameter_simple_name | operator_symbol X Xgeneric_actual_parameter ::= X expression__|__variable_name__|__subprogram_name__|__entry_name__|__type_mark X X X X-- 13.1 X Xrepresentation_clause ::= X type_representation_clause | address_clause X Xtype_representation_clause ::= length_clause X | enumeration_representation_clause X | record_representation_clause X X X-- 13.2 X Xlength_clause ::= FOR attribute USE simple_expression ; X X X X-- 13.3 X Xenumeration_representation_clause ::= X FOR__type_simple_name__USE aggregate ; X X X X-- 13.4 X Xrecord_representation_clause ::= X FOR__type_simple_name__USE X RECORD [alignment_clause] X {component_clause} X END RECORD ; X X Xalignment_clause ::= AT MOD static_simple_expression ; X X Xcomponent_clause ::= X component_name AT static_simple_expression RANGE static_range ; X X X X-- 13.5 X Xaddress_clause ::= FOR simple_name USE AT simple_expression ; X X X--13.8 X Xcode_statement ::= type_mark'record_aggregate ; X X X------------------------------------------------------------------------ X X-- The following rules define semantically qualified symbols under more X-- general categories. X Xtype_name__|__subtype_name ::= expanded_name X-- X-- An "expanded_name" is used for names that can be written using only X-- selectors. X Xuniversal_static_expression ::= expression X Xstatic_simple_expression ::= simple_expression X Xcomponent_subtype_indication ::= subtype_indication X Xdiscriminant_simple_name ::= simple_name X Xlabel_simple_name ::= simple_name X Xvariable_name ::= name X Xboolean_expression ::= expression X Xlabel_name ::= expanded_name X Xpackage_simple_name ::= simple_name X Xobject_name ::= name X Xexception_name ::= expanded_name X Xpackage_name ::= expanded_name X Xsubprogram_or_entry_name ::= name X Xtask_simple_name ::= simple_name X Xentry_simple_name ::= simple_name X Xtask_name ::= name X Xunit_simple_name ::= simple_name X Xparent_unit_name ::= expanded_name X Xgeneric_package_name ::= expanded_name X Xgeneric_procedure_name ::= expanded_name X Xgeneric_function_name ::= expanded_name X Xparameter_simple_name ::= simple_name X Xcomponent_name ::= name X Xstatic_range ::= range X X X-- The following rules expand the concatenated constructs and define the X-- specially added syntactical classes. X X X-- 2.1 X X{pragma} ::= X empty X | {pragma} pragma X X[(argument_association{,argument_association})] ::= X empty X | ( argument_association_list ) X Xargument_association_list ::= X argument_association X | argument_association_list , argument_association X X[argument_identifier=>]expression__|__[argument_identifier=>]name ::= X expression X | identifier => expression X-- X-- "name" is included under "expression" X X X-- 3.1 X Xdeferred_constant_declaration__|__object_declaration ::= object_declaration X-- X-- "deferred_constant_declaration" is included under "object_declaration". X X[:=expression] ::= X empty X | := expression X X[CONSTANT]subtype_indication ::= X subtype_indication X | CONSTANT subtype_indication X X[CONSTANT]constrained_array_definition ::= X constrained_array_definition X | CONSTANT constrained_array_definition X X{,identifier} ::= X empty X | {,identifier} , identifier X X[discriminant_part]IS ::= X IS X | discriminant_part IS X X[constraint] ::= X empty X | constraint X Xindex_constraint__|__discriminant_constraint ::= aggregate X-- X-- "index_constraint" and "discriminant_constraint" are included under X-- the class "aggregate". X Xexpanded_name ::= X identifier X | expanded_name . identifier X X range_attribute__|__simple_expression..simple_expression ::= X name X | simple_expression .. simple_expression X-- X-- This expansion generalizes "range" so that it may include type and X-- subtype names. X X{,enumeration_literal_specification} ::= X empty X | {,enumeration_literal_specification} , X enumeration_literal_specification X X[range_constraint] ::= X empty X | range_constraint X X{,index_subtype_definition} ::= X empty X | {,index_subtype_definition} , index_subtype_definition X Xtype_mark__RANGE__<> ::= name RANGE <> X-- X-- To avoid conflicts, the more general class "name" is used. X X{,discrete_range} ::= X empty X | {,discrete_range} , discrete_range X Xdiscrete_subtype_indication__|__range ::= X range X | name range_constraint X-- X-- A discrete subtype indication given as a type mark is included under "range". X Xcomponent_declaration{component_declaration} ::= X {pragma} {component_declaration} component_declaration {pragma} X X{component_declaration}variant_part ::= X {pragma} {component_declaration} variant_part {pragma} X XNULL; ::= {pragma} NULL ; {pragma} X X{component_declaration} ::= X empty X | {component_declaration} component_declaration {pragma} X X{;discriminant_specification} ::= X empty X | {;discriminant_specification} ; discriminant_specification X Xvariant{variant} ::= {pragma} variant {variant} X X-- Pragmas that can appear between two consecutive variants are picked X-- up in the component_list part of the variants themselves. X X{variant} ::= X empty X | {variant} variant X X{|choice} ::= X empty X | {|choice} '|' choice X Xsimple_expression__|__discrete_range__|__component_simple_name ::= X simple_expression X | name range_constraint X | simple_expression .. simple_expression X-- X-- The "simple_expression" by itself may be a "discrete_range" or a X-- "component_simple_name". X X[discriminant_part]; ::= X ; X | discriminant_part ; X X{basic_declarative_item}{later_declarative_item} ::= X {basic_declarative_item} X | {basic_declarative_item} body {later_declarative_item} X-- X-- A body is the only later_declarative_item that is not also a X-- basic_declarative_item. It is therefore used as the dividing X-- point between the two lists of declarative items. X X{basic_declarative_item} ::= X {pragma} X | {basic_declarative_item} basic_declarative_item {pragma} X X{later_declarative_item} ::= X {pragma} X | {later_declarative_item} later_declarative_item {pragma} X X X-- 4.1 X Xindexed_component__|__slice ::= indexed_component X-- X-- "slice" is included under "indexed_component". X Xname__|__function_call ::= name X-- X-- The definition of "name" includes "function_call". X-- A parameterless function call is recognized as a simple name or a X-- selected component. A function call with parameters is recognized X-- as an indexed component. X Xprefix(expression{,expression}) ::= X prefix aggregate X-- X-- This can be an attribute, indexed component, slice, or subprogram call. X Xsimple_name[(universal_static_expression)] ::= X simple_name X | DIGITS X | DELTA X | RANGE X-- X-- Reserved word attribute designators are included in the rules as a X-- convenience. Alternativly, since an attribute designator is always X preceded 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 universal static expression of an attribute designator is reduced X-- as an "indexed_component". X X{,component_association} ::= X empty X | {,component_association} , component_association X X[choice{|choice}=>]expression ::= X expression X | choice {|choice} => expression X | simple_expression .. simple_expression X | name range_constraint X X-- X-- Component associations are generalized to include discrete ranges. X-- Thus, an "aggregate" can be used for slices and index and discriminant X-- constraints. X Xrelation{AND__relation} ::= X relation AND relation X | relation{AND__relation} AND relation X Xrelation{OR__relation} ::= X relation OR relation X | relation{OR__relation} OR relation X Xrelation{XOR__relation} ::= X relation X | {XOR__relation} X X{XOR__relation} ::= X relation XOR relation X | {XOR__relation} XOR relation X Xrelation{AND__THEN__relation} ::= X relation AND THEN relation X | relation{AND__THEN__relation} AND THEN relation X Xrelation{OR__ELSE__relation} ::= X relation OR ELSE relation X | relation{OR__ELSE__relation} OR ELSE relation X X[relational_operator__simple_expression] ::= X empty X | relational_operator simple_expression X Xsimple_expression[NOT]IN__range__|__simple_expression[NOT]IN__type_mark ::= X simple_expression [NOT] IN range X-- X-- The "type_mark" is included under "range" X X[NOT] ::= X empty X | NOT X X[unary_adding_operator]term{binary_adding_operator__term} ::= X term X | unary_adding_operator term X | [unary_adding_operator]term{binary_adding_operator__term} X binary_adding_operator term X Xfactor{multiplying_operator__factor} ::= X factor X | factor{multiplying_operator__factor} multiplying_operator factor X X[**__primary] ::= X empty X | ** primary X Xname__|__string_literal__|__function_call__|__type_conversion ::= name X-- X-- "string_literal" is included under "name" as "operator_symbol". X-- "function_call" is included under "name". X-- "type_conversion" is included under "name". X Xaggregate__|__(expression) ::= aggregate X-- X-- "( expression )" is included under "aggregate". X Xtype_mark'aggregate__|__type_mark'(expression) ::= X prefix ' aggregate X-- X-- The "prefix must be a "type_mark". The "(expression)" is an "aggregate". X XNEW__qualified_expression ::= X NEW type_mark ' aggregate X-- X-- Here the "qualified_expression" can be given exactly X XNEW__subtype_indication ::= X NEW type_mark X | NEW type_mark aggregate X-- X-- We use the fact that the constraint must be an index or discriminant X-- constraint. X X X-- 5.1 X Xstatement{statement} ::= {pragma} statement {statement} X X{statement} ::= X {pragma} X | {statement} statement {pragma} X X X{label} ::= X empty X | {label} label X Xprocedure_call_statement__|__entry_call_statement ::= name ; X-- X-- Procedure and entry call statements are included under "name". X X X{ELSIF__condition__THEN__sequence_of_statements} ::= X empty X | {ELSIF__condition__THEN__sequence_of_statements} X ELSIF condition THEN X sequence_of_statements X X[ELSE__sequence_of_statements] ::= X empty X | ELSE X sequence_of_statements X Xcase_statement_alternative{case_statement_alternative} ::= X {pragma} X case_statement_alternative X {case_statement_alternative} X X{case_statement_alternative} ::= X empty X | {case_statement_alternative} case_statement_alternative X X[simple_name:] ::= X empty X | simple_name : X X[simple_name] ::= X empty X | simple_name X X[iteration_scheme] ::= X empty X | iteration_scheme X X[loop_simple_name:] ::= [simple_name:] X X[loop_simple_name] ::= [simple_name] X X[REVERSE] ::= X empty X | REVERSE X X[block_simple_name:] ::= [simple_name:] X X[block_simple_name] ::= [simple_name] X X[DECLARE__declarative_part] ::= X empty X | DECLARE X declarative_part X X[EXCEPTION__exception_handler{exception_handler}] ::= X empty X | EXCEPTION X {pragma} exception_handler_list X Xexception_handler_list ::= X exception_handler X | exception_handler_list exception_handler X X[loop_name] ::= [expanded_name] X X[expanded_name] ::= X empty X | expanded_name X X[WHEN__condition] ::= X empty X | WHEN condition X X[expression] ::= X empty X | expression X X X-- 6.1 X X[formal_part] ::= X empty X | formal_part X X{;parameter_specification} ::= X empty X | {;parameter_specification} ; parameter_specification X X[IN] ::= X empty X | IN X X[declarative_part] ::= declarative_part X-- X-- A "declarative_part" may be empty. X X[designator] ::= X empty X | designator X X X-- 7.1 X X[PRIVATE{basic_declarative_item}] ::= X empty X | PRIVATE X {basic_declarative_item} X X[BEGIN__sequence_of_statements[EXCEPTION__exception_handler{exception_handler}]] X ::= X empty X | BEGIN X sequence_of_statements X [EXCEPTION__exception_handler{exception_handler}] X X[LIMITED] ::= X empty X | LIMITED X X{,package_name} ::= X empty X | {,package_name} , package_name X X[package_simple_name] ::= [simple_name] X X X-- 8.1 X Xidentifier:type_mark ::= identifier_list : type_mark X-- X-- identifier_list in the two above rule must contain only one X-- identifier. X Xidentifier:EXCEPTION ::= identifier_list : EXCEPTION X-- X-- identifier_list in the two above rule must contain only one X-- identifier. X X X X-- 9.1 X X[TYPE] ::= X empty X | TYPE X X[IS{entry_declaration}{representation_clause}END[task_simple_name]] ::= X empty X | IS X {entry_declaration} X {representation_clause} X END [task_simple_name] X X[task_simple_name] ::= X [simple_name] X X{entry_declaration} ::= X {pragma} X | {entry_declaration} entry_declaration {pragma} X X{representation_clause} ::= X empty X | {representation_clause} representation_clause {pragma} X Xentry_name[actual_parameter_part] ::= {pragma} name X X[(discrete_range)][formal_part] ::= X [formal_part] X | ( discrete_range ) [formal_part] X X[(entry_index)][formal_part] ::= X [formal_part] X | ( entry_index ) [formal_part] X X[entry_simple_name] ::= [simple_name] X X[DO__sequence_of_statements__END[entry_simple_name]] ::= X empty X | DO X sequence_of_statements X END [entry_simple_name] X X{OR__select_alternative} ::= X empty X | {OR__select_alternative} OR select_alternative X X[WHEN__condition=>]selective_wait_alternative ::= X selective_wait_alternative X | WHEN condition => selective_wait_alternative X Xaccept_statement[sequence_of_statements] ::= X {pragma} accept_statement [sequence_of_statements] X Xdelay_statement[sequence_of_statements] ::= X {pragma} delay_statement [sequence_of_statements] X XTERMINATE; ::= {pragma} TERMINATE ; {pragma} X X[sequence_of_statements] ::= X {pragma} X | sequence_of_statements X X{,task_name} ::= X empty X | {,task_name} , task_name X X X X-- 10.1 X X{compilation_unit} ::= X {pragma} X | {compilation_unit} compilation_unit {pragma} X Xpackage_body__|__subprogram_body ::= package_body X-- X-- "subprogram_body" is already contained in the class "library_unit". X X{with_clause{use_clause}} ::= X empty X | {with_clause{use_clause}} with_clause use_clause_list X X Xuse_clause_list ::= X {pragma} X | use_clause_list use_clause {pragma} X X{,unit_simple_name} ::= X empty X | {,unit_simple_name} , unit_simple_name X X X X-- 11.1 X X{|exception_choice} ::= X empty X | {|exception_choice} '|' exception_choice X X[exception_name] ::= X [expanded_name] X X X X-- 12.1 X X{generic_parameter_declaration} ::= X empty X | {generic_parameter_declaration} generic_parameter_declaration X X[IN[OUT]] ::= X [IN] X | IN OUT X X[IS<>] ::= X empty X | IS name X | IS <> X XPROCEDURE__identifier__IS ::= subprogram_specification IS X-- X-- To avoid conflicts, the more general "subprogram_specification" is used. X X[generic_actual_part] ::= X empty X | generic_actual_part X X{,generic_association} ::= X empty X | {,generic_association} , generic_association X X[generic_formal_parameter=>]generic_actual_parameter ::= X generic_actual_parameter X | generic_formal_parameter => generic_actual_parameter X Xexpression__|__variable_name__|__subprogram_name__|__entry_name__|__type_mark X ::= expression X-- X-- The above alternatives are included under "expression". X X X-- 13.1 X XFOR__type_simple_name__USE ::= X FOR simple_name USE X-- X-- The "simple_name" must be a "type_simple_name". X X[alignment_clause] ::= X {pragma} X | {pragma} alignment_clause {pragma} X X{component_clause} ::= X empty X | {component_clause} component_clause {pragma} X Xtype_mark'record_aggregate ::= qualified_expression X-- X-- The qualified expression must contain a record aggregate. X X----------------------------------------------------------------------------- X X end X X X *-*-END-of-ada.doc-*-* 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: 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 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-*-* echo x - release sed 's/^X//' >release <<'*-*-END-of-release-*-*' XThanks for your response to my posting to comp.lang.ada. The YACC and LEX Xfor Ada are much too large to send as one piece, so I've broken the mailing Xdown into three pieces: X X 1) a README, an "ada.doc" and a distribution list; X 2) The Ada YACC specs X 3) The Ada LEX specs X X XIf you don't get all three of these very very soon, let me know so I can Xremail them. X XHappy hacking! X X -Jeff *-*-END-of-release-*-* exit