有没有关于使用Alex + Happy构建简单解释器的教程? [英] Are there any tutorials on building a simple interpreter using Alex + Happy?

查看:221
本文介绍了有没有关于使用Alex + Happy构建简单解释器的教程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在查看文档I之后,我会在一个学校项目中创建一个使用简单语言的解释器。了解大部分内容,但希望看到使用这些工具的完整示例。 解决方案

不是建立解释器,而是在建立词法分析器和解析器时,是的。请参阅Alex的词法分析器示例,此处,合并在此处介绍Happy 。我发现在Alex和Happy的darcs仓库中分发的haskell.x和haskell.y文件很有用。你可以在这里找到 here。


I'm working on a school project where I have to build an interpreter for a simple language using Alex + Happy in Haskell.

After looking through the documentation I understand most of it, but would like to see a full blown example on using the tools.

解决方案

Not on building interpreters, but on building lexers and parsers, yes. See the example for a lexical analyzer in Alex, here, combined with an intro to Happy here. I found the haskell.x and haskell.y files distributed in the darcs repos for Alex and Happy useful. You can find those here and here.

这篇关于有没有关于使用Alex + Happy构建简单解释器的教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆