[Haskell-cafe] Alex and Flex

Manlio Perillo manlio_perillo at libero.it
Fri Oct 3 13:37:38 EDT 2008


Manlio Perillo ha scritto:
> Manlio Perillo ha scritto:
>> Hi.
>>
>> I'm starting to write a CSS parser with Alex and Happy.
>> The grammar is defined here:
>> http://www.w3.org/TR/CSS21/grammar.html
>>
>> However I have noted that there are some difference in the syntax 
>> between Alex and Flex?
>> What is the rationale?
>>
>>
>> One more thing.
>> Here: http://www.haskell.org/alex/doc/html/alex-files.html
>> it seems that there is an error with
>> macrodef  :=  @smac '=' set
>>            |  @rmac '=' regexp
>>
>> it should be
>> macrodef  :=  $smac '=' set
>>            |  @rmac '=' regexp
>>
> 
> Ok, this is not an error, sorry.
> 
> 
> By the way, here is the list of differences between Alex and Flex I have 
> found, for people interested:
> 

 > [...]

Another problem.

In this rule:
@comment        = \/\*[^\*]*\*+([^\/\*][^\*]*\*+)*\/

[^\*] means "all characters except '*'", but Alex seems to not include 
the new line character.

So a comment like
/* A comment
*/

generates a lexical error.


Is this true?



Thanks  Manlio Perillo


More information about the Haskell-Cafe mailing list