<C> |<C> ::=
<VAR> |
`[' <VN> `;' <NE> `;' <VE> `]' |
<E> `@' <E> |
reduct `{' <NN> `}' `|' <E> `|' `{' <NN> `}' |
freeze `{' <NN> `}' `(' <E> `)' |
<E> `.' <NAME> |
eval `(' <E> `)'
<E><VN> ::=
fn <VAR> `=>' <C> |
<C> `(' <C> `)' |
if <C> then <C> else <C> |
let <VAR> '=' <C> in <C> |
<COP> |
<UNOP> <C> |
<C> <BINOP> <C>
[ <VAR> `->' <NAME> { `,' <VAR> `->' <NAME> } ]<NE> ::=
[ <NAME> `->' <E> { `,' <NAME> `->' <E> } ]<VE> ::=
[ <VAR> `->' <E> { `,' <VAR> `->' <E> } ]<NN> ::=
[ <NAME> [ `->' <NAME> ] { `,' <NAME> [ `->' <NAME> ] } ]<COP> ::=
<NUM> | false | true<UOP> ::=
`-' | `!'<BOP> ::=
`+' | `-' | `*' | `/' | `||' | `&&' | `==' | `!=' | `<' | `<=' | `>' | `>='
do
(see Mixin Modules and
Computational Effects ).
See A Calculus of Module Systems (note that the syntax has been slightly changed!).
[ ; Fact -> fact; fact -> fn x => if x<=0 then 1 else x*fact(x-1)] . Fact (10)
let m=[ ; M->self ; self -> [ ; X -> 1, Y -> self.X+1, Self -> self; ] ].M in m.Self.Y
freeze
[
value -> Val;
Val -> 0,
Inc-> reduct {Val -> Val } | self | {Inc -> Inc } @ [
; Val -> value + 1; ];
self -> [
value -> Val;
Val -> 0,
Inc -> reduct {Val -> Val } | self | {Inc -> Inc } @ [ ; Val ->
value + 1; ];
]
]
freeze
{Val->Val}
(
freeze