Reputation: 35
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
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