# include "rag.hh"
# include "nodes.h"
# include "grc.h"

IAT* grnl= NULL;

# include "swbus.h"

/* KJT 20/01/23: added "void" type */
void PROCESINI (r)
    TNODE* r;
{
  TNODE* h[33];
  /* KJT 20/01/23: added "int" type */
  register int i;
  int nr;
  int* grl;

  while (r != NULL) {
    h[0]= r;
    heval (r, h);
    grl= grnl->data[(int)(r->value0)];
    for (i= 0; grl[i] != 0; i++) {
     nr= grl[i];
     switch (nr) {
      case _specification_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_specification, h[0], 1);
	 if (h[0] != NULL)
	  adclr (-c_ccr_annotation_list, h[0], 2);
	 break;
      case _definition_block_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_definition_block, h[0], 3);
	 break;
      case _local_definitions_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_data_type_definition_list, h[0], 4);
	 if (h[0] != NULL)
	  adclr (-c_ccr_process_definition_list, h[0], 5);
	 break;
      case _data_type_definitions_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_data_type_definition_list, h[0], 6);
	 break;
      case _type_definition_1:
	 adclr (-c_mylexv, h[2], 7);
	 adclr (-c_mytid, h[2], 8);
	 adclr (-c_ccr_flattened_type_definition, h[0], 9);
	 adclr (-c_ccr_data_type_definition, h[0], 10);
	 adclr (-c_ccr_process_definition, h[0], 11);
	 break;
      case _library_declaration_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_process_definition, h[0], 12);
	 h[3]= h[1];
	 h[4]= gt_rb (h[3]);
	 while (h[3] != NULL) {
	  adclr (-c_ccr_data_type_definition, h[3], 13);
	  h[3]= h[4];
	  h[4]= gt_rb (h[4]);
	 }
	 if (h[0] != NULL)
	  adclr (-c_ccr_data_type_definition_list, h[0], 14);
	 break;
      case _p_expression_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_p_expression, h[0], 15);
	 if (h[0] != NULL)
	  adclr (-c_ccr_type_identifier_list, h[0], 16);
	 if (h[0] != NULL)
	  adclr (-c_ccr_formal_sort_declaration_list, h[0], 17);
	 if (h[0] != NULL)
	  adclr (-c_ccr_formal_operation_list, h[0], 18);
	 if (h[0] != NULL)
	  adclr (-c_ccr_formal_equations_option, h[0], 19);
	 if (h[0] != NULL)
	  adclr (-c_ccr_sort_declaration_list, h[0], 20);
	 if (h[0] != NULL)
	  adclr (-c_ccr_operation_list, h[0], 21);
	 if (h[0] != NULL)
	  adclr (-c_ccr_actual_equations_option, h[0], 22);
	 break;
      case _p_expression_2:
	 adclr (-c_mytid, h[3], 23);
	 adclr (-c_ccr_p_expression, h[0], 24);
	 break;
      case _p_expression_3:
	 adclr (-c_mytid, h[2], 25);
	 adclr (-c_ccr_p_expression, h[0], 26);
	 break;
      case _type_union_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_type_identifier_list, h[0], 27);
	 break;
      case _p_specification_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_formal_sort_declaration_list, h[0], 28);
	 if (h[0] != NULL)
	  adclr (-c_ccr_formal_operation_list, h[0], 29);
	 if (h[0] != NULL)
	  adclr (-c_ccr_formal_equations_option, h[0], 30);
	 if (h[0] != NULL)
	  adclr (-c_ccr_sort_declaration_list, h[0], 31);
	 if (h[0] != NULL)
	  adclr (-c_ccr_operation_list, h[0], 32);
	 if (h[0] != NULL)
	  adclr (-c_ccr_actual_equations_option, h[0], 33);
	 break;
      case _replacement_1:
	 if (h[1] != NULL)
	  adclr (-c_mytid, h[1], 34);
	 if (h[0] != NULL)
	  adclr (-c_ccr_replacement, h[0], 35);
	 break;
      case _sort_pair_list_1:
	 h[3]= h[1];
	 h[4]= gt_rb (h[3]);
	 while (h[3] != NULL) {
	  adclr (-c_mytid, h[3], 36);
	  h[3]= h[4];
	  h[4]= gt_rb (h[4]);
	 }
	 if (h[0] != NULL)
	  adclr (-c_ccr_sort_replacement_list, h[0], 37);
	 break;
      case _operation_pair_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_operation_replacement_list, h[0], 38);
	 break;
      case _sort_pair_1:
	 adclr (-c_ccr_sort_replacement, h[0], 39);
	 break;
      case _operation_pair_1:
	 adclr (-c_ccr_operation_replacement, h[0], 40);
	 break;
      case _formal_sorts_1:
	 h[3]= h[1];
	 h[4]= gt_rb (h[3]);
	 while (h[3] != NULL) {
	  adclr (-c_ccr_sort_declaration, h[3], 41);
	  h[3]= h[4];
	  h[4]= gt_rb (h[4]);
	 }
	 if (h[0] != NULL)
	  adclr (-c_ccr_formal_sort_declaration_list, h[0], 42);
	 break;
      case _formal_operations_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_formal_operation_list, h[0], 43);
	 break;
      case _formal_equations_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_formal_equations_option, h[0], 44);
	 break;
      case _sorts_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_sort_declaration_list, h[0], 45);
	 break;
      case _sort_id_comm_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_sort_declaration, h[0], 46);
	 break;
      case _operations_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_operation_list, h[0], 47);
	 break;
      case _operation_1:
	 if (h[1] != NULL)
	  adclr (-c_ccr_sort_identifier_list, h[1], 48);
	 if (h[1] != NULL)
	  adclr (-c_ccr_sort_identifier, h[1], 49);
	 if (h[0] != NULL)
	  adclr (-c_ccr_operation_list, h[0], 50);
	 break;
      case _descriptor_list_1:
	 h[3]= h[1];
	 h[4]= gt_rb (h[3]);
	 while (h[3] != NULL) {
	  adclr (-c_ccr_operation, h[3], 51);
	  h[3]= h[4];
	  h[4]= gt_rb (h[4]);
	 }
	 if (h[0] != NULL)
	  adclr (-c_ccr_operation_list, h[0], 52);
	 break;
      case _operation_descriptor_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_prefix_infix, h[0], 53);
	 if (h[0] != NULL)
	  adclr (-c_ccr_operation_identifier, h[0], 54);
	 if (h[0] != NULL)
	  adclr (-c_mylexv, h[0], 55);
	 if (h[0] != NULL)
	  adclr (-c_ccr_annotation_list, h[0], 56);
	 break;
      case _operation_descriptor_2:
	 if (h[0] != NULL)
	  adclr (-c_ccr_prefix_infix, h[0], 57);
	 if (h[0] != NULL)
	  adclr (-c_ccr_operation_identifier, h[0], 58);
	 if (h[0] != NULL)
	  adclr (-c_mylexv, h[0], 59);
	 if (h[0] != NULL)
	  adclr (-c_ccr_annotation_list, h[0], 60);
	 break;
      case _argument_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_sort_identifier_list, h[0], 61);
	 break;
      case _equations_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_actual_equations_option, h[0], 62);
	 break;
      case _equation_lists_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_equation_structure_list, h[0], 63);
	 break;
      case _equation_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_equation_structure, h[0], 64);
	 break;
      case _eqn_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_equation_list, h[0], 65);
	 break;
      case _equation_1:
	 adclr (-c_ccr_equation, h[0], 66);
	 break;
      case _equation_2:
	 adclr (-c_ccr_equation, h[0], 67);
	 break;
      case _premisses_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_premiss_list, h[0], 68);
	 break;
      case _simple_equation_1:
	 adclr (-c_ccr_equality, h[0], 69);
	 break;
      case _process_definition_1:
	 adclr (-c_ccr_process_definition, h[0], 70);
	 adclr (-c_ccr_data_type_definition, h[0], 71);
	 break;
      case _formal_parameter_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_functionality, h[0], 72);
	 if (h[0] != NULL)
	  adclr (-c_ccr_gate_identifier_list, h[0], 73);
	 if (h[0] != NULL)
	  adclr (-c_ccr_identifier_declaration_list, h[0], 74);
	 break;
      case _gate_parameter_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_gate_identifier_list, h[0], 75);
	 break;
      case _value_parameter_list_1:
	 adclr (-c_ccr_identifier_declaration_list, h[0], 76);
	 break;
      case _functionality_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_functionality, h[0], 77);
	 break;
      case _functionality_list_2:
	 adclr (-c_ccr_functionality, h[0], 78);
	 break;
      case _exit_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_sort_identifier_list, h[0], 79);
	 break;
      case _local_definition_expression_1:
	 adclr (-c_ccr_behaviour_expression, h[0], 80);
	 break;
      case _identifier_equations_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_identifier_equation_list, h[0], 81);
	 break;
      case _identifier_equation_1:
	 adclr (-c_ccr_identifier_equation, h[0], 82);
	 break;
      case _sum_expression_1:
	 adclr (-c_ccr_behaviour_expression, h[0], 83);
	 break;
      case _par_expression_1:
	 adclr (-c_ccr_behaviour_expression, h[0], 84);
	 break;
      case _parallel_operator_1:
	 adclr (-c_ccr_parallel_operator, h[0], 85);
	 break;
      case _parallel_operator_2:
	 adclr (-c_ccr_parallel_operator, h[0], 86);
	 break;
      case _parallel_operator_3:
	 if (h[0] != NULL)
	  adclr (-c_ccr_parallel_operator, h[0], 87);
	 break;
      case _hiding_expression_1:
	 adclr (-c_ccr_behaviour_expression, h[0], 88);
	 break;
      case _enable_expression_1:
	 adclr (-c_ccr_behaviour_expression, h[0], 89);
	 break;
      case _enable_operator_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_identifier_declaration_list, h[0], 90);
	 break;
      case _disable_expression_1:
	 adclr (-c_ccr_behaviour_expression, h[0], 91);
	 break;
      case _parallel_expression_1:
	 adclr (-c_ccr_behaviour_expression, h[0], 92);
	 break;
      case _choice_expression_1:
	 adclr (-c_ccr_behaviour_expression, h[0], 93);
	 break;
      case _guarded_expression_1:
	 adclr (-c_ccr_behaviour_expression, h[0], 94);
	 break;
      case _action_prefix_expression_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_behaviour_expression, h[0], 95);
	 break;
      case _action_denotation_1:
	 if (h[0] != NULL)
	  adclr (-c_mylexv, h[0], 96);
	 if (h[0] != NULL)
	  adclr (-c_ccr_annotation_list, h[0], 97);
	 if (h[0] != NULL)
	  adclr (-c_ccr_action_denotation, h[0], 98);
	 break;
      case _action_denotation_2:
	 if (h[0] != NULL)
	  adclr (-c_mylexv, h[0], 99);
	 if (h[0] != NULL)
	  adclr (-c_ccr_annotation_list, h[0], 100);
	 if (h[0] != NULL)
	  adclr (-c_ccr_action_denotation, h[0], 101);
	 break;
      case _action_denotation_3:
	 if (h[0] != NULL)
	  adclr (-c_mylexv, h[0], 102);
	 if (h[0] != NULL)
	  adclr (-c_ccr_action_denotation, h[0], 103);
	 if (h[0] != NULL)
	  adclr (-c_ccr_annotation_list, h[0], 104);
	 break;
      case _experiment_offer_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_experiment_offer_list, h[0], 105);
	 break;
      case _experiment_offer_1:
	 adclr (-c_ccr_experiment_offer, h[0], 106);
	 break;
      case _experiment_offer_2:
	 adclr (-c_ccr_experiment_offer, h[0], 107);
	 break;
      case _selection_predicate_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_guard_option, h[0], 108);
	 break;
      case _atomic_expression_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_behaviour_expression, h[0], 109);
	 break;
      case _atomic_expression_2:
	 if (h[0] != NULL)
	  adclr (-c_ccr_behaviour_expression, h[0], 110);
	 break;
      case _atomic_expression_3:
	 if (h[0] != NULL)
	  adclr (-c_ccr_behaviour_expression, h[0], 111);
	 break;
      case _exit_entry_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_exit_entry_list, h[0], 112);
	 break;
      case exit_entry_1:
	 adclr (-c_ccr_exit_entry, h[0], 113);
	 break;
      case exit_entry_2:
	 adclr (-c_ccr_exit_entry, h[0], 114);
	 break;
      case _process_instantiation_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_behaviour_expression, h[0], 115);
	 break;
      case _actual_gate_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_gate_identifier_list, h[0], 116);
	 break;
      case _value_expression_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_value_expression, h[0], 117);
	 break;
      case _value_expression_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_value_expression_list, h[0], 118);
	 break;
      case _identifier_declarations_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_identifier_declaration_list, h[0], 119);
	 if (h[0] != NULL)
	  adclr (-c_ccr_gate_declaration_list, h[0], 120);
	 break;
      case _identifier_declaration_1:
	 adclr (-c_ccr_identifier_declaration, h[0], 121);
	 break;
      case _gate_declarations_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_gate_declaration_list, h[0], 122);
	 if (h[0] != NULL)
	  adclr (-c_ccr_identifier_declaration_list, h[0], 123);
	 break;
      case _gate_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_gate_identifier_list, h[0], 124);
	 break;
      case _gate_declaration_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_gate_identifier_list, h[0], 125);
	 break;
      case _gate_declaration_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_gate_declaration, h[0], 126);
	 break;
      case _identifier_declaration_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_gate_identifier_list, h[0], 127);
	 if (h[0] != NULL)
	  adclr (-c_ccr_value_identifier_list, h[0], 128);
	 break;
      case _specification_identifier_1:
	 adclr (-c_ccr_specification_identifier, h[0], 129);
	 break;
      case _type_identifier_1:
	 adclr (-c_ccr_type_identifier, h[0], 130);
	 break;
      case _sort_identifier_1:
	 adclr (-c_ccr_sort_identifier, h[0], 131);
	 break;
      case _operation_identifier_1:
	 adclr (-c_ccr_operation_identifier, h[0], 132);
	 break;
      case _operation_identifier_2:
	 adclr (-c_ccr_operation_identifier, h[0], 133);
	 break;
      case _process_identifier_1:
	 adclr (-c_ccr_process_identifier, h[0], 134);
	 break;
      case _gate_identifier_1:
	 adclr (-c_ccr_gate_identifier, h[0], 135);
	 break;
      case _identifier_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_gate_identifier, h[0], 136);
	 if (h[0] != NULL)
	  adclr (-c_ccr_value_identifier, h[0], 137);
	 if (h[0] != NULL)
	  adclr (-c_ccr_annotated_value_identifier, h[0], 138);
	 break;
      case _executable_comment_list_1:
	 if (h[0] != NULL)
	  adclr (-c_ccr_annotation_list, h[0], 139);
	 break;
      case _excomm_1:
	 adclr (-c_ccr_casestring, h[0], 140);
	 break;
      default:
	 assert ((1 <= nr) && (nr <= LAST_RULE));
      }
    } /* end of while (ngr != NULL) */
    r= succ (r, PREORDER);
  } /* end of while (r != NULL) */
} /* end of PROCESINI */

PUBLIC CLR_TYPE
eval (nar, r)
    int nar;
    TNODE* r;
{
  TNODE* h[33];

  if (r == NULL) return (CLR_TYPE)NULL;
  switch (nar) {
  case 1:
    h[0]= r;
    heval (h[0], h);

    return (CLR_TYPE) CR_Spec(
      make_cr_label (Getlexv((int)fdclr (c_iddec,h[1], nar)), nar),
      Nilcr_comment_list (),
      (cr_specification_identifier)
	  fdclr (c_ccr_specification_identifier,h[1], nar),
      (cr_gate_identifier_list)
	  fdclr (c_ccr_gate_identifier_list,h[2], nar),
      (cr_identifier_declaration_list)
	  fdclr (c_ccr_identifier_declaration_list,h[2], nar),
      (cr_functionality)fdclr (c_ccr_functionality,h[2], nar),
      (cr_data_type_definition_list)
	  fdclr (c_ccr_data_type_definition_list,h[4], nar),
      Nilcr_comment_list (),
      (cr_definition_block)fdclr (c_ccr_definition_block,h[5], nar),
      CR_Booleans_NotChecked (),
      (cr_annotation_list)fdclr (c_ccr_annotation_list,h[0], nar),
      CR_IS8807 ());
  case 2:
    h[0]= r;
    heval (h[0], h);

     if ((h[3] != NULL) && (h[6] != NULL))
	return (CLR_TYPE) concat_cr_annotation_list (
	   (cr_annotation_list)fdclr (c_ccr_annotation_list,h[3], nar),
	   (cr_annotation_list)fdclr (c_ccr_annotation_list,h[6], nar));
     if ((h[3] != NULL) && (h[6] == NULL))
	return (CLR_TYPE) fdclr (c_ccr_annotation_list,h[3], nar);
     if ((h[3] == NULL) && (h[6] != NULL))
	return (CLR_TYPE) fdclr (c_ccr_annotation_list,h[6], nar);
      return (CLR_TYPE) Nilcr_annotation_list ();
  case 3:
    h[0]= r;
    heval (h[0], h);

    return (CLR_TYPE) ((h[2] == NULL)
    ? CR_Definition_block
	 ((cr_behaviour_expression)
			   fdclr (c_ccr_behaviour_expression,h[1], nar),
	  Nilcr_data_type_definition_list (),
	  Nilcr_process_definition_list ())
    : CR_Definition_block
	 ((cr_behaviour_expression)
			   fdclr (c_ccr_behaviour_expression,h[1], nar),
	  (cr_data_type_definition_list)
			   fdclr (c_ccr_data_type_definition_list,h[2], nar),
	  (cr_process_definition_list)
			   fdclr (c_ccr_process_definition_list,h[2], nar)));
  case 4:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (mkconscr_data_type_definition_list, h[1],
	     c_ccr_data_type_definition, Nilcr_data_type_definition_list (),
	     nar);
  case 5:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (mkconscr_process_definition_list, h[1],
	     c_ccr_process_definition, Nilcr_process_definition_list (),
	     nar);
  case 6:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

   /* The first sen_reduce concat all data_type_definition_list */
   /* provided by the library_declaration.                      */
   /* The second sen_reduce make a data_type_definition_list    */
   /* by collenting all data_type_definition provided by        */
   /* the type_definition.                                      */
   /* In other words, each _library_declaration provided a      */
   /* cr_data_type_definition_list and each _type_definition    */
   /* provides a cr_data_type_definition.                       */
/* KJT 22/01/23: suppress complaint about "sen_rduce" being implicit */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
	return (CLR_TYPE) concat_cr_data_type_definition_list (
		(cr_data_type_definition_list)
		 sen_reduce (concat_cr_data_type_definition_list,
			     h[1],
			     c_ccr_data_type_definition_list,
			     Nilcr_data_type_definition_list(),
			     tlibrary_declaration,
			     nar),
		(cr_data_type_definition_list)
		 sen_reduce (Conscr_data_type_definition_list,
			     h[1],
			     c_ccr_data_type_definition,
			     Nilcr_data_type_definition_list(),
			     ttype_definition,
			     nar));
#pragma GCC diagnostic pop
  case 7:
    h[0]= gt_ft (r);
    heval (h[0], h);

     /* Solo para generar la cr_label de la p_expression */
      return (CLR_TYPE) Getlexv ((int)fdclr (c_iddec,h[1], nar));
  case 8:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) Getid((TNODE*)h[1], nar);
  case 9:
    h[0]= r;
    heval (h[0], h);

     if (find_attr (c_yes_sflat, h[0]) != NULL) {
       if (find_attr (c_isformal, h[0]) != NULL)
	  return (CLR_TYPE) CR_Formal_type
       ((cr_type_identifier_list)fdclr (c_ccr_type_identifier_list,h[2], nar),
	(cr_sort_declaration_list)
			       fdclr (c_ccr_formal_sort_declaration_list,h[2], nar),
	(cr_operation_list)fdclr (c_ccr_formal_operation_list,h[2], nar),
	(cr_equations_option)fdclr (c_ccr_formal_equations_option,h[2], nar),
	(cr_sort_declaration_list)fdclr (c_ccr_sort_declaration_list,h[2], nar),
	(cr_operation_list)fdclr (c_ccr_operation_list,h[2], nar),
	(cr_equations_option)fdclr (c_ccr_actual_equations_option,h[2], nar));
       else
	  return (CLR_TYPE) CR_Actual_type
	 ((cr_type_identifier_list)fdclr (c_ccr_type_identifier_list,h[2], nar),
	  (cr_sort_declaration_list)fdclr (c_ccr_sort_declaration_list,h[2], nar),
	  (cr_operation_list)fdclr (c_ccr_operation_list,h[2], nar),
	  (cr_equations_option)fdclr (c_ccr_actual_equations_option,h[2], nar));
     }
     else {
	return (CLR_TYPE) find_attr (c_ccr_flattened_type_definition,
			 sflt[(int)fdclr (c_iddec,h[1], nar)])->value;
     };
  case 10:
    h[0]= r;
    heval (h[0], h);

     if (find_attr (c_yes_sflat, h[0]) != NULL)
	return (CLR_TYPE) NULL;
     else
	return (CLR_TYPE) CR_Data_type_definition
	 (Nilcr_comment_list (),
	  (cr_type_identifier)fdclr (c_ccr_type_identifier,h[1], nar),
	  (cr_p_expression)fdclr (c_ccr_p_expression,h[2], nar),
	  CR_Completeness_NotChecked (),
	  CR_Persistency_NotChecked (),
	  (cr_flattened_type_definition)
			     fdclr (c_ccr_flattened_type_definition,h[0], nar),
	  Nilcr_annotation_list ());
  case 11:
    h[0]= r;
    heval (h[0], h);

       /* This is needed to make the lists correctly in _local_definitions */
	return (CLR_TYPE) NULL;
  case 12:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

       /* This is needed to make the lists correctly in _local_definitions */
	return (CLR_TYPE) NULL;
  case 13:
    h[0]= gt_ft (r);
    h[1]= gt_fs (h[0]);
    h[3]= r;
    h[4]= gt_rb (h[3]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) CR_Library_reference
       ((cr_type_identifier)fdclr (c_ccr_type_identifier,h[3], nar),
	(cr_flattened_type_definition)
	    find_attr (c_ccr_flattened_type_definition,
		       sflt[(int)fdclr (c_idref,h[3], nar)])->value,
	Nilcr_annotation_list ());
  case 14:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_data_type_definition_list, h[1],
	       c_ccr_data_type_definition, Nilcr_data_type_definition_list(),
	       nar);
  case 15:
    h[0]= r;
    heval (h[0], h);

   if (h[1] == NULL)
      return (CLR_TYPE) CR_P_Spec
      (Nilcr_type_identifier_list (),
       (cr_sort_declaration_list)
			    fdclr (c_ccr_formal_sort_declaration_list,h[2], nar),
       (cr_operation_list)fdclr (c_ccr_formal_operation_list,h[2], nar),
       (cr_equations_option)fdclr (c_ccr_formal_equations_option,h[2], nar),
       (cr_sort_declaration_list)fdclr (c_ccr_sort_declaration_list,h[2], nar),
       (cr_operation_list)fdclr (c_ccr_operation_list,h[2], nar),
       (cr_equations_option)fdclr (c_ccr_actual_equations_option,h[2], nar),
       make_cr_label((char*)fdclr (c_mylexv,h[0], nar), nar));
   else  return (CLR_TYPE) CR_P_Spec
      ((cr_type_identifier_list)fdclr (c_ccr_type_identifier_list,h[1], nar),
       (cr_sort_declaration_list)
			    fdclr (c_ccr_formal_sort_declaration_list,h[2], nar),
       (cr_operation_list)fdclr (c_ccr_formal_operation_list,h[2], nar),
       (cr_equations_option)fdclr (c_ccr_formal_equations_option,h[2], nar),
       (cr_sort_declaration_list)fdclr (c_ccr_sort_declaration_list,h[2], nar),
       (cr_operation_list)fdclr (c_ccr_operation_list,h[2], nar),
       (cr_equations_option)fdclr (c_ccr_actual_equations_option,h[2], nar),
       make_cr_label((char*)fdclr (c_mylexv,h[0], nar), nar));
  case 16:
    h[0]= r;
    heval (h[0], h);

   if (h[1] == NULL)
      return (CLR_TYPE) Nilcr_type_identifier_list ();
   else  return (CLR_TYPE) fdclr (c_ccr_type_identifier_list,h[1], nar);
  case 17:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_formal_sort_declaration_list,h[2], nar);
  case 18:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_formal_operation_list,h[2], nar);
  case 19:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_formal_equations_option,h[2], nar);
  case 20:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_sort_declaration_list,h[2], nar);
  case 21:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_operation_list,h[2], nar);
  case 22:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_actual_equations_option,h[2], nar);
  case 23:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_mytid,h[0], nar);
  case 24:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Actualization
	      ((cr_type_identifier)fdclr (c_ccr_type_identifier,h[1], nar),
	       (cr_type_identifier_list)fdclr (c_ccr_type_identifier_list,h[2], nar),
	       (cr_replacement)fdclr (c_ccr_replacement,h[3], nar),
	       make_cr_label((char*)fdclr (c_mylexv,h[0], nar), nar));
  case 25:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_mytid,h[0], nar);
  case 26:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Renaming
	      ((cr_type_identifier)fdclr (c_ccr_type_identifier,h[1], nar),
	       (cr_replacement)fdclr (c_ccr_replacement,h[2], nar),
	       make_cr_label((char*)fdclr (c_mylexv,h[0], nar), nar));
  case 27:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_type_identifier_list, h[1],
	     c_ccr_type_identifier, Nilcr_type_identifier_list(), nar);
  case 28:
    h[0]= r;
    heval (h[0], h);

   if (h[1] == NULL)
      return (CLR_TYPE) Nilcr_sort_declaration_list ();
   else  return (CLR_TYPE) fdclr (c_ccr_formal_sort_declaration_list,h[1], nar);
  case 29:
    h[0]= r;
    heval (h[0], h);

   if (h[2] == NULL)
      return (CLR_TYPE) Nilcr_operation_list ();
   else  return (CLR_TYPE) fdclr (c_ccr_formal_operation_list,h[2], nar);
  case 30:
    h[0]= r;
    heval (h[0], h);

   if (h[3] == NULL)
      return (CLR_TYPE) CR_NoEquations ();
   else  return (CLR_TYPE) fdclr (c_ccr_formal_equations_option,h[3], nar);
  case 31:
    h[0]= r;
    heval (h[0], h);

   if (h[4] == NULL)
      return (CLR_TYPE) Nilcr_sort_declaration_list ();
   else  return (CLR_TYPE) fdclr (c_ccr_sort_declaration_list,h[4], nar);
  case 32:
    h[0]= r;
    heval (h[0], h);

   if (h[5] == NULL)
      return (CLR_TYPE) Nilcr_operation_list ();
   else  return (CLR_TYPE) fdclr (c_ccr_operation_list,h[5], nar);
  case 33:
    h[0]= r;
    heval (h[0], h);

   if (h[6] == NULL)
      return (CLR_TYPE) CR_NoEquations ();
   else  return (CLR_TYPE) fdclr (c_ccr_actual_equations_option,h[6], nar);
  case 34:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_mytid,h[0], nar);
  case 35:
    h[0]= r;
    heval (h[0], h);

   if ((h[1] != NULL) && (h[2] != NULL))
      return (CLR_TYPE) CR_Replacement
		((cr_sort_replacement_list)
			 fdclr (c_ccr_sort_replacement_list,h[1], nar),
		 (cr_operation_replacement_list)
			 fdclr (c_ccr_operation_replacement_list,h[2], nar));
   else if (h[1] != NULL)
      return (CLR_TYPE) CR_Replacement
		((cr_sort_replacement_list)
			 fdclr (c_ccr_sort_replacement_list,h[1], nar),
		 Nilcr_operation_replacement_list ());
   else if (h[2] != NULL)
      return (CLR_TYPE) CR_Replacement
		(Nilcr_sort_replacement_list (),
		 (cr_operation_replacement_list)
			 fdclr (c_ccr_operation_replacement_list,h[2], nar));
   else
      return (CLR_TYPE) CR_Replacement
		(Nilcr_sort_replacement_list (),
		 Nilcr_operation_replacement_list ());
  case 36:
    h[0]= gt_ft (r);
    h[1]= gt_fs (h[0]);
    h[3]= r;
    h[4]= gt_rb (h[3]);
    h[5]= gt_ls (h[0]);
   return (CLR_TYPE) fdclr (c_mytid,h[0], nar);
  case 37:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_sort_replacement_list, h[1],
		    c_ccr_sort_replacement, Nilcr_sort_replacement_list (),
		    nar);
  case 38:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_operation_replacement_list, h[1],
		    c_ccr_operation_replacement,
		    Nilcr_operation_replacement_list (), nar);
  case 39:
    h[0]= r;
    heval (h[0], h);

 /*FALTA QUE LA cr_label DE LA PARTE SEMIAPLANADA SEA IGUAL A LA DE SIN APLANAR*/
      return (CLR_TYPE) CR_Sort_replacement
	     (CR_Sort_name (CR_Name (
		  mknocasestring (
		   (char*)SymbolTable->data[(int)fdclr (c_lexv,h[1], nar)]))
	      ),
	      CR_Sort_name (CR_Name (
		  mknocasestring (
		   (char*)SymbolTable->data[(int)fdclr (c_lexv,h[2], nar)]))
	      ),
	      make_cr_label (
		   (char*)SymbolTable->data[(int)fdclr (c_lexv,h[1], nar)], nar)
	     );
  case 40:
    h[0]= r;
    heval (h[0], h);

 /*FALTA QUE LA cr_label DE LA PARTE SEMIAPLANADA SEA IGUAL A LA DE SIN APLANAR*/
      return (CLR_TYPE) CR_Operation_replacement
	     (CR_Operation_name (CR_Name (
		 mknocasestring (
		   (char*)SymbolTable->data[(int)fdclr (c_lexv,h[1], nar)]))
	      ),
	      CR_Operation_name (CR_Name (
		 mknocasestring (
		   (char*)SymbolTable->data[(int)fdclr (c_lexv,h[2], nar)]))
	      ),
	      make_cr_label (
	       (char*)SymbolTable->data[(int)fdclr (c_lexv,h[1], nar)], nar)
	     );
  case 41:
    h[0]= gt_ft (r);
    h[1]= gt_fs (h[0]);
    h[3]= r;
    h[4]= gt_rb (h[3]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) CR_Sort_declaration
       ((cr_sort_identifier)fdclr (c_ccr_sort_identifier,h[3], nar),
	make_cr_label(Getlexv((int)fdclr (c_iddec,h[3], nar)), nar),
	Nilcr_annotation_list ());
  case 42:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_sort_declaration_list, h[1],
	     c_ccr_sort_declaration, Nilcr_sort_declaration_list(), nar);
  case 43:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (concat_cr_operation_list, h[1],
		    c_ccr_operation_list, Nilcr_operation_list(), nar);
  case 44:
    h[0]= r;
    heval (h[0], h);

   if (h[1] == NULL)
      return (CLR_TYPE) CR_YesEquations
	     (Nilcr_identifier_declaration_list (),
	     (cr_equation_structure_list)
		   fdclr (c_ccr_equation_structure_list,h[2], nar));
   else  return (CLR_TYPE) CR_YesEquations
	    ((cr_identifier_declaration_list)
		   fdclr (c_ccr_identifier_declaration_list,h[1], nar),
	    (cr_equation_structure_list)
		   fdclr (c_ccr_equation_structure_list,h[2], nar));
  case 45:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_sort_declaration_list, h[1],
	     c_ccr_sort_declaration, Nilcr_sort_declaration_list(), nar);
  case 46:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) ((h[2] == NULL)
      ? CR_Sort_declaration
	 ((cr_sort_identifier)fdclr (c_ccr_sort_identifier,h[1], nar),
	  make_cr_label(Getlexv((int)fdclr (c_iddec,h[1], nar)), nar),
	  Nilcr_annotation_list())
      : CR_Sort_declaration
	 ((cr_sort_identifier)fdclr (c_ccr_sort_identifier,h[1], nar),
	  make_cr_label(Getlexv((int)fdclr (c_iddec,h[1], nar)), nar),
	  (cr_annotation_list)fdclr (c_ccr_annotation_list,h[2], nar)));
  case 47:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (concat_cr_operation_list, h[1],
		    c_ccr_operation_list, Nilcr_operation_list(), nar);
  case 48:
    h[0]= gt_ft (r);
    heval (h[0], h);

     if (h[2] == NULL)
	return (CLR_TYPE) Nilcr_sort_identifier_list ();
     else  return (CLR_TYPE) fdclr (c_ccr_sort_identifier_list,h[2], nar);
  case 49:
    h[0]= gt_ft (r);
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_sort_identifier,h[3], nar);
  case 50:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_operation_list,h[1], nar);
  case 51:
    h[0]= gt_ft (r);
    h[1]= gt_fs (h[0]);
    h[3]= r;
    h[4]= gt_rb (h[3]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) CR_Operation
       ((cr_operation_identifier)
			       fdclr (c_ccr_operation_identifier,h[3], nar),
	(cr_prefix_infix)fdclr (c_ccr_prefix_infix,h[3], nar),
	(cr_sort_identifier_list)fdclr (c_ccr_sort_identifier_list,h[0], nar),
	(cr_sort_identifier)fdclr (c_ccr_sort_identifier,h[0], nar),
	CR_Default (),
	CR_Unknown (),
	make_cr_label((char*)fdclr (c_mylexv,h[3], nar), nar),
	(cr_annotation_list)fdclr (c_ccr_annotation_list,h[3], nar));
  case 52:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_operation_list, h[1],
		    c_ccr_operation, Nilcr_operation_list(), nar);
  case 53:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) CR_Prefix ();
  case 54:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_operation_identifier,h[1], nar);
  case 55:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) Getlexv((int)fdclr (c_iddec,h[1], nar));
  case 56:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) ((h[2] == NULL)
	     ? (CLR_TYPE) Nilcr_annotation_list ()
	     : fdclr (c_ccr_annotation_list,h[2], nar));
  case 57:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) CR_Infix ();
  case 58:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_operation_identifier,h[1], nar);
  case 59:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) Getlexv((int)fdclr (c_iddec,h[1], nar));
  case 60:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) ((h[2] == NULL)
	     ? (CLR_TYPE) Nilcr_annotation_list ()
	     : fdclr (c_ccr_annotation_list,h[2], nar));
  case 61:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_sort_identifier_list, h[1],
		  c_ccr_sort_identifier, Nilcr_sort_identifier_list(), nar);
  case 62:
    h[0]= r;
    heval (h[0], h);

   if (h[1] == NULL)
      return (CLR_TYPE) CR_YesEquations
       (Nilcr_identifier_declaration_list (),
     (cr_equation_structure_list)fdclr (c_ccr_equation_structure_list,h[2], nar));
   else  return (CLR_TYPE) CR_YesEquations
    ((cr_identifier_declaration_list)
		   fdclr (c_ccr_identifier_declaration_list,h[1], nar),
    (cr_equation_structure_list)fdclr (c_ccr_equation_structure_list,h[2], nar));
  case 63:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_equation_structure_list, h[1],
	       c_ccr_equation_structure, Nilcr_equation_structure_list(), nar);
  case 64:
    h[0]= r;
    heval (h[0], h);

   if (h[2] == NULL)
	/* no hay identifier_declarations */
      return (CLR_TYPE) CR_Equation_structure
       ((cr_sort_identifier)fdclr (c_ccr_sort_identifier,h[1], nar),
	Nilcr_identifier_declaration_list(),
	(cr_equation_list)fdclr (c_ccr_equation_list,h[3], nar));
   else  return (CLR_TYPE) CR_Equation_structure
       ((cr_sort_identifier)fdclr (c_ccr_sort_identifier,h[1], nar),
	(cr_identifier_declaration_list)
		    fdclr (c_ccr_identifier_declaration_list,h[2], nar),
	(cr_equation_list)fdclr (c_ccr_equation_list,h[3], nar));
  case 65:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_equation_list, h[1],
		    c_ccr_equation, Nilcr_equation_list(), nar);
  case 66:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Equation (Nilcr_premiss_list (),
			 (cr_equality)fdclr (c_ccr_equality,h[1], nar),
			 make_cr_label("equation", nar));
  case 67:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Equation
       ((cr_premiss_list)fdclr (c_ccr_premiss_list,h[1], nar),
	(cr_equality)fdclr (c_ccr_equality,h[2], nar),
	make_cr_label("equation", nar));
  case 68:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_premiss_list, h[1],
		    c_ccr_equality, Nilcr_premiss_list(), nar);
  case 69:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Equals
       ((cr_value_expression)fdclr (c_ccr_value_expression,h[1], nar),
	(cr_value_expression)fdclr (c_ccr_value_expression,h[2], nar));
  case 70:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Process_definition
       (Nilcr_comment_list (),
       (cr_process_identifier)fdclr (c_ccr_process_identifier,h[1], nar),
       (cr_gate_identifier_list)
		       fdclr (c_ccr_gate_identifier_list,h[2], nar),
       (cr_identifier_declaration_list)
		       fdclr (c_ccr_identifier_declaration_list,h[2], nar),
       (cr_functionality)fdclr (c_ccr_functionality,h[2], nar),
       (cr_definition_block)fdclr (c_ccr_definition_block,h[3], nar),
       make_cr_label(Getlexv((int)fdclr (c_iddec,h[1], nar)), nar));
  case 71:
    h[0]= r;
    heval (h[0], h);

       /* This is needed to make the lists correctly in _local_definitions */
	return (CLR_TYPE) NULL;
  case 72:
    h[0]= r;
    heval (h[0], h);

       return (CLR_TYPE) fdclr (c_ccr_functionality,h[3], nar);
  case 73:
    h[0]= r;
    heval (h[0], h);

      if (h[1] == NULL)
	  return (CLR_TYPE) Nilcr_gate_identifier_list ();
      else  return (CLR_TYPE) fdclr (c_ccr_gate_identifier_list,h[1], nar);
  case 74:
    h[0]= r;
    heval (h[0], h);

      if (h[2] == NULL)
	  return (CLR_TYPE) Nilcr_identifier_declaration_list ();
      else  return (CLR_TYPE) fdclr (c_ccr_identifier_declaration_list,h[2], nar);
  case 75:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_gate_identifier_list,h[1], nar);
  case 76:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_identifier_declaration_list,h[1], nar);
  case 77:
    h[0]= r;
    heval (h[0], h);

   if (h[1] == NULL)
       return (CLR_TYPE) CR_Exit_part (Nilcr_sort_identifier_list ());
   else  return (CLR_TYPE) CR_Exit_part
     ((cr_sort_identifier_list)fdclr (c_ccr_sort_identifier_list,h[1], nar));
  case 78:
    h[0]= r;
    heval (h[0], h);

       return (CLR_TYPE) CR_Noexit_part ();
  case 79:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_sort_identifier_list, h[1],
		    c_ccr_sort_identifier, Nilcr_sort_identifier_list(), nar);
  case 80:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Local_definition_expression
       ((cr_identifier_equation_list)
			   fdclr (c_ccr_identifier_equation_list,h[1], nar),
	(cr_behaviour_expression)
			   fdclr (c_ccr_behaviour_expression,h[2], nar));
  case 81:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_identifier_equation_list, h[1],
	    c_ccr_identifier_equation, Nilcr_identifier_equation_list(), nar);
  case 82:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Identifier_equation
       ((cr_identifier_declaration)
			   fdclr (c_ccr_identifier_declaration,h[1], nar),
	(cr_value_expression)fdclr (c_ccr_value_expression,h[2], nar));
  case 83:
    h[0]= r;
    heval (h[0], h);

   if (fdclr (c_ccr_identifier_declaration_list,h[1], nar) != NULL)
      return (CLR_TYPE) CR_Sum_identifier_expression
       ((cr_identifier_declaration_list)
		       fdclr (c_ccr_identifier_declaration_list,h[1], nar),
	(cr_behaviour_expression)
		       fdclr (c_ccr_behaviour_expression,h[2], nar));
   if (fdclr (c_ccr_gate_declaration_list,h[1], nar) != NULL)
      return (CLR_TYPE) CR_Sum_gate_expression
       ((cr_gate_declaration_list)
		       fdclr (c_ccr_gate_declaration_list,h[1], nar),
	(cr_behaviour_expression)
		       fdclr (c_ccr_behaviour_expression,h[2], nar));
   (void)fprintf (stderr, "%s: error in sum_domain_expression\n", progname);
   drn_tree (h[1], 3);
   exit(1);
  case 84:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Par_expression
       ((cr_gate_declaration_list)
			    fdclr (c_ccr_gate_declaration_list,h[1], nar),
	(cr_parallel_operator)fdclr (c_ccr_parallel_operator,h[2], nar),
	(cr_behaviour_expression)
			    fdclr (c_ccr_behaviour_expression,h[3], nar),
	make_cr_label("parallel_expression", nar));
  case 85:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Synchronization_operator ();
  case 86:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Interleave_operator ();
  case 87:
    h[0]= r;
    heval (h[0], h);

     if (h[1] == NULL)
	return (CLR_TYPE) CR_General_parallel_operator (Nilcr_gate_identifier_list());
     else  return (CLR_TYPE) CR_General_parallel_operator
       ((cr_gate_identifier_list)fdclr (c_ccr_gate_identifier_list,h[1], nar));
  case 88:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Hiding_expression
       ((cr_gate_identifier_list)fdclr (c_ccr_gate_identifier_list,h[1], nar),
	(cr_behaviour_expression)
			     fdclr (c_ccr_behaviour_expression,h[2], nar));
  case 89:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Enable_expression
       ((cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[1], nar),
	(cr_identifier_declaration_list)
			     fdclr (c_ccr_identifier_declaration_list,h[2], nar),
	(cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[3], nar));
  case 90:
    h[0]= r;
    heval (h[0], h);

   if (h[1] == NULL)
      return (CLR_TYPE) Nilcr_identifier_declaration_list ();
   else  return (CLR_TYPE) fdclr (c_ccr_identifier_declaration_list,h[1], nar);
  case 91:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Disable_expression
       ((cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[1], nar),
	(cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[2], nar));
  case 92:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Parallel_expression
       ((cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[1], nar),
       (cr_parallel_operator)fdclr (c_ccr_parallel_operator,h[2], nar),
       (cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[3], nar),
       make_cr_label("parallel_expression", nar));
  case 93:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Choice_expression
       ((cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[1], nar),
	(cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[2], nar));
  case 94:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Guarded_expression
       ((cr_equality)fdclr (c_ccr_equality,h[1], nar),
	(cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[2], nar));
  case 95:
    h[0]= r;
    heval (h[0], h);

     if (h[1] == NULL)
	return (CLR_TYPE) CR_Action_prefix_expression
	((cr_action_denotation)fdclr (c_ccr_action_denotation,h[2], nar),
	 (cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[3], nar),
	 make_cr_label((char*)fdclr (c_mylexv,h[2], nar), nar),
	 (cr_annotation_list)fdclr (c_ccr_annotation_list,h[2], nar));
      return (CLR_TYPE) CR_Action_prefix_expression
       ((cr_action_denotation)fdclr (c_ccr_action_denotation,h[2], nar),
	(cr_behaviour_expression)fdclr (c_ccr_behaviour_expression,h[3], nar),
	make_cr_label((char*)fdclr (c_mylexv,h[2], nar), nar),
	concat_cr_annotation_list (
	  (cr_annotation_list)fdclr (c_ccr_annotation_list,h[1], nar),
	  (cr_annotation_list)fdclr (c_ccr_annotation_list,h[2], nar)));
  case 96:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) Getlexv((int)fdclr (c_idref,h[1], nar));
  case 97:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) ((h[2] == NULL)
	     ? (CLR_TYPE) Nilcr_annotation_list ()
	     : fdclr (c_ccr_annotation_list,h[2], nar));
  case 98:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Communication (
       (cr_gate_identifier)fdclr (c_ccr_gate_identifier,h[1], nar),
       CR_NoExperiment ());
  case 99:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) Getlexv((int)fdclr (c_idref,h[1], nar));
  case 100:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) ((h[4] == NULL)
	     ? (CLR_TYPE) Nilcr_annotation_list ()
	     : fdclr (c_ccr_annotation_list,h[4], nar));
  case 101:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Communication (
       (cr_gate_identifier)fdclr (c_ccr_gate_identifier,h[1], nar),
       CR_YesExperiment (
	 (cr_experiment_offer_list)
			fdclr (c_ccr_experiment_offer_list,h[2], nar),
	 (cr_guard_option)fdclr (c_ccr_guard_option,h[3], nar)));
  case 102:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) ("internal action");
  case 103:
    h[0]= r;
    heval (h[0], h);

       return (CLR_TYPE) CR_Internal_event();
  case 104:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) ((h[1] == NULL)
	     ? (CLR_TYPE) Nilcr_annotation_list ()
	     : fdclr (c_ccr_annotation_list,h[1], nar));
  case 105:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_experiment_offer_list, h[1],
		  c_ccr_experiment_offer, Nilcr_experiment_offer_list(), nar);
  case 106:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Query_offer
       (CR_Identifier_declaration
	 ((cr_value_identifier_list)
		 fdclr (c_ccr_value_identifier_list,h[1], nar),
	  (cr_sort_identifier)fdclr (c_ccr_sort_identifier,h[2], nar)));
  case 107:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Exclam_offer
       ((cr_value_expression)fdclr (c_ccr_value_expression,h[1], nar));
  case 108:
    h[0]= r;
    heval (h[0], h);

     if (h[1] == NULL)
	return (CLR_TYPE) CR_NoGuard ();
     else  return (CLR_TYPE) CR_YesGuard ((cr_equality)fdclr (c_ccr_equality,h[1], nar));
  case 109:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) ((h[1] == NULL)
      ? CR_Stop_expression (make_cr_label("stop", nar),
			    Nilcr_annotation_list())
      : CR_Stop_expression (make_cr_label("stop", nar),
	 (cr_annotation_list)fdclr (c_ccr_annotation_list,h[1], nar)));
  case 110:
    h[0]= r;
    heval (h[0], h);

     if ((h[1] != NULL) && (h[2] != NULL))
	return (CLR_TYPE) CR_Exit_expression
	 ((cr_exit_entry_list)fdclr (c_ccr_exit_entry_list,h[2], nar),
	  make_cr_label("exit", nar),
	  (cr_annotation_list)fdclr (c_ccr_annotation_list,h[1], nar));
     if ((h[1] != NULL) && (h[2] == NULL))
	return (CLR_TYPE) CR_Exit_expression
	 (Nilcr_exit_entry_list (),
	  make_cr_label("exit", nar),
	  (cr_annotation_list)fdclr (c_ccr_annotation_list,h[1], nar));
     if ((h[1] == NULL) && (h[2] != NULL))
	return (CLR_TYPE) CR_Exit_expression
	       ((cr_exit_entry_list)fdclr (c_ccr_exit_entry_list,h[2], nar),
		make_cr_label("exit", nar),
		Nilcr_annotation_list());
      return (CLR_TYPE) CR_Exit_expression (Nilcr_exit_entry_list (),
				make_cr_label("exit", nar),
				Nilcr_annotation_list());
  case 111:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_behaviour_expression,h[2], nar);
  case 112:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_exit_entry_list, h[1],
		    c_ccr_exit_entry, Nilcr_exit_entry_list(), nar);
  case 113:
    h[0]= r;

      return (CLR_TYPE) CR_Value_expression_exit_entry
       ((cr_value_expression)fdclr (c_ccr_value_expression,h[0], nar));
  case 114:
    h[0]= r;

      return (CLR_TYPE) CR_Sort_identifier_exit_entry
       ((cr_sort_identifier)fdclr (c_ccr_sort_identifier,h[0], nar));
  case 115:
    h[0]= r;
    heval (h[0], h);
  {
     int id = 0;
     if (h[1] != NULL) id += 1;
     if (h[3] != NULL) id += 2;
     if (h[4] != NULL) id += 4;
     switch (id) {
     case 0:
	return (CLR_TYPE) CR_Process_instantiation
	    ((cr_process_identifier)
				   fdclr (c_ccr_process_identifier,h[2], nar),
	     Nilcr_gate_identifier_list (),
	     Nilcr_value_expression_list (),
	     make_cr_label(Getlexv((int)fdclr (c_idref,h[2], nar)), nar),
	     Nilcr_annotation_list());
       break;
     case 1:
	return (CLR_TYPE) CR_Process_instantiation
	    ((cr_process_identifier)
			 fdclr (c_ccr_process_identifier,h[2], nar),
	     Nilcr_gate_identifier_list (),
	     Nilcr_value_expression_list (),
	     make_cr_label(Getlexv((int)fdclr (c_idref,h[2], nar)), nar),
	     (cr_annotation_list)
			 fdclr (c_ccr_annotation_list,h[1], nar));
       break;
     case 2:
	return (CLR_TYPE) CR_Process_instantiation
	    ((cr_process_identifier)
			fdclr (c_ccr_process_identifier,h[2], nar),
	     (cr_gate_identifier_list)
			fdclr (c_ccr_gate_identifier_list,h[3], nar),
	     Nilcr_value_expression_list (),
	     make_cr_label(Getlexv((int)fdclr (c_idref,h[2], nar)), nar),
	     Nilcr_annotation_list());
       break;
     case 3:
	return (CLR_TYPE) CR_Process_instantiation
	    ((cr_process_identifier)
			 fdclr (c_ccr_process_identifier,h[2], nar),
	     (cr_gate_identifier_list)
			 fdclr (c_ccr_gate_identifier_list,h[3], nar),
	     Nilcr_value_expression_list (),
	     make_cr_label(Getlexv((int)fdclr (c_idref,h[2], nar)), nar),
	     (cr_annotation_list)
			 fdclr (c_ccr_annotation_list,h[1], nar));
       break;
     case 4:
	return (CLR_TYPE) CR_Process_instantiation
	    ((cr_process_identifier)
			fdclr (c_ccr_process_identifier,h[2], nar),
	    Nilcr_gate_identifier_list (),
	    (cr_value_expression_list)
			fdclr (c_ccr_value_expression_list,h[4], nar),
	    make_cr_label(Getlexv((int)fdclr (c_idref,h[2], nar)), nar),
	    Nilcr_annotation_list());
       break;
     case 5:
	return (CLR_TYPE) CR_Process_instantiation
	    ((cr_process_identifier)
			 fdclr (c_ccr_process_identifier,h[2], nar),
	    Nilcr_gate_identifier_list (),
	    (cr_value_expression_list)
			 fdclr (c_ccr_value_expression_list,h[4], nar),
	    make_cr_label(Getlexv((int)fdclr (c_idref,h[2], nar)), nar),
	    (cr_annotation_list)
			 fdclr (c_ccr_annotation_list,h[1], nar));
       break;
     case 6:
	return (CLR_TYPE) CR_Process_instantiation
	    ((cr_process_identifier)
			fdclr (c_ccr_process_identifier,h[2], nar),
	     (cr_gate_identifier_list)
			fdclr (c_ccr_gate_identifier_list,h[3], nar),
	     (cr_value_expression_list)
			fdclr (c_ccr_value_expression_list,h[4], nar),
	     make_cr_label(Getlexv((int)fdclr (c_idref,h[2], nar)), nar),
	     Nilcr_annotation_list());
       break;
     case 7:
	return (CLR_TYPE) CR_Process_instantiation
	    ((cr_process_identifier)
			fdclr (c_ccr_process_identifier,h[2], nar),
	     (cr_gate_identifier_list)
			fdclr (c_ccr_gate_identifier_list,h[3], nar),
	     (cr_value_expression_list)
			fdclr (c_ccr_value_expression_list,h[4], nar),
	     make_cr_label(Getlexv((int)fdclr (c_idref,h[2], nar)), nar),
	     (cr_annotation_list)
			 fdclr (c_ccr_annotation_list,h[1], nar));
       break;
     default:
       (void) fprintf (stderr, "%s: wrong place reached\n", progname);
       break;
     }
  }
  case 116:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) fdclr (c_ccr_gate_identifier_list,h[1], nar);
  case 117:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

   if ((int)(ATable->data[(int)fdclr (c_idref,h[0], nar)].value0) == TOPN)
	return (CLR_TYPE) CR_Term (make_cr_operation_id ((int)fdclr (c_idref,h[0], nar)),
		       get_val_expression_list ((TNODE*)h[0]),
		       make_cr_sort_id ((int)fdclr (c_sort,h[0], nar)));
   else
	return (CLR_TYPE) CR_Value (make_cr_value_id ((int)fdclr (c_idref,h[0], nar)),
			make_cr_sort_id ((int)fdclr (c_sort,h[0], nar)));
  case 118:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_value_expression_list, h[1],
		    c_ccr_value_expression, Nilcr_value_expression_list(),
		    nar);
  case 119:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_identifier_declaration_list,
		    h[1],
		    c_ccr_identifier_declaration,
		    Nilcr_identifier_declaration_list(),
		    nar);
  case 120:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

   /* This is needed to make the list correctly in _sum_expression */
       return (CLR_TYPE) NULL;
  case 121:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Identifier_declaration
       ((cr_value_identifier_list)
		      fdclr (c_ccr_value_identifier_list,h[1], nar),
	(cr_sort_identifier)fdclr (c_ccr_sort_identifier,h[2], nar));
  case 122:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_gate_declaration_list, h[1],
		    c_ccr_gate_declaration, Nilcr_gate_declaration_list(),
		    nar);
  case 123:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

   /* This is needed to make the list correctly in _sum_expression */
       return (CLR_TYPE) NULL;
  case 124:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_gate_identifier_list, h[1],
		    c_ccr_gate_identifier, Nilcr_gate_identifier_list(), nar);
  case 125:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_gate_identifier_list, h[1],
		    c_ccr_gate_identifier, Nilcr_gate_identifier_list(), nar);
  case 126:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) CR_Gate_declaration
       ((cr_gate_identifier_list)
			fdclr (c_ccr_gate_identifier_list,h[1], nar),
	(cr_gate_identifier_list)fdclr (c_ccr_gate_identifier_list,h[2], nar));
  case 127:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

   if ((int)(ATable->data[(int)fdclr (c_iddec,h[1], nar)].value0) == TGATE)
      return (CLR_TYPE) reduce (Conscr_gate_identifier_list, h[1],
		    c_ccr_gate_identifier, Nilcr_gate_identifier_list(), nar);
   else  return (CLR_TYPE) Nilcr_gate_identifier_list ();
  case 128:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

   if ((int)(ATable->data[(int)fdclr (c_iddec,h[1], nar)].value0) == TVAL)
      return (CLR_TYPE) reduce (mkconscr_value_identifier_list, h[1],
		   c_ccr_value_identifier, Nilcr_value_identifier_list(), nar);
   else  return (CLR_TYPE) Nilcr_value_identifier_list ();
  case 129:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) make_cr_specification_id ((int)fdclr (c_iddec,h[0], nar));
  case 130:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) make_cr_type_id (Getid((TNODE*)h[0], nar));
  case 131:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) make_cr_sort_id (Getid((TNODE*)h[0], nar));
  case 132:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) make_cr_operation_id (Getid((TNODE*)h[0], nar));
  case 133:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) make_cr_operation_id (Getid((TNODE*)h[0], nar));
  case 134:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) make_cr_process_id (Getid((TNODE*)h[0], nar));
  case 135:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) make_cr_gate_id (Getid((TNODE*)h[0], nar));
  case 136:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) make_cr_gate_id (Getid((TNODE*)h[0], nar));
  case 137:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) make_cr_value_id (Getid((TNODE*)h[0], nar));
  case 138:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) ((h[1] == NULL)
	 ? CR_annotated_val_id
		 ((cr_value_identifier)fdclr (c_ccr_value_identifier,h[0], nar),
		  Nilcr_annotation_list())
	 : CR_annotated_val_id
		 ((cr_value_identifier)fdclr (c_ccr_value_identifier,h[0], nar),
		  (cr_annotation_list)
			 fdclr (c_ccr_annotation_list,h[1], nar)));
  case 139:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);

      return (CLR_TYPE) reduce (Conscr_annotation_list, h[1],
		    c_ccr_casestring, Nilcr_annotation_list (), nar);
  case 140:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) make_annotations (h[0]);
     }
  return (CLR_TYPE)NULL;
}





PUBLIC void
rag (r)
    TNODE* r;
{
  PROCESINI (r);
  if (ragerrors == 0)
    todo (r);
} /* end of rag */
