4

How can I use Alex as the lexer, then feed the tokens into Parsec for parsing?

Are there any examples?

I think Alex is better (and easier?) to use for lexical analysis than Parsec, but Parsec seems easier than Happy for parsing. They would probably make a good combination.

ruben2020
  • 1,549
  • 14
  • 24

1 Answers1

2

Yes, you can; see this answers by sinan to a related question, which also links to example code. Others have taken that road as well.

Community
  • 1
  • 1
Joachim Breitner
  • 25,395
  • 6
  • 78
  • 139
  • Any more examples, please? Or some tutorial or article perhaps? Thanks. – ruben2020 Jun 14 '13 at 20:22
  • 1
    That’s all I found. I think it is sensible to use Alex with parsec, but by no means the necessary best way and most users of parsec are likely happy(sic!) to use Parsec lexemes. – Joachim Breitner Jun 14 '13 at 21:06