anchor.diff:      -> ^(METATYPES[$IS_OP] type*)
       ;*/
   
  -parameters
  -    : LPAREN (annotatedParameter (COMMA annotatedParameter)*)? RPAREN
  -    //-> ^(PARAMETER_LIST[$LPAREN] annotatedParameter*)
  +parameters returns [ParameterList parameterList]
  +    : LPAREN
  +      { $parameterList=new ParameterList($LPAREN); }
  +      (
  +        ap1=annotatedParameter 
  +        { $parameterList.addParameter($ap1.parameter); }
  +        (
  +          COMMA 
  +          ap2=annotatedParameter
  +          { $parameterList.addParameter($ap2.parameter); }
  +        )*
  +      )? 
  +      RPAREN
  +      //-> ^(PARAMETER_LIST[$LPAREN] annotatedParameter*)
       ;
   
   //special rule for syntactic predicate
  
positive.code: // enforce the rule that the ... appears at the end of the parapmeter
  // list in a later pass of the compiler.
  parameter returns [Parameter parameter]
      : parameterType memberName
        (
            valueParameter? specifier?
          //-> ^(VALUE_PARAMETER_DECLARATION parameterType memberName specifier?)
  
negative.code:     : ENTRY_OP unionType memberName
      ;
  
  parameterType returns [Type type]
      : unionType 
        { $type = $unionType.type; }
        ( 
          ELLIPSIS
          { SequencedType st = new SequencedType($ELLIPSIS);
            st.setType($type);
            $type = st; }
        )?
      | VOID_MODIFIER
        { $type = new VoidModifier($VOID_MODIFIER); }
      ;
  
  typeParameters returns [TypeParameterList typeParameterList]
      : SMALLER_OP
        { $typeParameterList = new TypeParameterList($SMALLER_OP); }
        tp1=typeParameter
        { $typeParameterList.addTypeParameterDeclaration($tp1.typeParameter); }
        (
          COMMA 
          tp2=typeParameter
          { $typeParameterList.addTypeParameterDeclaration($tp2.typeParameter); }
        )*
        LARGER_OP
      //-> ^(TYPE_PARAMETER_LIST[$SMALLER_OP] typeParameter+)
      ;
  
  typeParameter returns [TypeParameterDeclaration typeParameter]
      : { $typeParameter = new TypeParameterDeclaration(null); }
        ( 
          variance 
          { $typeParameter.setTypeVariance($variance.typeVariance); } 
        )? 
        typeName
        { $typeParameter.setIdentifier($typeName.identifier); } 
      //-> ^(TYPE_PARAMETER_DECLARATION variance? typeName)
      | //{ $typeParameter = new SequencedTypeParameter(null); }
        typeName 
        //{ $typeParameter.setIdentifier($typeName.identifier); } 
        ELLIPSIS
      //-> ^(SEQUENCED_TYPE_PARAMETER typeName)
      ;
  
  variance returns [TypeVariance typeVariance]
      : IN_OP //-> ^(TYPE_VARIANCE[$IN_OP])
        { $typeVariance = new TypeVariance($IN_OP); }
      | OUT //-> ^(TYPE_VARIANCE[$OUT])
        { $typeVariance = new TypeVariance($OUT); }
      ;
      
  typeConstraint returns [TypeConstraint typeConstraint]
      : TYPE_CONSTRAINT
        { $typeConstraint = new TypeConstraint($TYPE_CONSTRAINT); }
        typeName 
        { $typeConstraint.setIdentifier($typeName.identifier); }
        //(typeParameters)?
        (
          parameters
          { $typeConstraint.setParameterList($parameters.parameterList); }
        )?
        (
          caseTypes
          { $typeConstraint.setCaseTypes($caseTypes.caseTypes); }
        )?
        //metatypes? 
        (
          satisfiedTypes
          { $typeConstraint.setSatisfiedTypes($satisfiedTypes.satisfiedTypes); }
        )?
        ( 
          abstractedType
          { $typeConstraint.setAbstractedType($abstractedType.abstractedType); }
        )?
      ;
  
  typeConstraints
  