用C++编写的编译框架适用于高阶、动态、函数式语言
有许多编译器框架可以帮助实现语言的后端(例如 LLVM)。然而,似乎缺乏用 C++ 编写的、可以表示高阶、动态、函数式语言的“中间端”。该框架应该做一些通用的事情,比如 lambda 提升、闭包转换、类型推断等,并帮助其他语言特定的转换,比如翻译类型类等。我能想到的一些候选者是 PyPy 和 干净。这些是高阶、动态、函数式语言的编译器。可以说,人们可以将任何语言的前端连接到这些,并重新使用其中可用的数据结构和转换来完成中间端工作。然而,它们分别是用 Python 和 Clean 实现的。是否有 C++ 实现的框架用于上述目的?
There are many compiler frameworks out there that can aid in implementing the backend for a language (eg. LLVM). However, there seems to be a dearth of "middle-ends" that are written in C++, and that can represent higher-order, dynamic, functional languages. The framework should do generic things like lambda lifting, closure conversion, type inferencing, etc. and help in other language specific transformations like, say, translating type classes, etc. Some candidates I can think of are PyPy and Clean. These are compilers for higher order, dynamic, functional languages. Arguably, one can connect the frontend for any language to these, and re-use the data structures and transformation available in them for doing the middle-end work. However, they are implemented in Python and Clean, respectively. Are there frameworks implemented in C++ for the above purpose?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编写一个编译器中端确实是一个非常奇怪的选择 - - 本质上是一个用于符号操作和代数数据类型转换的引擎 - 使用没有构造函数模式匹配或代数数据类型的语言。
函数式语言的编译器/总是/用函数式语言编写。通常是打字的。这些语言非常非常适合这项任务。
It would be a very odd choice indeed to write a compiler middle end -- what is essentially an engine for symbolic manipulation and transformation of algebraic data types -- in a language without constructor pattern matching or algebraic data types.
Compilers for functional languages are /always/ written in functional languages. Usually typed ones. The languages are just far, far better suited for this task.