[clean-list] Type Expression Grammar question
Jigang Sun
Jigang.Sun at student.paisley.ac.uk
Fri Nov 2 23:32:18 MET 2007
>From Clean grammar,
FunctionType = [Type ->] TypeExpr //A3.1 on page 112 Clean language report
Type = {BrackType}+
BrackType = [!] TypeExpr
TypeExpr = TypeVariable // see A.7
| PredefinedType
| (TypeExpr)
PredefinedType = BasicType | ListType | ArrowType
ArrowType = "( " Type -> Type ")" //on p43 section 4.6 language report
I cannot see a function type
myFunc :: Int -> Int -> Int // there are more than one "->"
is accepted. Because in TypeExpr, "->" must be placed between a pair of parenthesises like (Int -> Int).
Could the grammar be understood as
FunctionType = TypeExpr | ArrowType //equivalent to FunctionType = [Type ->] TypeExpr
SuperTypeExpr= ArrowType | TypeExpr //used for funcType
TypeExpr = TypeVariable // see A.7
| PredefinedType
| (TypeExpr)
PredefinedType = BasicType | ListType |"(" ArrowType ")"
ArrowType = Type -> TypeExpr //p43 4.6[1] change from "(" Type -> Type ")"
Here I take FuncType as TypeExp, since a function is a value.
But I still cannot classify ArrowType as TypeExp because
myFunc :: Int -> Int Int -> Int
is not be parsed by Clean as
myFunc :: (Int -> Int) Int -> Int
Could anyone explain the related grammar or specify the grammar more clearly?
Thanks.
Jigang
Legal disclaimer
--------------------------
The information transmitted is the property of the University of Paisley and is intended only for the person or entity
to which it is addressed and may contain confidential and/or privileged material. Statements and opinions expressed in this e-mail may not represent those of the company. Any review, retransmission, dissemination and other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender immediately and delete the material from any computer.
--------------------------
More information about the clean-list
mailing list