代码之家  ›  专栏  ›  技术社区  ›  Divyat

D语言的BNF语法形式[闭口]

bnf d
  •  1
  • Divyat  · 技术社区  · 7 年前

    我找不到BNF形式的编程语言D的语法。我可以在网上找到D的语法: https://github.com/dlang-community/DGrammar

    但是,如果我能获得BNF表格,那就更好了。

    1 回复  |  直到 7 年前
        1
  •  2
  •   BioTronic    7 年前

    恐怕没有这样的语法。之前有过几次尝试。Pegged示例中的PEG语法可能与您想要的最接近,但已有五年没有更新,因此可能不再完全准确:

    https://github.com/PhilippeSigaud/Pegged/blob/master/pegged/examples/dgrammar.d

    D-Grammar是最新的:
    https://github.com/dlang-community/DGrammar

    您还可以查看一些解析器:

    https://github.com/dlang-community/D-Scanner/

    https://github.com/aBothe/D_Parser/tree/master/DParser2/Parser

    https://github.com/SDC-Developers/SDC/tree/master/src/d/parser

    https://github.com/D-Programming-Language/dmd/blob/master/src/parse.c

    DDT也有一个,但我不知道在哪个源文件中:
    https://github.com/DDT-IDE/DDT