Anthony Weru
Anthony Weru

Reputation: 35

Conversion to Backus-Naur Form

What is the equivalent version of the line below in Backus-Naur Form?

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

Upvotes: 0

Views: 65

Answers (1)

Jin-oh Kang
Jin-oh Kang

Reputation: 347

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 | ε

Upvotes: 1

Related Questions