Simple C language Grammar

Source: Internet
Author: User
Tags logical operators

< source programs >→< external declarations >|< external declarations >< function bodies >

< external declaration >→< header File >< function declaration >| Other declarations

< function body >→< return value type >< identifier >< formal parameter >< compound statement >

< return value type >→void|char|int|float

< identifiers >→< Letters >|< identifiers >< letters >|< identifiers >< numbers >

< letter >→a|b|c|...| y| |

< digital >→0|1|2|3|4|5|6|7|8| 9

< parameters >→< Data types > < identifiers >

< compound statement >→{}| {< statement list;}

< statement list >→< Compound statement >|< statement list >

< compound statement >→< Assignment Statement >|< conditional statement >|< Loop Statement >

< Assignment statements >→< identifiers >=< expressions >

< expression >→ expression + T | expression –t| T

T→f*f| T/f| F

f→ expression |i

< conditional statement >→s1| S2

<s1>→if < judgment Statement ><{conditional statement}> Else <{conditional statement}>

<s2>→if < judgment Statement ><{conditional statement}>| If < judge ><{Conditional statement}> S1

< judgment statements >→< identifiers >< logical operators >< identifiers | numbers >

< logical operator >→>|<|=|!| >=|<=

< loop statement >→<for statement >|<while statement >|<do while statement >

<for Statement >→for (Assignment statement; Judgment statement; < identifier ><D>) {statement list}

d→++|--

<while Statement >→while (judgment statement) {statement list}

<do While Statement >→do{statement list}while (judgment statement)

Simple C language Grammar

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.