在 TinyPG 中使用 BNF 中的现有语言?

发布于 2024-07-09 04:29:57 字数 464 浏览 7 评论 0原文

我如何使用 这些 BNF 语法 位于 GOLD 元语法(RegExp + BNF)与 TinyPG? 我是 BNF 新手,所以大约需要进行什么类型的转换才能将 BNF 转换为 EBNF?

我相信它应该非常简单,因为与 RegExp + BNF 的 GOLD 语法相比,TinyPG 需要 RegExp + EBNF

另外,是否有任何可用语言的 TinyPG 源代码,只是为了看看我需要进行哪种转换?

How can I use these BNF grammars which are in GOLD meta-syntax (RegExp + BNF) with TinyPG? I'm new to BNF so approximately what sort of conversion will I have to do to convert BNF to EBNF?

I believe it should be pretty simple since TinyPG needs RegExp + EBNF in comparison to the GOLD grammars which are RegExp + BNF.

Also, is there any TinyPG source code for any language available, just to see what sort of conversion I would have to do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彩虹直至黑白 2024-07-16 04:29:57

EBNF 并不完全向后兼容 BNF,但差异实际上很小,您应该熟悉

http://www.cs.cmu.edu/~pattis/misc/ebnf.pdf

主要你必须处理特殊字符 <> |:=(用双引号括起来)。

您可以使用 GOLD 元语法引擎来输出您的解析器(如果它可以采用受支持的语言之一) - 而不是使用 TinyPG...

它引出了一个问题 - 当您实现解析器时,您的解析器将采用什么语言?

EBNF is not entirely backwards compatible with BNF, however the differences are actually slight, you should be familiar with the document at

http://www.cs.cmu.edu/~pattis/misc/ebnf.pdf

Primarily you have to handle the special characters <>|:= (enclosed in double quotes).

You could just use the GOLD meta-syntax engine to output your parser if it can be in one of the supported languages - instead of using TinyPG...

It begs the question - What language will your parser be in when you are implementing it?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文