Syntaxdiagramme für Haskell 98 30. Oktober 2009 Module , ( module Export ) ModuleName where Body Body { ; ; Import Definition } Import , qualified as import ModuleName Class typeVar ClassName ( typeVar Type ) Context Class , ( => Class ) Declarations ; { } Declaration 1 ModuleName hiding Export Export VariableName .. , ( ) ConstructorName VariableName TypeName .. ( , ) VariableName ClassName module ModuleName Declaration = Function Pattern | , varName infix infixl Expr Expr where = Expr Context :: IntLiteral Type , Operator infixr 2 Declarations Definition TypeName Declaration type TypeName TypeName typeVar typeVar = = ( () [ = Typ { Type Type { typeVar typeVar ) | , ; where :: Type varName varName ConstructorOperator ConstructorName Type –> Declarations ConstructorName where ] typeVar , typeVar TypeName typeVar TypeName typeVar typeVar ClassName ClassName ) :: Typ Typ } Declarations } 3 data newtype Context , Typ Pattern varOperator Pattern Context ( ( Function ) SimplePattern varName class instance default Function Expr Expr varName ( Operator ) ) Expr , ConstructorName Literal ( Expr ] Expr ) .. { ] , = Expr ] varName Expr Expr –> Expr Expr –> } ; Expr where Declarations } :: Context Type 4 , , , <– Decls Pattern let | } SimplePattern Operator Expr | Expr Pattern Expr ConstructorName ( Expr Expr Expr Expr Operator Expr Expr else Expr ; <– Decls SimplePattern [ [ [ – Expr –> let Pattern { Expr in SimplePattern Declarations \ Expr of then let Expr { Pattern ConstructorOperator Pattern if case do Expr Pattern SimplePattern _ – Literal , ~ @ { varName varName ConstructorName , Pattern ( ) , Pattern [ ] Typ –> Type Type TypeName typeVar , Typ ( ) [ Typ ] varName ModuleName . Letter SmallLetter ( varOperator ConstructorName Name ModuleName Name 5 ) = Pattern } Name ModuleName . Letter BigLetter ( ConstructorOperator ) ConstructorOperator ModuleName . Symbol varSymbol ‘ ConstructorOperator ‘ varOperator ModuleName . Symbol varSymbol ‘ varName ‘ Letter SmallLetter BigLetter Digit ’ Literal ’ Char ’ Char " " 0x HexDigit 0o OctDigit + – . Digit E Digit 6 Digit Control NUL SOH STX ETX EOT ENQ ACK BigLetter Char a b f n r t v \ " ’ & BigLetter @ [ \ ^ \ ] ^ _ x HexDigit o OctDigit Digit Control Digit SmallLetter BEL A a BS B b HT C c LF D d VT E e FF F f CR G g H h ! SI I i @ DLE J j # DC1 K k $ DC2 L l % DC3 M m ^ DC4 N n & NAK O o * SYN P p + ETB Q q 0 – CAN R r 1 . EM S s 2 / SUB T t 3 \ ESC U u 4 | FS v 5 < GS w 6 = RS x 7 > US V W X 7 varSymbol Digit SO