package pascal;

import java.util.Vector;
import rebelsky.compiler.parser.Nonterminal;

/**
 * A collection of constants that define the nonterminals in Pascal.
 *
 * @author Samuel A. Rebelsky
 * @version 1.1 of April 2004
 */

public class PascalNonterminals
{
  // +-----------+-----------------------------------------------------------
  // | Constants |
  // +-----------+

  /** 
   * An addition operator, such as plus or minus. 
   */
  public static final Nonterminal ADDING_OPERATOR =
    new Nonterminal("adding_operator");

  /**
   * Select an element of an array.  The zeroth child is the
   * array variable.  The remaining children are the indices.
   */
  public static final Nonterminal ARRAY_SELECT =
    new Nonterminal("array_select");

  /**
   * A new array type.  Children are indices.  Final child is content type.
   */
  public static final Nonterminal ARRAY_TYPE =
    new Nonterminal("array_type");

  /** 
   * An assignment statement. 
   */
  public static final Nonterminal ASSIGNMENT =
    new Nonterminal("assignment");

  /** 
   * A list of assignment statements.  
   *
   * <assignment_list> ::= <assignment> TSEMI { <assignment> TSEMI }
   */
  public static final Nonterminal ASSIGNMENT_LIST =
    new Nonterminal("assignment_list");

  /**
   * A block of code.  Lots of declarations followed by
   * a group of statements enclosed in begin and end.
   */
  public static final Nonterminal BLOCK =
    new Nonterminal("block");

  /**
   * A Boolean expression.  
   */
  public static final Nonterminal BOOLEAN_EXPRESSION =
    new Nonterminal("boolean_expression");

  /**
   * An element of a case list.  Either null or a sequence of constants
   * followed by a procedure.
   */
  public static final Nonterminal CASE_LIST_ELEMENT =
    new Nonterminal("case_list_element");

  /**
   * A case statement.
   */
  public static final Nonterminal CASE_STATEMENT =
    new Nonterminal("case_statement");

  /**
   * A compound statment (a list of statements enclosed in a begin/end pair).
   */
  public static final Nonterminal COMPOUND_STATEMENT =
    new Nonterminal("compound_statement");
  
  /*
   * A conditional statement (e.g., an if statement).
   */
  public static final Nonterminal CONDITIONAL =
    new Nonterminal("conditional");
    
  /**
   * A constant.
   */
  public static final Nonterminal CONSTANT =
    new Nonterminal("constant");

  /**
   * A single constant definition.
   */
  public static final Nonterminal CONSTANT_DEFINITION =
    new Nonterminal("constant_definition");

  /**
   * Zero or more constant definitions.
   */
  public static final Nonterminal CONSTANT_DEFINITIONS =
    new Nonterminal("constant_definitions");

  /**
   * Dereference a pointer variable.
   */
  public static final Nonterminal DEREFERENCE =
    new Nonterminal("dereference");

  /**
   * The famous expression.
   */
  public static final Nonterminal EXPRESSION  =
    new Nonterminal("expression");

  /**
   * Part of an expression.  Factors contain no unparenthesized
   * addition and multiplication symbols.
   */
  public static final Nonterminal FACTOR =
    new Nonterminal("factor");

  /**
   * Select a field from a record.
   */
  public static final Nonterminal FIELD_SELECT =
    new Nonterminal("field_select");

  /**
   * The type associated with files.
   */
  public static final Nonterminal FILE_TYPE =
    new Nonterminal("file_type");

  /**
   * The fixed part of a record.
   */
  public static final Nonterminal FIXED_PART =
    new Nonterminal("fixed_part");

  /**
   * The formal parameters in a procedure or function declaration.
   */
  public static final Nonterminal FORMALS =
    new Nonterminal("formals");

  /**
   * A for statment (loop)
   */
  public static final Nonterminal FOR_STATEMENT =
    new Nonterminal("for_statement");

  /**
   * A call to a function.
   */
  public static final Nonterminal FUNCTION_CALL =
    new Nonterminal("function_call");
    
  /**
   * The declaration of one function.  Typically gives parameters (with
   * types), return value, local variables, and body.
   */
  public static final Nonterminal FUNCTION_DECLARATION =
    new Nonterminal("function_declaration");
    
  /**
   * A list of function declarations.  
   */
  public static final Nonterminal FUNCTION_DECLARATIONS =
    new Nonterminal("function_declarations");
    
  /**
   * The much maligned goto statement.
   */
  public static final Nonterminal GOTO_STATEMENT =
    new Nonterminal("goto");

  /**
   * A non-empty list of identifiers.
   */
  public static final Nonterminal IDENTIFIER_LIST =
    new Nonterminal("identifier_list");

  /**
   * A label, typically used as the destination of a (blech) goto
   * statement.
   */
  public static final Nonterminal LABEL =
    new Nonterminal("label");

  /**
   * The declaration of zero or more labels that are to be used
   * within a block.
   */
  public static final Nonterminal LABEL_DECLARATIONS =
    new Nonterminal("label_declarations");

  /**
   * Statements with associated labels.
   */
  public static final Nonterminal LABELED_STATEMENT =
    new Nonterminal("labeled_statement");

  /** 
   * An operator with the precedence of multiplication, such as 
   * multiplication, division, or modulus.
   */
  public static final Nonterminal MULTIPLYING_OPERATOR =
    new Nonterminal("multiplying_operator");

  /**
   * A packed structured type.
   */
  public static final Nonterminal PACKED =
    new Nonterminal("packed");

  /**
   * A group of parameters with the same type.
   */
  public static final Nonterminal PARAMETER_GROUP =
    new Nonterminal("parameter_group");

  /**
   * A pointer to a named type.
   */
  public static final Nonterminal POINTER =
    new Nonterminal("pointer");

  /**
   * A call to a procedure.  Not to be confused with a function call
   * or with a procedure declaration.
   */
  public static final Nonterminal PROCEDURE_CALL =
    new Nonterminal("procedure_call");

  /**
   * A single procedure declaration.
   */
  public static final Nonterminal PROCEDURE_DECLARATION =
    new Nonterminal("procedure_declaration");

  /**
   * A series of procedure and function declarations.
   */
  public static final Nonterminal PROCFUNC_DECLARATIONS =
    new Nonterminal("procfunc_declarations");

  /**
   * A complete program.  Typically the start symbol of the grammar.
   */
  public static final Nonterminal PROGRAM =
    new Nonterminal("program");

  /**
   * The heading of a program.  Gives name, input, and output.
   */
  public static final Nonterminal PROGRAM_HEADING =
    new Nonterminal("program_heading");

  /**
   * A range of values, typically as part of a set.
   */
  public static final Nonterminal RANGE =
    new Nonterminal("RANGE");

  /**
   * A section of a record; One set of fields of the same type.
   */
  public static final Nonterminal RECORD_SECTION =
    new Nonterminal("record_section");

  /**
   * The type associated with records.
   */
  public static final Nonterminal RECORD_TYPE =
    new Nonterminal("record_type");

  /**
   * Relational operators, used for comparing values.
   */
  public static final Nonterminal RELATIONAL_OPERATOR =
    new Nonterminal("relational_opeator");

  /**
   * Repeat/Until statements.
   */
  public static final Nonterminal REPEAT_STATEMENT =
    new Nonterminal("repeat_statement");

  /**
   * Scalar or enumerated types.
   */
  public static final Nonterminal SCALAR_TYPE =
    new Nonterminal("scalar_type");

  /**
   * A set of values, computed at run time.
   */
  public static final Nonterminal SET =
    new Nonterminal("set");

  /**
   * The type associated with sets.
   */
  public static final Nonterminal SET_TYPE =
    new Nonterminal("set_type");

  /**
   * Subranges.
   */
  public static final Nonterminal SUBRANGE_TYPE =
    new Nonterminal("subrange_type");

  /**
   * A statement.
   */
  public static final Nonterminal STATEMENT =
    new Nonterminal("statement");
    
  /**
   * Part of an expression.  Terms are expression with no unparenthesized
   * additive operations.
   */
  public static final Nonterminal TERM =
    new Nonterminal("term");

  /**
   * A single type definition.
   */
  public static final Nonterminal TYPE_DEFINITION =
    new Nonterminal("type_definition");

  /**
   * A sequence of type definitions.
   */
  public static final Nonterminal TYPE_DEFINITIONS =
    new Nonterminal("type_definitions");

  /**
   * The name of a type.
   */
  public static final Nonterminal TYPE_IDENTIFIER =
    new Nonterminal("type_identifier");

  /**
   * A non-negative number.
   */
  public static final Nonterminal UNSIGNED_NUMBER =
    new Nonterminal("unsigned_number");

  /**
   * A variable (something that can be assigned to).
   */
  public static final Nonterminal VARIABLE =
    new Nonterminal("variable");

  /**
   * Declare the type of one or more variables.
   */
  public static final Nonterminal VARIABLE_DECLARATION =
    new Nonterminal("variable_declaration");

  /**
   * Zero or more variable declarations.
   */
  public static final Nonterminal VARIABLE_DECLARATIONS =
    new Nonterminal("variable_declarations");

  /**
   * The name of a variable.
   */
  public static final Nonterminal VARIABLE_NAME =
    new Nonterminal("variable_name");

  /**
   * One variant in a variant part of a record.
   */
  public static final Nonterminal VARIANT = 
    new Nonterminal("variant");

  /**
   * The variant part of a record.
   */
  public static final Nonterminal VARIANT_PART =
    new Nonterminal("variant_part");

  /**
   * A while loop.
   */
  public static final Nonterminal WHILE_LOOP =
    new Nonterminal("while_loop");

  /**
   * A with statement, which lets us skip the names of records and
   * just type their fields.
   */
  public static final Nonterminal WITH_STATEMENT =
    new Nonterminal("with_statement");
} // class PascalNonterminals

