// This file is regenerated on every build.  It builds the concrete syntax tree, embedding code from the grammar file.
// To be honest the whole parse/cst/ast thing is a bit muddled and at a minimum needs to be documented if indeed not rewritten.
// Note that the code in a .g file can only walk the CST.  A user-built AST can be expected to have a totally different structure
// from the grammar, so embedding code in the grammar to walk the AST make no sense.


#if !defined(BUILDING_CST) && !defined(BUILDING_CAST) && !defined(BUILDING_AST)
#define BUILDING_CAST 1
#endif

//\\ B<EOF> = 0;
//\\#
//\\ P<empty> =
   case G_empty:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  return -1;

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    "";
     T[++phrases] = kw(CST(P++), "");
     T[0] = G_mktuple(G_empty, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  return -1;

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<SS> =
   case G_SS:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  return T[1];

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    <instruction_list> <EOF>;
     T[++phrases] = build_ast(CST(P++) /* G_instruction_list */);
     T[++phrases] = BIP(CST(P++), B_EOF);
     T[0] = G_mktuple(G_SS, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  return T[1];

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<array> =
   case G_array:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  return AST_mktuple(AST_list, T[2]);

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    "[" <value_list> "]";
     T[++phrases] = kw(CST(P++), "[");
     T[++phrases] = build_ast(CST(P++) /* G_value_list */);
     T[++phrases] = kw(CST(P++), "]");
     T[0] = G_mktuple(G_array, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  return AST_mktuple(AST_list, T[2]);

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<opt-sign> =
   case G_opt_sign:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  if (alt != 0) return -1;
  return AST_mktuple(AST_source_text, T[1], -1);  

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    "-",
       T[++phrases] = kw(CST(P++), "-");
     } else                      {  //\\    <empty>;
       T[++phrases] = build_ast(CST(P++) /* G_empty */);
     }
     T[0] = G_mktuple(G_opt_sign, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  if (alt != 0) return -1;
  return AST_mktuple(AST_source_text, T[1], -1);  

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<number> =
   case G_number:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  if (T[1] == -1) return T[2];
  {
    int sign;
    AST_detuple(T[1], AST_source_text, &sign, NULL);
    return AST_mktuple(AST_number, AST_mktuple(AST_source_text, sign, T[2]));
  }

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    <opt_sign> <float>,
       T[++phrases] = build_ast(CST(P++) /* G_opt_sign */);
       T[++phrases] = build_ast(CST(P++) /* G_float */);
     } else                      {  //\\    <opt_sign> <integer>;
       T[++phrases] = build_ast(CST(P++) /* G_opt_sign */);
       T[++phrases] = build_ast(CST(P++) /* G_integer */);
     }
     T[0] = G_mktuple(G_number, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  if (T[1] == -1) return T[2];
  {
    int sign;
    AST_detuple(T[1], AST_source_text, &sign, NULL);
    return AST_mktuple(AST_number, AST_mktuple(AST_source_text, sign, T[2]));
  }

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<boolean> =
   case G_boolean:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  return AST_mktuple(AST_boolean, AST_mktuple(AST_source_text, T[1], -1));

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    "true",
       T[++phrases] = kw(CST(P++), "true");
     } else if (alt == 1)        {  //\\    "false",
       T[++phrases] = kw(CST(P++), "false");
     } else                      {  //\\    "undef";
       T[++phrases] = kw(CST(P++), "undef");
     }
     T[0] = G_mktuple(G_boolean, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  return AST_mktuple(AST_boolean, AST_mktuple(AST_source_text, T[1], -1));

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<value> =
   case G_value:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  if (alt == 3) {
    fprintf(stdout, "*** AN INSTRUCTION SHOULD NEVER BE FOUND AS A VALUE ***\n");
    fprintf(stderr, "*** AN INSTRUCTION SHOULD NEVER BE FOUND AS A VALUE ***\n");
  }
  return T[1];

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    <boolean>,
       T[++phrases] = build_ast(CST(P++) /* G_boolean */);
     } else if (alt == 1)        {  //\\    <array>,
       T[++phrases] = build_ast(CST(P++) /* G_array */);
     } else if (alt == 2)        {  //\\    <number>,
       T[++phrases] = build_ast(CST(P++) /* G_number */);
     } else if (alt == 3)        {  //\\    <instruction>,
       T[++phrases] = build_ast(CST(P++) /* G_instruction */);
     } else if (alt == 4)        {  //\\    <name>,
       T[++phrases] = build_ast(CST(P++) /* G_name */);
     } else                      {  //\\    <string>;
       T[++phrases] = build_ast(CST(P++) /* G_string */);
     }
     T[0] = G_mktuple(G_value, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  if (alt == 3) {
    fprintf(stdout, "*** AN INSTRUCTION SHOULD NEVER BE FOUND AS A VALUE ***\n");
    fprintf(stderr, "*** AN INSTRUCTION SHOULD NEVER BE FOUND AS A VALUE ***\n");
  }
  return T[1];

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<rest-of-value-list> =
   case G_rest_of_value_list:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_list_element containing << value, next_value >>
  if (alt != 0) return -1;
  return AST_mktuple(AST_list_element, T[2], T[3]);

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    "," <value> <rest_of_value_list>,
       T[++phrases] = kw(CST(P++), ",");
       T[++phrases] = build_ast(CST(P++) /* G_value */);
       T[++phrases] = build_ast(CST(P++) /* G_rest_of_value_list */);
     } else                      {  //\\    <empty>;
       T[++phrases] = build_ast(CST(P++) /* G_empty */);
     }
     T[0] = G_mktuple(G_rest_of_value_list, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_list_element containing << value, next_value >>
  if (alt != 0) return -1;
  return AST_mktuple(AST_list_element, T[2], T[3]);

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<value-list> =
   case G_value_list:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_list_element containing << value, next_value >>
  return AST_mktuple(AST_list_element, T[1], T[2]);

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    <value> <rest_of_value_list>;
     T[++phrases] = build_ast(CST(P++) /* G_value */);
     T[++phrases] = build_ast(CST(P++) /* G_rest_of_value_list */);
     T[0] = G_mktuple(G_value_list, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_list_element containing << value, next_value >>
  return AST_mktuple(AST_list_element, T[1], T[2]);

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<quote> =
   case G_quote:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  return -1;

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    «"»;
     T[++phrases] = reg(CST(P++), "\"");
     T[0] = G_mktuple(G_quote, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  return -1;

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<char> =
   case G_char:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  return AST_mktuple(AST_source_text, T[2], -1);

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    <!quote> «.»;
     T[++phrases] = -1 +(0 * P++);
     T[++phrases] = reg(CST(P++), ".");
     T[0] = G_mktuple(G_char, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  return AST_mktuple(AST_source_text, T[2], -1);

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<chars> =
   case G_chars:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  if (alt != 0) return -1;
  int text;
  AST_detuple(T[1], AST_source_text, &text, NULL);
  return AST_mktuple(AST_source_text, text, T[2]);

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    <char> <chars>,
       T[++phrases] = build_ast(CST(P++) /* G_char */);
       T[++phrases] = build_ast(CST(P++) /* G_chars */);
     } else                      {  //\\    <empty>;
       T[++phrases] = build_ast(CST(P++) /* G_empty */);
     }
     T[0] = G_mktuple(G_chars, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  if (alt != 0) return -1;
  int text;
  AST_detuple(T[1], AST_source_text, &text, NULL);
  return AST_mktuple(AST_source_text, text, T[2]);

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<string> =
   case G_string:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  return AST_mktuple(AST_string, T[2]);

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    <quote> <chars> <quote>;
     T[++phrases] = build_ast(CST(P++) /* G_quote */);
     T[++phrases] = build_ast(CST(P++) /* G_chars */);
     T[++phrases] = build_ast(CST(P++) /* G_quote */);
     T[0] = G_mktuple(G_string, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  return AST_mktuple(AST_string, T[2]);

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<name> =
   case G_name:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  return AST_mktuple(AST_name, AST_mktuple(AST_source_text, T[1], -1));

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    «[A-Za-z\$][A-Za-z0-9_]*»;
     T[++phrases] = reg(CST(P++), "[A-Za-z\\$][A-Za-z0-9_]*");
     T[0] = G_mktuple(G_name, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  return AST_mktuple(AST_name, AST_mktuple(AST_source_text, T[1], -1));

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<opt-exponent> =
   case G_opt_exponent:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  if (alt != 0) return -1;
  if (T[2] == -1) {
    return AST_mktuple(AST_source_text, T[1], T[3]);
  } else {
    AST_detuple(T[2], AST_source_text, &text, NULL);
    if (text == -1) {
      return AST_mktuple(AST_source_text, T[1], T[3]);
    } else {
      return AST_mktuple(AST_source_text, T[1], AST_mktuple(AST_source_text, text, T[3]));
    }
  }

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    «[Ee]» <opt_sign> <integer>,
       T[++phrases] = reg(CST(P++), "[Ee]");
       T[++phrases] = build_ast(CST(P++) /* G_opt_sign */);
       T[++phrases] = build_ast(CST(P++) /* G_integer */);
     } else                      {  //\\    <empty>;
       T[++phrases] = build_ast(CST(P++) /* G_empty */);
     }
     T[0] = G_mktuple(G_opt_exponent, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  if (alt != 0) return -1;
  if (T[2] == -1) {
    return AST_mktuple(AST_source_text, T[1], T[3]);
  } else {
    AST_detuple(T[2], AST_source_text, &text, NULL);
    if (text == -1) {
      return AST_mktuple(AST_source_text, T[1], T[3]);
    } else {
      return AST_mktuple(AST_source_text, T[1], AST_mktuple(AST_source_text, text, T[3]));
    }
  }

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<float> =
   case G_float:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  return AST_mktuple(AST_source_text, T[1], T[2]);

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    «[0-9]*\.[0-9][0-9]*» <opt_exponent>;
     T[++phrases] = reg(CST(P++), "[0-9]*\\.[0-9][0-9]*");
     T[++phrases] = build_ast(CST(P++) /* G_opt_exponent */);
     T[0] = G_mktuple(G_float, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  return AST_mktuple(AST_source_text, T[1], T[2]);

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<integer> =
   case G_integer:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  return AST_mktuple(AST_source_text, T[1], -1);

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    «[0-9][0-9]*»;
     T[++phrases] = reg(CST(P++), "[0-9][0-9]*");
     T[0] = G_mktuple(G_integer, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_source_text containing  <<text_descriptor, next_concatenated_text>>
  return AST_mktuple(AST_source_text, T[1], -1);

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<argument> =
   case G_argument:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_argument containing << name, value, next_arg >>
  if (alt == 0) return AST_mktuple(AST_argument, T[1], T[3], -1);
  return AST_mktuple(AST_argument, -1, T[1], -1);

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    <name> "=" <value>,
       T[++phrases] = build_ast(CST(P++) /* G_name */);
       T[++phrases] = kw(CST(P++), "=");
       T[++phrases] = build_ast(CST(P++) /* G_value */);
     } else                      {  //\\    <value>;
       T[++phrases] = build_ast(CST(P++) /* G_value */);
     }
     T[0] = G_mktuple(G_argument, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_argument containing << name, value, next_arg >>
  if (alt == 0) return AST_mktuple(AST_argument, T[1], T[3], -1);
  return AST_mktuple(AST_argument, -1, T[1], -1);

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<rest-of-argument-list> =
   case G_rest_of_argument_list:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_argument containing << name, value, next_arg >>
  {
    int name, value;
    if (alt != 0) return -1;
    AST_detuple(T[2], AST_argument, &name, &value, NULL);
    return AST_mktuple(AST_argument, name, value, T[3]);
  }

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    "," <argument> <rest_of_argument_list>,
       T[++phrases] = kw(CST(P++), ",");
       T[++phrases] = build_ast(CST(P++) /* G_argument */);
       T[++phrases] = build_ast(CST(P++) /* G_rest_of_argument_list */);
     } else                      {  //\\    <empty>;
       T[++phrases] = build_ast(CST(P++) /* G_empty */);
     }
     T[0] = G_mktuple(G_rest_of_argument_list, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_argument containing << name, value, next_arg >>
  {
    int name, value;
    if (alt != 0) return -1;
    AST_detuple(T[2], AST_argument, &name, &value, NULL);
    return AST_mktuple(AST_argument, name, value, T[3]);
  }

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<opt-argument-list> =
   case G_opt_argument_list:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_argument containing << name, value, next_arg >>
  {
    int name, value;
    if (alt != 0) return -1;
    AST_detuple(T[1], AST_argument, &name, &value, NULL);
    return AST_mktuple(AST_argument, name, value, T[2]);
  }

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    <argument> <rest_of_argument_list>,
       T[++phrases] = build_ast(CST(P++) /* G_argument */);
       T[++phrases] = build_ast(CST(P++) /* G_rest_of_argument_list */);
     } else                      {  //\\    <empty>;
       T[++phrases] = build_ast(CST(P++) /* G_empty */);
     }
     T[0] = G_mktuple(G_opt_argument_list, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_argument containing << name, value, next_arg >>
  {
    int name, value;
    if (alt != 0) return -1;
    AST_detuple(T[1], AST_argument, &name, &value, NULL);
    return AST_mktuple(AST_argument, name, value, T[2]);
  }

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<instruction> =
   case G_instruction:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_instruction tuple containing <<name, argument list, block, next instruction>>
  // (I'll ignore any modifiers present for now.)
  return AST_mktuple(AST_instruction, T[2], T[4], T[6], -1);

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
                                    //\\    «[%#!*]*» <name> "(" <opt_argument_list> ")" <opt_block>;
     T[++phrases] = reg(CST(P++), "[%#!*]*");
     T[++phrases] = build_ast(CST(P++) /* G_name */);
     T[++phrases] = kw(CST(P++), "(");
     T[++phrases] = build_ast(CST(P++) /* G_opt_argument_list */);
     T[++phrases] = kw(CST(P++), ")");
     T[++phrases] = build_ast(CST(P++) /* G_opt_block */);
     T[0] = G_mktuple(G_instruction, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_instruction tuple containing <<name, argument list, block, next instruction>>
  // (I'll ignore any modifiers present for now.)
  return AST_mktuple(AST_instruction, T[2], T[4], T[6], -1);

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<instruction-list> =
   case G_instruction_list:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  // returns AST_instruction tuple containing <<name, argument list, block, next instruction>>
  {
    int name, args, block;
    if (alt != 0) return -1;
    AST_detuple(T[1], AST_instruction, &name, &args, &block, NULL);
    return AST_mktuple(AST_instruction, name, args, block, T[2]);
  }

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    <instruction> <instruction_list>,
       T[++phrases] = build_ast(CST(P++) /* G_instruction */);
       T[++phrases] = build_ast(CST(P++) /* G_instruction_list */);
     } else                      {  //\\    <empty>;
       T[++phrases] = build_ast(CST(P++) /* G_empty */);
     }
     T[0] = G_mktuple(G_instruction_list, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  // returns AST_instruction tuple containing <<name, argument list, block, next instruction>>
  {
    int name, args, block;
    if (alt != 0) return -1;
    AST_detuple(T[1], AST_instruction, &name, &args, &block, NULL);
    return AST_mktuple(AST_instruction, name, args, block, T[2]);
  }

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ P<opt-block> =
   case G_opt_block:

#if defined(BUILDING_CST)  // Code from .g file can be inserted before or after we build the CAST

  if (alt != 0) return -1;
  return T[2];

#endif // can replace default code by returning here...

#if defined(BUILDING_CAST) // Generated code to convert analysis record into a concrete version of an AST (CAST)
     if (alt == 0)               {  //\\    "{" <instruction_list> "}",
       T[++phrases] = kw(CST(P++), "{");
       T[++phrases] = build_ast(CST(P++) /* G_instruction_list */);
       T[++phrases] = kw(CST(P++), "}");
     } else                      {  //\\    ";";
       T[++phrases] = kw(CST(P++), ";");
     }
     T[0] = G_mktuple(G_opt_block, alt, phrases, T);

#endif // defined(BUILDING_CAST)

#if defined(BUILDING_AST) // higher-level AST contents added here by user-supplied code...

  if (alt != 0) return -1;
  return T[2];

#endif

#if defined(BUILDING_CAST) // return CAST if we got this far
     return T[0];
#else  // !defined(BUILDING_CAST)
     return -1; // fallback if nothing specific defined
#endif // defined(BUILDING_CAST)
//-------------------------------------------------------------------------------------------
//\\ E
