
On Mar 19, 2010, at 11:14 , Derek Thurn wrote:
Here's a simplified version of my grammar:
myType = try (primitiveType) <|> arrayType primitiveType = do {reserved "int"; return "primitive"} arrayType = do { primitiveType; symbol "["; symbol "]"; return "array"}
What you're doing here is matching and succeeding on primitiveType and never even looking for the bracket; your parser then exits and the framework fails expecting the end of the token stream but finding the unmatched left bracket. You need to rearrange your cases:
myType = try arrayType <|> primitiveType
so that your parser actually checks for the brackets before concluding that it has a primitiveType already. Even better would be to refactor the grammar since both types start with a primitiveType, but I'll leave that up to you since it does complicate returning the shape of the resulting type. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH