| Script: | script | → | module | order | |
| Module: | module | → | module modId where modDeclOrDefnBody |
|
| Order: | order | → | sequence | |
| Sequences: | sequence | → | expr1; ... ;exprn[;] |
n >= 0 |
| Module body: | modDeclOrDefnBody | → | modDeclOrDefn | {modDeclOrDefnList} |
|
| Module declaration or definition list: | modDeclOrDefnList | → | modDeclOrDefn1; ... ;modDeclOrDefnn[;] |
n >= 1 |
| Module declaration or definition elements: | modDeclOrDefn | → | classDecl | instanceDecl | declOrDefn | |
| Declaration or definition bodies: | declOrDefnBody | → | declOrDefn | {declOrDefnList} |
|
| Declaration or definition lists: | declOrDefnList | → | declOrDefn1; ... ;declOrDefnn[;] |
n >= 1 |
| Declaration or definition elements: | declOrDefn | → | decl | defn | |
| Declarations: | decl | → | signedVar | |
| Definitions: | defn | → | signedVarOrDataCon patterns = expr |
|
| Class declarations: | classDecl | → | class classSpec where declOrDefnBody |
|
| Class specifiers: | classSpec | → | classOrClasses => class | class |
|
| Classes or class lists: | classOrClasses | → | class | (classList) |
|
| Instance declarations: | instanceDecl | → | instance classId aTypeSig where declOrDefnBody |
|
| Definition command bodies: | defCmdBody | → | defCmd | {defCmdList} |
|
| Definition command lists: | defCmdList | → | defCmd1; ... ;defCmdn[;] |
n >= 1 |
| Definition commands: | defCmd | → | selName = expr |
|
| Undefinition command bodies: | undefCmdBody | → | undefCmd | {undefCmdList} |
|
| Undefinition command lists: | undefCmdList | → | undefCmd1; ... ;undefCmdn[;] |
n >= 1 |
| Undefinition commands: | undefCmd | → | selName | |
| Type signatures: | typeSig | → | apTypeSig | |
| | | typeSig -> typeSig |
function type | ||
| | | typeSig | typeSig |
type alternative | ||
| | | -> typeSig |
nilary function type | ||
| | | aTypeSig | |||
| Type signature applications: | apTypeSig | → | pTypeSig aTypeSig | |
| Parameterisable type signatures: | pTypeSig | → | apTypeSig | aTypeSig | |
| Atomic type signatures: | aTypeSig | → | typeCom | |
| | | typeVar | |||
| | | * |
any type | ||
| | | (typeSig) |
parenthised type signature | ||
| Expressions: | expr | → | apExpr | |
| | | monExpr | |||
| | | binExpr | |||
| | | \patterns -> expr |
lambda abstraction | ||
| | | let declOrDefnList in expr |
locally scoped definition(s) | ||
| | | if expr1 then expr2 [else expr3] |
conditional | ||
| | | case expr of caseAlts |
case | ||
| | | return [expr] |
|||
| | | def defCmdBody |
|||
| | | undef undefCmdBody |
|||
| | | aExpr | |||
| Function application expressions: | apExpr | → | fnExpr aExpr | |
| Monadic expressions: | monExpr | → | ignore expr |
Void cast |
| | | monOp expr | prefix monadic operator | ||
| Binary expressions: | binExpr | → | binOp expr | infix binary operator |
| | | selName := expr |
assignment | ||
| Function expressions: | fnExpr | → | apExpr | aExpr | |
| Atomic expressions: | aExpr | → | literal | |
| | | var | |||
| | | selName | |||
| | | selDataCon | |||
| | | prefixOp | |||
| | | this |
Context reference | ||
| | | (expr1,...,exprn) |
Tuple, n >= 2 | ||
| | | [expr1,...,exprn] |
List, n >= 0 | ||
| | | {sequence} |
block | ||
| | | (expr) |
parenthised | ||
| Monadic operators: | monOp | → | negOp | expOp | notOp| evalOp| rootSelOp | |
| negOp | → | - |
negation | |
| expOp | → | ^ |
exponentiation | |
| notOp | → | not |
boolean negation | |
| evalOp | → | ! |
evaluation | |
| rootSelOp | → | . |
Root selection | |
| Module identifier: | modId | → | initialUpperCaseChId | |
| Type constructors: | typeCon | → | conId | |
| Type variables: | typeVar | → | varId | |
| Class identifiers: | classId | → | initialUpperCaseChId | |
| Constructor identifiers: | conId | → | initialUpperCaseChId | |
| Variable identifiers: | varId | → | nonInitialUpperCaseChId | |
| Literal constants: | literal | → | #name | integer | float |
|
| | | char | string | NULLL_REF |
|||
| Names: | name | → | initialUpperCaseChId | |
| | | nonInitialUpperCaseChId | |||
| Integers: | integer | → | decimal | 0x hexadecimal | 0X hexadecimal |
|
| Floating point numbers: | float | → | decimal.decimal[(e|E)[(-|+)]decimal] |
|
| Characters: | char | → | 'any ascii character' |
|
| Strings: | string | → | "n ascii characters" |
n >= 0 |
| Initial upper case character identifiers: | initialUpperCaseChId | → | upperCaseCh ... idSuffixCh | |
| Non initial upper case character identifiers: | nonInitialUpperCaseChId | → | [lowerCaseCh | _] ... idSuffixCh |
|
| Decimal numbers: | decimal | → | digit ... digit | |
| Hexadecimal numbers: | hexadecimal | → | hexDigit ... hexDigit | |
| Identifier suffix characters: | idSuffixCh | → | upperCaseCh | lowerCaseCh | _ | digit |
|
| Upper case characters: | upperCaseCh | → | A | B | ... | Z |
|
| Lower case characters: | lowerCaseCh | → | a | b | ... | z |
|
| Hexadecimal digits: | hexDigit | → | digit | | |
| | | a | b | ... | f |
|||
| | | A | B | ... | F |
|||
| Digits: | digit | → | 0 | 1 | ... | 9 |
Last update: 11 October, 2005