parser: calls bind less tightly; parse record access syntax (operator '\')

This commit is contained in:
darkf 2013-11-08 00:43:02 -08:00
parent 1d57fca6b4
commit 8ce39fa0e7
1 changed files with 7 additions and 3 deletions

View File

@ -75,7 +75,8 @@ ifcond :: AST
= "if" expr "then" expr "else" expr { IfExpr $1 $2 $3 }
expr :: AST
= expr "::" expr { Cons $1 $2 }
= expr "(" args ")" { Call $1 $2 }
/ expr "::" expr { Cons $1 $2 }
/ expr "+" fact { Add $1 $2 }
/ expr "-" fact { Sub $1 $2 }
/ expr "==" fact { Equals $1 $2 }
@ -90,11 +91,14 @@ expr :: AST
fact :: AST
= fact "*" term { Mul $1 $2 }
/ fact "/" term { Div $1 $2 }
/ access
access :: AST
= access "\\" identifier { Access $1 (Var $2) }
/ term
term :: AST
= term "(" args ")" { Call $1 $2 }
/ tuple
= tuple
/ "(" expr ")"
/ "[" listseq "]"
/ ifcond