gpt4 book ai didi

c++ - 使用 boost::proto 在 C++ 中编写 DSL

转载 作者:太空狗 更新时间:2023-10-29 23:01:00 26 4
gpt4 key购买 nike

很抱歉提出这样一个开放式问题,但我想用 C++ 模拟一些合成程序集(不是针对真正的处理器),并且我想将程序集与其运行的模拟器的实现分离。

编写 DSL 或类似的东西似乎是显而易见的方式,我对此有一些经验,在 Groovy 中做过类似的事情(实际上是 DSL 和解释器的混合体)。

boost::proto 似乎是显而易见的选择,但我发现文档完全难以理解,尽管正如我所说,我掌握了一些基础知识。

是否有任何替代教程或类似教程可以解释 - 以一种侧重于编写 DSL 的实用性而不是 AST 等理论的方式 - 如何做到这一点。或者有其他选择吗?现在我坚持将汇编指令实现为构成模拟器的类的方法,这使得它们非常紧密地绑定(bind)并且极难维护代码库。

最佳答案

我附议建议你可能有一个不匹配的 XY-problem 的评论在这里。

与此同时,针对嵌入式 eDSL 的应用 Boost Proto 的最佳介绍是在 Dave Abrahams 的 cpp-next.com 博客上。可悲的是,这已经停播了。

Boost Proto 的作者埃里克·尼布勒 (Eric Niebler) 已根据要求向人们发送这些页面的原始转储:

The C++ community is suffering from the loss of the cpp-next.com website and all the great content that was once hosted there. In the past 2 months, I’ve gotten many questions both about the site and about the fate of my “Expressive C++” article series. In response, I will re-post my old articles on this blog. But I’m busy and it’ll take time. In the meanwhile, if you have a desperate need for a readable introduction to Boost.Proto and domain-specific embedded languages in C++, and you don’t mind reading raw markdown, email me. I’ll send you what I have.

http://ericniebler.com/2014/05/24/cpp-next-com-and-the-expressive-cxx-series-2/

与此同时,waybackmachine 有一些,例如:

关于c++ - 使用 boost::proto 在 C++ 中编写 DSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32059414/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com