anchor.diff:      : cdecl+
       ;
   
  -/*
  -   note: allow only Z() to be easier machine readable and for plank compatibility
  -   %LV: I found a way for easy human-readable and easy machine readable. Plan compatibility is lost but only on a detail 
  -        Z() is not allowed. Z is allowed. ⟦ ... ##cforms*  ... ⟧ is allowed.
  - */
   cdecl
  -    : DATA  csortvars? CONSTRUCTOR cforms                   /* Data sort declaration */
  +    : RULE  cterm ARROW cterm                               /* Rule declaration */
  +    | DATA  csortvars? CONSTRUCTOR cforms                   /* Data sort declaration */
       | EXTERN? FN csortvars? csort CONSTRUCTOR csorts?       /* Function sort declaration */
  -    | RULE  cterm ARROW cterm                               /* Rule declaration */
       | IMPORT MODULE CONSTRUCTOR                             /* Import module declaration */
       | IMPORT GRAMMAR CONSTRUCTOR                            /* Import grammar declaration */
       ;
  +
  +
  +// -- Term
  +
  +cterm
  +    : CONSTRUCTOR cterms?                                               /* Constant/Construction */
  +    | METAVAR cterms?                                                   /* Meta variable/substitution */
  +    | LSQUARE VARIABLE<boundvar=x> RSQUARE cterm<bound=x>               /* Bound term. 
  +                                                                           VARIABLE<boundvar=x> means VARIABLE is a bound variable we call x
  +                                                                           cterm<bound=x>       means x is bound in the context of the cterm */
  +    | cliteral                                                          /* Literal construction */
  +    | cvariable                                                         /* Variable */
  +    | LCURLY cmapentries? RCURLY                                        /* Association map */
  +    ;
  +
  +/* TODO: inline when antlr-based meta parser generator support (()*)? */
  +cterms
  +    : LPAR cterm (COMMA cterm)* RPAR                    /* Term list */
  +    ;
  +
  +cliteral
  +    : STRING                                                    /* String literal */
  +    | NUMBER                                                    /* Number literal */
  +    ; 
  +
  +cvariable
  +    : VARIABLE<variable>  /* Variable occurrence */
  +                          /* <variable> means 1. maps VARIABLE to a syntactic variable
  +                                              2. look for a bound variable that matches VARIABLE 
  +                                                 in the current tracked bound variables (innermost scope first). 
  +                                                 VARIABLE is free if not found in scope.  */
  +    ;
  +
  +cmapentries
  +    : cmapentry (COMMA cmapentry)*
  +    ;
  +
  +cmapentry
  +    : COLON METAVAR                                      /* property reference (match/construct)      */
  +    | NOT METAVAR                                        /* no property references (match only)       */
  +    | METAVAR COLON cterm                                /* match property value / construct          */
  +    | VARIABLE                                           /* match / construct variable property       */
  +    | NOT VARIABLE                                       /* no variable (match only)                  */
  +    | VARIABLE COLON cterm                               /* match variable property value / construct */
  +    | STRING                                             /* match / construct named property          */
  +    | NOT STRING                                         /* no named property (match only)            */
  +    | STRING COLON cterm                                 /* match named property value / construct    */
  +    ;
  +
   
   // -- Sorts
   
  
positive.code:     | LCURLY cmapsort (COMMA cmapsort)* RCURLY      /* Association map sorts */ 
      | DATA csort                                    /* Data sort annotation. Indicate value is normalized */ 
      ;
      
  cmapsort
      /*
      %MS: What about the other cases in 'cmapentry'? 
           Could you give me an example sort for the cterm 'S({x})' or 'S({#X})'?
      %LV: example of sorts: 
               data SSort1 ( S({$String:$String}) )  // any string to any string
               data SSort2 ( S({Field:String}); data Field ( Field );  // Construction Field to any string
               data SSort3 ( S({Var:String}); data Var ( x );  // Variable to any string    
      %MS: I probably miss something, but in mapentry we have also cases where we there is no ':'.
           How would those get a sort? Or does this not occur?
      %LV: {#} means match, or contract using the entire map. It's not the same as the sort.
      */
      : csort COLON csort                            /* Association map sort */
      ;
      
  // -- Term
  
  cterm
      : CONSTRUCTOR cterms?                                               /* Constant/Construction */
      | cliteral                                                          /* Literal construction */
      | cvariable                                                         /* Variable */
      | LCURLY cmapentries? RCURLY                                        /* Association map */
      | METAVAR cterms?                                                   /* Meta variable/substitution */
      | LSQUARE VARIABLE<boundvar=x> RSQUARE cterm<bound=x>               /* Bound term. 
                                                                              VARIABLE<boundvar=x> means VARIABLE is a bound variable we call x
                                                                              cterm<bound=x>       means x is bound in the context of the cterm */
      ;
       
  
  cliteral
      : STRING                                                    /* String literal */
      | NUMBER                                                    /* Number literal */
      ; 
  
  cvariable
      : VARIABLE<variable>                                       /* Variable occurrence */
                            /* <variable> means 1. maps VARIABLE to a syntactic variable
                                                2. look for a bound variable that matches VARIABLE 
                                                     in the current tracked bound variables (innermost scope first). 
                                                     VARIABLE is free if not found in scope.  */
      ;
  
  cmapentries
      : cmapentry (COMMA cmapentry)*
      ;
  
  /*
  %MS: Maybe it is possible to create an example for each of these cases? 
       For intutition and to demonstrate the practical need?
  */
  cmapentry
      : COLON METAVAR                                      /* property reference (match/construct)      */
      | NOT METAVAR                                        /* no property references (match only)       */
      | METAVAR COLON cterm                                /* match property value / construct          */
      | VARIABLE                                           /* match / construct variable property       */
      | NOT VARIABLE                                       /* no variable (match only)                  */
      | VARIABLE COLON cterm                               /* match variable property value / construct */
      | STRING                                             /* match / construct named property          */
      | NOT STRING                                         /* no named property (match only)            */
      | STRING COLON cterm                                 /* match named property value / construct    */
      ;
  
  /* TODO: inline when antlr-based meta parser generator support (()*)? */
  cterms
      : LPAR cterm (COMMA cterm)* RPAR                    /* Term list */
      ;
  
  // Lexer rules
  
  
negative.code: /*
   * Copyright (c) 2015 IBM Corporation.
   *
   * This is the TranScript Core grammar specification.
   *
   * To avoid conflicts with the TransScript grammar,
   * every production starts with a 'c' for 'c'ore
   */
  
  grammar Core;
  
  