[Haskell-cafe] happy + alex parsing question
stephen.tetley at gmail.com
Wed Feb 16 17:30:31 CET 2011
On 16 February 2011 15:31, Roman Dzvinkovsky <romand.ne at 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
More information about the Haskell-Cafe