【问题标题】:Conversion to Backus-Naur Form转换为巴库斯-瑙尔形式
【发布时间】:2020-01-29 14:30:10
【问题描述】:

Backus-Naur 形式中以下行的等效版本是什么?

func    :   type id '('  ')' '{' { type var_decl { ',' var_decl } ';' } { stmt } '}'

【问题讨论】:

    标签: compiler-construction bnf


    【解决方案1】:
    func         : type id '('  ')' '{' func_body '}'
    func_body    : decls stmts
    decls        : decls decl | ε
    decl         : type var_decl rem_var_decls ';'
    rem_var_decls: rem_var_decls ',' var_decl | ε
    stmts        : stmts stmt | ε
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多