skeet70 / pascal-compiler

A project Pascal compiler written in Haskell.
5 stars 1 forks source link

Third Grammar Section #40

Closed skeet70 closed 11 years ago

skeet70 commented 11 years ago

See #39

skeet70 commented 11 years ago

I'm done with this for now, but I'll definitely have to reopen it once we figure out what's going to work.

iduhetonas commented 11 years ago

Couple issues I noticed.

You're doing:

any (unwrapToken (lookAheadToken parsingData) ==) ("MP_PLUS", "MP_MINUS", "MP_NOT", "MP_LPAREN")

when you should be doing:

any (unwrapToken (lookAheadToken parsingData) `elem`) ["MP_PLUS", "MP_MINUS", "MP_NOT", "MP_LPAREN"]

or something similar. I haven't tested to see if that will work, but your current method is trying to match a String with a Tuple.

You have:

getTokenType (lookAheadToken parsingData) ==  "IdentifierOrLiteral"

but on the next line you're doing:

getTokenType lookAheadToken parsingData ==  "ReservedWord"

and this will fail, because the program will interpret getTokenType as a higher-ordered function and fail, because it isn't.

skeet70 commented 11 years ago

Awesome! Thanks