1: doctype public "-//IDN etl.sf.net//ETL//Grammar 0.2.1";
     2: grammar calculator.CalculatorVars {
     3:     include "calculator-arith-0_2_1.g.etl";
     4:     namespace t = "http://etl.sf.net/samples/calculator";
     5:     namespace m = "http://etl.sf.net/samples/calculator/meta";
     6:     namespace default v = "http://etl.sf.net/samples/calculator/vars";
     7:     context abstract MetaInformation {
     8:         def ExpressionDef {
     9:             expression(Expressions); 
    10:         };
    11:         def NameDef {
    12:             ^ v:Name { 
    13:                 {
    14:                     @ literal = identifier;
    15:                 } | {
    16:                     @ quoted = string(prefix=Q|q, quote="'");
    17:                 };
    18:             };
    19:         };
    20:         documentation Documentation {
    21:             @ documentation += doclines wrapper m:DocumentationLine.text;
    22:         };
    23:         attributes Annotations {
    24:             @ annotations += % @ {
    25:                 ^ m:Annotation {
    26:                     @ name = ref(NameDef);
    27:                     % ( {
    28:                         @ arguments += list , {ref(ExpressionDef);}?;
    29:                     } % ) ?;
    30:                 }; 
    31:             } *;
    32:         };
    33:     };
    34:     context default Expressions {
    35:         include MetaInformation;
    36:         def ExpressionDef {
    37:             expression;
    38:         };
    39:         statement VarStatement {
    40:             @ type = token(var) | token(let);
    41:             @ name = ref(NameDef);
    42:             % = {
    43:                 @ value = expression;
    44:             }?;
    45:         };
    46:         op composite Name(f) {
    47:             ref(NameDef);
    48:         };
    49:         def SequenceDef {
    50:             ^ t:Sequence {
    51:                 @ statements += block; 
    52:             };
    53:         };
    54:         op composite Sequence(f) {
    55:             ref(SequenceDef);
    56:         };
    57:         op Assignment(xfy, 2000, =) {
    58:             @ first = left;
    59:             @ second = right;
    60:         };
    61:         statement Help {
    62:             % help;
    63:             @ variable = ref(NameDef);
    64:         };
    65:         statement IncludeStatement {
    66:             ^ t:IncludeStatement {
    67:                 % include;
    68:                 @ systemId = string(quote='"');
    69:             };
    70:         };
    71:     };
    72: };