1: doctype public "-//IDN etl.sf.net//ETL//Grammar 0.2.1";
     2: grammar abstract calculator.CalculatorLambdaBasic {
     3:     include "calculator-logic-0_2_1.g.etl";
     4:     namespace v = "http://etl.sf.net/samples/calculator/vars";
     5:     namespace default l = "http://etl.sf.net/samples/calculator/lambda";
     6:     context abstract LetRecDefs {
     7:         def EpxressionDef {
     8:             // redefine it to refer to the correct expression
     9:             expression(Expressions);
    10:         };
    11:         def ParameterList {
    12:             @ parameters += list , {
    13:                 ^l:Parameter {
    14:                     modifiers {
    15:                         @ type = modifier var;
    16:                     };
    17:                     @ name = ref(NameDef);
    18:                 };
    19:             } ?;
    20:         };
    21:         def LetRecAssignDef {
    22:             ^v:LetRecPart {
    23:                 @ name = ref(NameDef);
    24:                 % =;
    25:                 @ value = ref(ExpressionDef);
    26:             };
    27:         };
    28:     };
    29:     context default Expressions {
    30:         include LetRecDefs;
    31:         import letRecContent = LetRecContent;
    32:         
    33:         op composite Lambda(fy, 1950) {
    34:             % \;
    35:             ref(ParameterList) | %( { ref(ParameterList); } % );
    36:             % =>;
    37:             @ value = right;
    38:         };
    39:         op composite Apply(yf, 100) {
    40:             @ function = left;
    41:             % (;
    42:             @ arguments += list , {
    43:                 expression;
    44:             } ?;
    45:             % );
    46:         };
    47:         statement LetRec {
    48:             ^ v:LetRec {
    49:                 % letrec;
    50:                 @ definitions += ref(LetRecAssignDef) | {
    51:                     block(letRecContent);
    52:                 };
    53:             };
    54:         };
    55:     };
    56:     context LetRecContent {
    57:         include LetRecDefs;
    58:         include MetaInformation;
    59:         import expressions = Expressions;
    60:         
    61:         def EpxressionDef {
    62:             expression(expressions);
    63:         };        
    64:         statement LetPart {
    65:             ref(LetRecAssignDef);
    66:         };
    67:     };
    68: };