[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SYNTAX ONLY: Patterns, LHSes and Type Arrows



For completeness, here are the changes which have been proposed for
patterns, plus all other infix operator changes needed for the new
two-superscript form.  The important ones are those Joe/Brian/Paul have
made to pat(6,l).  This disallows, e.g.

	n + 2 + 3

but still allows:

	_ + 1
	n + 100

The changes to "type"/"constr" make the precedence and associativity
of "->" explicit (right infix, lower precedence than any constructor).
Thanks to Kent Karlsson for these fixes.

Notation is as for expressions.

Kevin


---------------------  Patterns  -------------------------------


pat		->	pat(0,n)
pat(i,n)	->	[pat(i+1,n) conop(i,n)] pat(i+1,n)
		|	pat(i,l)
		|	pat(i,r)

pat(i,l)	->	{ pat(i,l) | pat(i+1,n) } conop (i,l) pat(i+1,n)
pat(6,l)	->	- { integer | float }
		->	{ var | _ } + integer

pat(i,r)	->	pat(i+1,n) conop(i,r) {pat(i,r) | pat(i+1,n)}

pat(10,a)	->	con apat1 ... apatk
		|	apat


----------------------  Expressions  ---------------------------


aexp		->	...
		|	( exp(i+1,n) op(i,a) )
		|	( op(i,a)    exp(i+1,n) )


-----------------------  Function LHSs  ------------------------


funlhs		->	afunlhs
		|	pat(i+1,n) varop(i,n) pat(i+1,n)
		|	pat(i,l)   varop(i,l) pat(i+1,n)
		|	pat(i+1,n) varop(i,r) pat(i,r)



--------------------------  Type Arrows  -----------------------


type		->	type -> btype
		|	btype

btype		->	tycon atype1 ... atypek
		|	atype

constr		->	btype1 conop btype2