Reputation: 3352
I am compiling on Windows using GHC. Here is my code for reference http://hpaste.org/86539
The problem is that the following expression does not parse:
3+2 < 1+-4 <= -3 << 1
. It should parse as:
.. however, I get unexpected -
when it is clearly the highest operator. I suspect it's because of my usage of try
on line 55, however without it <
and <<
and operators that are repetitions of one symbol do not parse correctly.
I am seeking advice or hints.
Upvotes: 4
Views: 152
Reputation: 5140
The problem is on line 56:
P.lexeme <$ string s
Should read:
P.lexeme gmlLexer $ string s
The former construct was matching s
, then returning the function P.lexeme
as the result of the parse! The subsequent >>
threw the result away, hence it type checked.
What you wanted to do was the later line: Apply the P.lexeme
for your language gmlLexer
to the parser for matching s
.
Upvotes: 6