compiler construction - function definition in BNF C grammar -



compiler construction - function definition in BNF C grammar -

i'm reading this c bnf grammar. have next questions:

is right it's <declarator> job parse syntax: id(int a, int b) (in <direct-declarator>) , on arrays in parameters of function prototype/definition, etc; in <function-definition>, why <declarator> followed {<declaration>}* ? understood, create valid type name or storage class followed function header id(int a, int b) int. i'm sure isn't valid in c. missing?

yes, <declarator> in grammar name of object beingness declared, plus arguments or array size (and pointer qualifiers of type). <declarator> not include base of operations type (return type function; element type array).

note there 2 alternatives in <direct-declarator>, both of seem relevant functions: <direct-declarator> ( <parameter-type-list> ) <direct-declarator> ( {<identifier>}* ) first of these think of function declaration, parameters types or types-with-parameter-name. sec 1 list of identifiers. (it should, think, comma-separated list of identifiers.) sec case old-style "k&r" function definition syntax, may never have seen before, , should forget after reading reply because -- while c compilers still take -- has been deprecated not years, decades. don't utilize it. historical completeness, here's how looked: int foo(n, p) int n; char p; { / body of function */ }

c compiler-construction grammar bnf

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -