< source functions >→< external declarations > | < source programs > < external declarations >
< procedures >-〉< External declarations > | < function definition >
< external declarations >-〉< header Files > | < variables > | < structural body >
< header file >-〉 #include < file name >
< filename >-〉stdio.h 丨 stdlib.h 丨 string.h
< struct >-〉< struct declaration 〉|< struct Member list >
< struct declarations >-〉struct< structure names >
< struct member List >-〉< variables >
< struct name >-〉< identifier >
< function definition >-〉< type description >< function name >< parameter list >< Compound statement >
< function names >-〉< identifiers >
< parameter list 〉-〉< type description >< variable name >
< compound statements >-〉< variables >|< statements >
< statements >-〉< expression statements 〉|< SELECT statements >|< loop statements >|< jump statements >
< expression statements >-〉< assignment expressions >|< relational Expressions >|< Logical Expressions >
< Assignment expression >-〉= | += | =+ | -= | =-
< relationship expression >->〉| < | 〉=| <=
< Logical Expressions >-〉+ | - | * | /
< SELECT statement >-〉if Else Statement | Switch statement
< loop statement >-〉for statement |while statement |do while statement
< SKIP statement >-> return statement |break statement |continue statement
< variables >-> < types > 丨 < variable names > 丨 < variable values >
< type description >-> int 丨 char 丨 double 丨 float 丨 long
< variable name > <==> S
S-> a| SB
A-> a|b|c|......y|z
B-> 0|1|2|3|4|5|6|7|8| 9
< variable values >-> < letters > 丨 numbers
< identifier >〈==〉s
S-> a|b|c|......y|z| S
< letters >-> A|b|c|......y|z
< digital >〈==〉s
A-> 1|2|3|4|5|6|7|8| 9
S-> a|sa| SA0
Simple C language Grammar