
16 Feb
2011
16 Feb
'11
11:30 a.m.
On 16 February 2011 15:31, Roman Dzvinkovsky
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.