[Haskell-cafe] Re: Editors for Haskell

Brian Hulley brianh at metamilk.com
Thu Jun 1 03:48:40 EDT 2006


Thomas Hallgren wrote:
> Brian Hulley wrote:
>
>>
>> Another thing which causes difficulty is the use of qualified
>> operators, and the fact that the qualification syntax is in the
>> context free grammar instead of being kept in the lexical syntax
>> (where I think it belongs).
>
> You are in luck, because according to the Haskell 98 Report, qualified
> names are in the lexical syntax!
>
> http://www.haskell.org/onlinereport/syntax-iso.html
>
> So, C.f is a qualified name, but C . f is composition of the
> Constructor C with the function f.

Thanks for pointing this out. Although there is still a problem with the 
fact that var, qvar, qcon etc is in the context free syntax instead of the 
lexical syntax so you could write:

        2 `    plus      ` 4
        (    Prelude.+
               {- a comment -} ) 5 6

I think this must have been what was in the back of my mind. To make parsing 
operator expressions simple (ie LL1), it is necessary to somehow treat ` 
plus    ` as a single lexeme, but by having such a thing in the CFG instead 
of the lexical grammar, a "lexeme" can then occuply multiple lines (which 
means you can't associate each line with a list of lexemes for incremental 
parsing)...
Allowing "lexemes" to contain spaces and comments also makes fontification a 
bit more tricky.
Also, I can't see any sense in making such things part of the CFG instead of 
just keeping them lexical - whoever would want to put spaces in a var, qcon 
etc?
I suppose it's not an impossible problem to solve but it just makes life a 
lot harder for no good purpose that I can see.

Best regards, Brian.


-- 
Logic empowers us and Love gives us purpose.
Yet still phantoms restless for eras long past,
congealed in the present in unthought forms,
strive mightily unseen to destroy us.

http://www.metamilk.com 



More information about the Haskell-Cafe mailing list