[Haskell-cafe] Parsec expressions with alphaNum operators
Chris Casinghino
chris.casinghino at gmail.com
Tue Apr 8 10:15:51 EDT 2008
On Tue, Apr 8, 2008 at 4:46 AM, Paul Keir <pkeir at dcs.gla.ac.uk> wrote:
> I have noticed something interesting though. If I simply omit the "a"
> from "opLetter", the problem is gone. In fact, leaving "opStart",
> "opLetter", and "reservedOpNames" all empty works fine too.
That makes sense. opLetter is there to support "user-defined"
operators, as many languages allow two distinct classes of
identifiers - one which looks like variables and one which looks
like symbolic operators.
If you don't want to allow user-defined operators which
contain "a", so that ":a:", a reserved keyword, is the only valid
identifier which contains both "a" and another member of
opLetter, you should be OK leaving "a" off of the list of
opLetters. Indeed, you shouldn't actually need to specify ":a:"
in reservedOpNames either, since "reservedOp" doesn't check that
list, and the "operator" parser will already reject ":a:" because
it contains a non-opLetter. Though, for sanity you might leave
it there anyway.
At least, I think so.
--Chris
More information about the Haskell-Cafe
mailing list