C Language Grammar

Source: Internet
Author: User
Tags function definition

Program-< External Declaration >|< Program External Declaration >
External declarations-< function definitions >|< definitions >
function definition-< type identifier > < declaration partial statement >
< identifier type >-< no type >|< character >|< integer >|< floating-point >
< declaration >-< Pointer Direct declaration > | < Direct declaration >
< pointer >-' * ' |<* hands >
< direct declarations >→< Identifiers > | < direct statement []> | < direct declaration [constant-expression]> | < identifiers (parameter list) > | < identifiers () > | < direct declaration, List of identifiers >
< 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}>|<{< declaration list > < statement list >}>
< declarations list >→< declarations > | < statement list > < disclaimer >
< declarations >→< initialization declarations > | < Initialize declaration list, initialize declaration >
< initialization declarations >→< Declarations > | < declaration = Initialization Program >
< initialization programs >→< Expressions > | List of <{initialization Programs}> | <{List of initialization programs,}>
< initialization program List >→< initialization Program > | < initialization program list, initialization program >
< statement list >→< Statement > | < statement list > < statements >
< statements > | < compound statements > | < expression statements > | < SELECT statement > | < looping statements > |< jump statements >
< expression statements >→< expressions;>
< SELECT statement >: < IF (expression) Statement > | < IF (expression) statements > < ELSE statements >
< loop statement >→< while (expression) Statement > | < for (expression statement expression statement) Statement > | < for (expression statement expression Statement expression) Statement >
< jump statements > | <continue;> |<breack;> | <return;> | <return expression; >
< Assignment expressions >→< conditional Expressions > | < unary expression > < assignment operator > < assignment expression >
< conditional expression >→< logical ' or ' Expression > | < logical ' or ' expression? > < Expressions:> < conditional expressions >
< logic ' or ' Expressions >→< logic ' and ' Expressions > | < logic ' or ' Expressions > < ' or ' operations > < logic ' and ' Expressions >
< logic ' and ' Expressions >→< logic ' or ' Expressions > | < logic ' and ' Expressions > < ' and ' operations > < logic ' or ' Expressions >
< or op-expressions >→< xor Expressions > | < or op-expression ' | ' XOR expression >
< XOR expressions >: < and expressions > | < XOR expression ^ with expression >
< expressions >: < equality expressions > | < Expressions & Equality Expressions >
< equality expressions >: < relationship expressions > | < equality expressions > < equals operations > < relational expressions > | < equality expressions > < non-equals operations > < relational expressions >

< relationship expressions >: < substitution expressions > | < relationship expressions < substitution expressions > | < relationship expressions > substitution Expressions > | < relationship expression <= substitution expression > | < relationship expression >= substitution expression >

< replace expression >: < addition expression > | < replace expression > < left operation > < addition expression > | < replace expression > < right operation > < addition expression >

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

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

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

< unary expression >: < suffix expression > | < add an operation > < unary expression > | < subtract one operation > < unary expression > | < unary operators > < cast expressions > | < struct variables > < unary expressions > | < struct variable (type name) >

< suffix expressions >→: < basic expressions > | < postfix expressions [Expression]> | < suffix expression () > | < suffix expression (parameter expression list) > | < suffix expression. Identifiers > | < postfix expressions > < pointer operations > < identifiers > | < Postfix expressions > < add an operation > | < Postfix expressions > < subtract one operation >

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

< parameter expression list >: < parameter expression > | < parameter expressions list, parameter expressions >

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

< Assignment operators >→<=> | < multiplication Assignment > | < Division Assignment > | < redundancy Assignment > | < addition Assignment > | < subtraction Assignment > | < left Assignment > | < right Assignment > | < and Assignment > | < XOR Assignment > | < or Assignment >

< storage class Descriptor >→<typedef (definition type) > | <extern (external variables) > | <static (static) > | <auto (automatic) > | <register (Register) >

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

< struct or common body >: < structure > | < Community >

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

< struct declaration >: < specifier qualifier list > < struct declaration list;>

< descriptor qualifier List >→< type specifier > < descriptor qualifier List > | < type specifiers > | < type qualifier > < specifier qualifier list > | < type qualifier >

< structure description list characters >→< structure specifier > | < structure description list characters, structure specifier >

< structure specifier >→: < specifier > | <: constant expression > | < descriptors: constant expressions >

< enumeration specifier >→< Enumeration {Enumerator List}> | < enumeration identifier {Enumerator List}> | < enumeration identifiers >

< enumerator list >→< Enumerator > | < enumerator list, enumerator >

< enumerators >→< identifiers > | < identifier = constant expression >

< type qualifiers >→< Constants > | < variables >

< type qualifier list >→< type qualifier > | < type qualifier List > < type qualifier >

< parameter type list >→< parameter list > | < parameter type list, omit >

< parameter list >→: < parameter description > | < parameter list, parameter description >

< type name >→< Descriptor Qualifier List > | < descriptor qualifier List > < abstract specifier >

< abstract specifiers >→< pointers > | < direct abstract specifiers > | < pointers > < direct abstract specifiers >

< direct abstract specifier >→< (abstract specifier) > | <[]> | <[constant-expression]> | < direct abstraction specifier []> | < direct abstract specifier [constant-expression]> | < () > | < (List of parameter types) > | < direct abstract specifier () > | < direct abstract specifier (parameter type list) >

< tag statements >→< identifiers: Statements > | <case> < constant expressions: statements > | <default> < statements >

C Language Grammar

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.