gpt4 book ai didi

c++ - 是否有将 EBNF 翻译成 boost::spirit 的翻译工具?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:20:22 35 4
gpt4 key购买 nike

翻译器也可以在 boost::spirit 中。我在互联网上找不到任何东西。也许我应该做一个?

最佳答案

spirit introduction 开始:

Expression templates allow us to approximate the syntax of Extended Backus-Normal Form (EBNF) completely in C++.

因此您几乎可以编写纯 EBNF,不需要翻译器

我对 spirit 不是很熟悉,不知道语法到底有什么不同,但是如果 spirit C++ EBNFreal EBNF 的差异很小,那么一个简单的 sed脚本可能就足够了。
如果不正确,您可以编写理解 EBNF 的精神解析器,然后使用 AST 创建 C++ 代码,该代码是该 AST 的精神表示。

关于c++ - 是否有将 EBNF 翻译成 boost::spirit 的翻译工具?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/923817/

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