Curry: An Integrated Functional Logic Language
Curry: An Integrated Functional Logic Language
Curry: An Integrated Functional Logic Language
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
SimplePattern ::= VariableID | _<br />
| QDataConstrID<br />
| Literal<br />
| ()<br />
| ( Pattern1 , . . . , Patternn ) (n > 1)<br />
| ( Pattern )<br />
| [ Pattern1 , . . . , Patternn ] (n � 0)<br />
VariableID ::= see lexicon<br />
LocalDefs ::= {ValueDeclaration1 ; . . . ; ValueDeclarationn } (n > 0)<br />
ValueDeclaration ::= FunctionDeclaration<br />
| PatternDeclaration<br />
| VariableID1 , . . . , VariableIDn free (n � 0)<br />
PatternDeclaration ::= Pattern = Expr [where LocalDefs]<br />
CondExprs ::= | Expr = Expr [CondExprs]<br />
Expr ::= \ SimplePattern1 . . . SimplePatternn -> Expr (n > 0)<br />
| let LocalDefs in Expr (let expression)<br />
| if Expr then Expr else Expr (conditional)<br />
| case Expr of {Alt1 ; . . . ; Altn } (case expression, n � 0)<br />
| do {Stmt1 ; . . . ; Stmtn ; Expr } (do expression, n � 0)<br />
| Expr QInfixOpID Expr (infix operator)<br />
| - Expr (unary minus)<br />
| FunctExpr<br />
FunctExpr ::= [FunctExpr] BasicExpr (function application)<br />
BasicExpr ::= QVariableID (variable)<br />
| QDataConstrID (data constructor)<br />
| QFunctionID (defined function)<br />
| ( QInfixOpID ) (operator function)<br />
| Literal<br />
| () (empty tuple)<br />
| ( Expr ) (parenthesized expression)<br />
| ( Expr1 , . . . , Exprn ) (tuple, n > 1)<br />
| [ Expr1 , . . . , Exprn ] (finite list, n � 0)<br />
| [ Expr [, Expr] .. [Expr] ] (arithmetic sequence)<br />
| [ Expr | Qual1 , . . . , Qualn ] (list comprehension, n � 1)<br />
| ( Expr QInfixOpID ) (left section)<br />
| ( QInfixOpID Expr ) (right section)<br />
Alt ::= Pattern -> Expr<br />
Qual ::= Expr<br />
| Pattern