On 16 February 2011 15:31, Roman Dzvinkovsky <romand...@gmail.com> wrote:

>
> using alex+happy, how could I parse lines like these?
>
>> "mr <username> says <message>\n"

Alex has both user states and powerful regex and character set
operators (complement and set difference), that said, LR parsing plus
Alex lexing doesn't look like a satisfactory match for the input
format. I'd either go with regexps or write a hand-coded lexer and do
all the work the work in the lexer as the result just needs to be a
list of pairs [(String,String)].

If you are using this input format as a test-case for learning how to
use Happy+Alex, it isn't a good start point. You'd be better choosing
something with more structure and less problematic tokens such as an
expression parser.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to