将 W3C 的 EBNF 转换为 ANTLR

Convert W3C's EBNF to ANTLR

我想从 grammar which describes FTL syntax 生成一个 Swift 解析器。

是否有任何工具可以自动进行 EBNF -> ANTLR 转换?或者这两种文法语法至少是可以转换的?

语法本身是从 set of rules written in JavaScript. The other possible solution is to update rules -> EBNF serializer 自动生成的,用于输出 ANTLR 语法。但我是语言新手,不确定是否可以处理它。

Is there any tool to make the EBNF -> ANTLR conversion automatically?

据我所知,没有这样的工具。

Or are these two grammar syntaxes at least convertible?

没有。 EBNF 允许间接左递归规则,ANTLR 不支持(它支持直接左递归规则)。