Haskell - How to best to represent a programming language's grammar?

后端 未结 5 1074
星月不相逢
星月不相逢 2021-01-30 09:52

I\'ve been looking at Haskell and I\'d quite like to write a compiler in it (as a learning exercise), since a lot of its innate features can be readily applied to a compiler (pa

5条回答
  •  借酒劲吻你
    2021-01-30 10:09

    Maybe you can look at some real-world projects to see how they do it?

    Less than a week ago, the Language-Python project was announced on the Haskell-Cafe mailinglist. It's a Python parser implemented in Haskell, using the Happy parser generator and Alex lexer generator.

    And of course, there is Pugs, an implementation of Perl 6 in Haskell (the first implementation of Perl 6 that conforms to a significant subset of the Perl 6 specification).

提交回复
热议问题