1014 C language Grammar definition and the derivation process of C program

Source: Internet
Author: User

< source programs >→< External declarations > | < source programs > < external declarations >

< external declarations >→< defining functions > |< declarations >

< defining functions >→< Type specifiers > < declarators > < compound statements >

< type specifier >→< no return type > | < character type > | < integral type > | < floating-point >

< declarators > < pointers > < direct declarators > | < direct declarators >

< pointers >→< ' * ' > | < ' * ' pointers >

< direct declarators > < identifiers > | < Direct statement >[]| < Direct declaration ><[constant Expression]> | < identifiers > (parametric tables) | < identifiers > () | < direct declarations >,< identifiers list >

< identifier list >:< identifiers > | < identifier list >,< identifiers >

< constant expressions >→< conditional expressions >

< parameter list >→< parameter declaration > | < parameter list >,< parameter declaration >

< parameter declarations >→< descriptor declarations >< identifiers >

< compound statement >→{} |   {Statement List} | {Declaring statement list}

< declarations list >→< declarations > | < declarations list >< declarations >

< declarations >→< initialization declarations > |< Initialization Declaration list >,< Initialization declarations >

< initialization declarations >→< Declarations > | < declarations >=< initialization programs >

< initialization programs >→< Assignment Expressions > | {Initialize List} | {Initialize list,}

< initialization list >→< initialization program > |< initialization List >,< initialization program >

< statement list >→< Statement > | < statement list >< statements >

< statements >→< Compound statements > |< expression Statements > | < conditional statements > | < looping statements > | < jump statements >

< expression statements >→; | < expression >;

< conditional statement >:if (expression) {statement} | If ' (expression) {statement} else{statement}

< loop statement >→where (expression) {statement} | For (expression statement expression statement) {statement} | For (expression statement expression statement) {statement}

< jump statements > |  Continue; |  Break  |  Return | return expression;

< expressions >:< Assignment Expressions > | < expressions >,< Assignment Expressions >

< Assignment expressions >→< conditional Expressions > | < unary expressions >< assignment operators >< Assignment Expressions >

< conditional expression >→< logical OR expression >|< logical or expression >?< expression >:< conditional expression >

< logic or expression >→< logic and expression > | < logical OR expression > < or op-logical expressions >

< logic and expression >:< or expression > | < logical expressions >< and operations or expressions >

< or arithmetic expressions >→< xor expressions > |< or expression > | | < XOR expressions >

< XOR expressions >:< and Expressions > | < XOR expressions >^< and Expressions >

< expressions >:< Equality Expressions > | < expressions >&< Equality expressions >

< equality expressions >:< Relationship Expressions > | < equality Expressions > = < relational expressions >| < equality expressions >! = < Relationship expressions >

< relationship expressions >:,< substitution Expressions > | < relationship expressions > < < replace expressions > |  < relationship expressions > > < shift expressions > | < relationship expressions > <= < substitution expressions >| < relationship expressions > >= < substitution expressions >

< replace expressions >:< addition Expressions > | < replace expression >< left >< add expression > |< substitution expression >< right >< add expression >

< addition expressions >:< multiplication expressions > |< addition Expressions >+< multiplicative expressions > |< addition Expressions >-< multiplication expressions >

< multiplication expressions >:< cast expressions > |< multiplication Expressions >*< cast expressions > |< multiplication Expressions >/< cast Expressions > | < multiplication expressions >%< cast expressions >

< cast expressions >:< unary expressions > | (type name) < cast expression >

< unary expressions >:< postfix expressions > |< inc Operations >< unary expressions > | <dec Operations >< unary expressions > |< unary Operators >< cast Expressions > | < struct variables >< unary expressions > | < struct variables > (type name)

< postfix expression >:< basic expression > |< suffix expression >[expression] |< suffix expression > () |< suffix expression > (argument expression list) |< suffix expression >.< identifier > | < postfix expressions >*< identifiers > |< suffix expressions ><inc Operations > | < Postfix expressions ><dec operations >

< basic expressions >→< Identifiers > | < Constants > |  < string Constants > | (expression)

< parameter expression list;: < Assignment expression > |< parameter expression List < Assignment expression >

< unary operator;: & | *  |  +  |  -  | ~ |!

< Assignment operator >→= | < multiplication distribution > | < Division allocation > | <mod Distribution > | < addition allocation > | < Sub Assignment > | < left Assignment > | < right Assignment > | < and distribution > | < XOR assign > |< or Assign >

< storage class Descriptor >→< definition type >| < external variables > | < static > | < auto > |< register >

< struct or common body specifier >:< struct or common body >< identifier >{struct declaration list} |< struct or common body >{struct Declaration list} | < struct or common body >< identifiers >

< structure or common body >:< structure > | < shared body >

< struct declaration list >:< struct declaration > | < struct declaration list >< struct declaration >

< struct declaration >:< specifier qualifier List >< struct description list characters >; specifier qualifier list →< type specifier >< descriptor qualifier List > | < type specifier > |< type qualifier >< specifier qualifier list > |< type qualifier >

< struct description list characters >→< struct declaration > | < struct description list characters >,< struct declaration >

1014 C language Grammar definition and the derivation process of C program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.