lexer puzzle

Arthur Baars arthurb at cs.uu.nl
Mon Sep 15 16:00:43 EDT 2003


I agree with Marcin,

A... should be split into "A.." and "."

As I read the (on-line) report the "maximal munch" rule says that you 
should read the longest lexeme. It does not say that two operators have 
to be separated by whitespace.

Because A... is not a lexeme, the longest lexeme you can read from 
"A..." is "A.." (qualified dot-operator).

Arthur

On maandag, sep 15, 2003, at 12:11 Europe/Amsterdam, Malcolm Wallace 
wrote:

> Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> writes:
>
>> Argh, I was wrong. It's A.. (qualified operator), then . (operator).
>
> You are forgetting about the maximal munch rule.  An operator cannot 
> appear
> directly next to another operator without some whitespace to separate 
> them.
> For instance "A.+." is an operator called (+.) from module A, not an
> operator called + followed by compose.
>
> But, although "A...." could be the three-dot operator "..." from the
> module A, it is not possible to have "A..." interpreted as a two-dot
> operator, because ".." is reserved as sugar for enumeration sequences,
> and so is explicitly excluded from the varsym production.
>
> Thus, the only possible lexical interpretation is the one you first
> suggested, namely a constructor "A" followed by a three-dot operator
> "...".
>
> Regards,
>     Malcolm
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>



More information about the Haskell mailing list