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

Source: Internet
Author: User

< programs > < external declarations > | < programs > < external declarations >

< external declarations > < function definitions > | < statement >

< function definition > < type description > < declarators > < compound statements >

< type description > <void> | <char> | <int>|<float>

< declarations > < pointers > < direct specifiers > | < direct specifiers >

< hands > <*> | <* hands >

< direct specifiers > < identifiers > | < direct specifier ' ['] ' > | < direct identifier ' [' constant expression '] ' > | < identifiers ' (' parameter list ') ' > | < identifiers ' (') ' > | < direct specifier '; ' Identification list >

< identification list > < identifiers > | < identification list '; ' Identifiers >

< constant expression >-< constant expression >

< parameter list > < parameter declaration > | < parameter list '; ' parameter declaration >

< parameter declaration >->< ' descriptor ' declaration ' identifier ' >

< compound statement >-> < ' {'} ' > | < ' {' statement list '} ' > | < ' {' Declare ' statement list '} ' >

< declarations _ list > < identifiers > | < identification list identifiers >

< identifiers > < initialize the identifier > |< initialize Identifiers ', ' Initialize identifiers >

< initialization identifiers > < identifiers > | < identifier ' = ' initializer >

< initializers > < Assignment expressions > | < ' {' Initialize list '} ' > | < ' {' initialization list ', '} ' >

< initialization list > < initialize >| < initialize list ', ' initializer >

< statement Tables > < statements > | < statement table Statements >

< statements > |< compound statements > |< expression Statements >|< SELECT statements >|< iteration statements >|< jump statements >

< expression statement >-->< expression '; ' >

< SELECT statement >:if< ' (' expression ') ' Statement > | If < ' (' expression ') ' statement else statement >

< iteration statement >-while< ' (' expression ') ' statement >| For ' (' expression statement expression statement ') ' statement | For ' (' expression statement expression Statement expression ') ' statement

< jump statements >-<continue>|<break>|<return>|<return expressions >

< expressions > < Assignment expressions >|< expressions, assignment expressions >

< Assignment expressions >->< conditional Expressions >|< Unary expression assignment operator assignment Expressions >

< conditional expressions > < logic or expression >|< logic or expression '? ' expression ': ' Conditional expression >

< logic or expression >->< logic and Expression > |< logical OR expression or op logical expression >

< logic and expression >->< or arithmetic Expressions >|< logical expressions and operations or expressions >

< or expression >-><-xor Expression >|< or op-expression ' | ' XOR expression >

< XOR expressions >:< and Expressions > | < xor expression ' ^ ' with expression >

< expression >:< equality expression >|< expression ' & ' equality expression >

< equality expressions >:< Relationship Expressions > |< equality expressions equals expression of expressions > |< equality expressions are not equal to an expression of expressions >

< relationship expression >:< shift expression >|< relational expression ' < ' shift expression >|< relational expression ' > ' shift expression >|< relational expression less than equals op shift expression >|< Relationship expression greater than or equal to OP shift expression >

< shift expression >:< addition expression > |< shift Expression Left op addition expression > |< shift expression Right arithmetic addition expression >

< addition expressions >:< multiplication Expressions > | < addition expression ' + ' multiplication expression >|< addition expression '-' multiplication expression >

< multiplication expressions >:< cast Expressions > | < multiplicative expression ' * ' cast expression > | < multiply expression '/' cast expression > |< multiplication expression '% ' cast expression >

< cast expression >:< unary expression > | < ' (' type name ') ' Cast expression >

< unary expression > < suffix expression >|< inc operation unary expression >|< Dec operation unary expression >|< unary operator >| expression The unary expression of < structure variables >| < structure variable ' (' type name ') ' >

< Postfix expressions >:< basic Expressions > | < suffix expression ' [' expression '] ' > | < suffix expression ' (') >|< suffix expression ' (' parameter expression list ') ' >|< postfix expression '. ' identifier >| < suffix expression pointer operation identifier >| < postfix Expression Inc operation >| < suffix expressions Dec operations >

< basic expressions > < identifiers > |< constants >|< String Constants > |< ' (' expression ') ' >

< parameter expression list >: < Assignment expression >| < parameter expression list ', ' Assignment expression >

< unary operators >:< ' & ' > |  < ' * ' > | < ' + ' > | < '-' > | < ' ~ ' > | < '! ' >

< assignment operator > < ' = ' > |< multiplication allocation > |< div Assignment >| <mod Distribution > |  < addition allocation > | <sub Assignment > |< left Assignment > | < right Assignment > |< and Assignment > |< xor Assignment > |< or Allocation >

< storage-Class specifiers > < definition types > |< external variables > | < static > |< auto > |< register >

< struct or Union descriptor >:< struct or union identifier ' {' struct declaration list '} ' > | < struct or union ' {' struct declaration list '} ' >|< struct or union identifier >

< structure or union >:< Structure > |< Union >

< struct declaration list > < struct declaration > |< struct Declaration list >

< struct declaration >:< Descriptor Qualifier list structure specifier '; ' Specifiers-type specifier specifier qualifier list >| < type specifier >| < type qualifier specifier qualifier list > |< type qualifier >

< structure description list characters > < struct declaration >| < struct descriptor list ', ' struct declaration >

< struct declaration >:< declaration > |< ': ' Constant expression >|< declaration ': ' Constant expression >

< enum declaration > < enumeration ' {' Enumerator list '} ' >| < enum identifier ' {' Enumerator list '} ' > |< enumeration identifier >

< Enumerator list > < enumerator > |< enumerator list ', ' Enumerator >

< enumerator > < identifier > |< identifier ' = ' constant expression >

< type qualifier >-< constants > |< volatile >

< type qualifier List > < type qualifier > |< type qualifier List type qualifier >

< parameter type list > < parameter list > |< parameter list ', ' ellipsis >

< parameter list > < declaration parameters > | < parameter list ', ' Declaration parameters >

< type name > < qualification description List characters > |< qualifier abstract Description List characters >

< abstract specifier > < pointer > |< direct abstract specifier > |< pointer direct abstract specifier >

< direct abstract specifier >-< ' (' abstract specifier ') ' >|  < ' ['] ' | ' [' constant expression '] ' >| < direct abstract specifier ' ['] ' > | < Direct abstract description < symbol ' [' constant expression '] ' > |  < ' (') ' | ' (' parameter Type list ') ' >|< direct abstract specifier ' (') ' > | < direct abstract specifier ' (' parameter Type list ') ' >

< labeled statements > < identifiers ': ' Statements > | <CASE constant expression ': ' Statement > | < default ': ' Statement >

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

Related Article

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.