|
|
| class-type | ::= | |
| | | class-body-type | |
| | | [[?]label-name:] typexpr -> class-type | |
| class-body-type | ::= | object [( typexpr )] {class-field-spec} end |
| | | class-path | |
| | | [ typexpr {, typexpr} ] class-path | |
| class-field-spec | ::= | inherit class-type |
| | | val [mutable] inst-var-name : typexpr | |
| | | method [private] method-name : poly-typexpr | |
| | | method [private] virtual method-name : poly-typexpr | |
| | | constraint typexpr = typexpr |
|
|
|
|
|
|
|
|
|
| class-expr | ::= | class-path |
| | | [ typexpr {, typexpr} ] class-path | |
| | | ( class-expr ) | |
| | | ( class-expr : class-type ) | |
| | | class-expr {argument}+ | |
| | | fun {parameter}+ -> class-expr | |
| | | let [rec] let-binding {and let-binding} in class-expr | |
| | | object [( pattern [: typexpr] )] { class-field } end | |
| class-field | ::= | inherit class-expr [as value-name] |
| | | val [mutable] inst-var-name [: typexpr] = expr | |
| | | method [private] method-name {parameter} [: typexpr] = expr | |
| | | method [private] method-name : poly-typexpr = expr | |
| | | method [private] virtual method-name : poly-typexpr | |
| | | constraint typexpr = typexpr | |
| | | initializer expr |
|
|
|
|
|
|
|
|
| expr | ::= | ... |
| | | inst-var-name <- expr | |
| | | {< [ inst-var-name = expr { ; inst-var-name = expr } ] >} |
|
|
|
|
| class-definition | ::= | class class-binding { and class-binding } |
| class-binding | ::= | [virtual] [[ type-parameters ]] class-name {parameter} [: class-type] = class-expr |
| type-parameters | ::= | ' ident { , ' ident } |
|
|
|
| class-specification | ::= | class class-spec { and class-spec } |
| class-spec | ::= | [virtual] [[ type-parameters ]] class-name : class-type |
|
| classtype-definition | ::= | class type classtype-def { and classtype-def } |
| classtype-def | ::= | [virtual] [[ type-parameters ]] class-name = class-body-type |