Simple Grammar ( for example in C language)
program
<program> :
External_declaration// External declaration
| Body program// function body procedure
External Declarations
<external_declaration> :
Declaration external_declaration// header File declaration External Declaration
| Function_definition external_declaration// function declaration External Declaration
| Program//Programs
Header file declaration
<declaration>:
Symbol identifier Bracket identifier bracket declaration// symbol identifier sign header file symbol /c6> header File Declaration
|type_specifier variate '; ' Declaration// data type variable header file declaration
(global variables)
| Type_specifier variate ( type_specifier variate, Type_specifier variate , )Program data type variable (function name) parameter program (Declaration of a custom function)
function
<function_definition> :
Type_specifier declarator// type header file declaration
Compound_statement// Mixed statement
function Body
<body> :
Identifier Bracket Body//main
|type_specifier variate '; ' data type variables ;
|initializer// initialization ,
|statement// statements, statements
Initialize
<initializer> :
Variate Initializer// initialization of variables
| Symbol Initializer// sign initialization
|unction_definition// function (function call)
Data type
<type_specifier> :
Void
|char
|int
|float
|double
// identifier header file
<identifier> :
Include
| Define
|stdio.h
|math.h
|stdlib.h
|time.h
|string.h
|main ' (') '
statements, statements
<statement> :
Judge_statement// judgment
|jump_statement// Jump character
|iteration_statement// cycle
|selection_statement// Select
Judging
<Judge_statement> :
If Body
| Body
Loops
<iteration_statement>:
While Body
| For Body
| Do Body while
| Body
Jump Character
<jump_statement> :
Continue body
|break body
|return body
|return body
|body
symbols
<symbol > :
#
|+ Bracket
|= Bracket
|-Bracket
| : Bracket
| , Bracket
| ;
| empty string
brackets
<bracket> :
(Bracket
|) Bracket
| {Bracket
|} Bracket
|< Bracket
|> Bracket
| empty string
Pointers
<pointer > :
‘*‘
| ' * ' variate// variable
variables
<variate >:
A variate
|b variate
|c variate
|.....
|z variate
Digital
<figure>
0 Figure
|
Figure
......
Figure
Simple grammar (for example in C language)