Download presentation
Presentation is loading. Please wait.
Published byGeorgia Harper Modified over 8 years ago
1
C syntax (simplified) BNF
2
Program ::= [ ]
3
Directives ::= [ ] ::= | |… ::=#include > ::=#define
4
Functions ::= [ ] ::= ::= ::=
5
Functions ::= ([ ]) ::= [, ] ::= |
6
Statements ::= [ ] ::= ; | ::= |return |break |continue |goto
7
Statements ::= { [declarations][ ] }
8
Declarations ::= [ ] ::= ; | ; ::= [= ]>[, ] ::= = [ ] ::= [ ] [[ ]…][={,…}]
9
Data types ::= [unsigned] [short|long] int | char | float | double
10
Identifiers ::= [ ] ::=_|A|B|…|z = [ ] = |
11
Expressions ::= | |& |…
12
Expressions |( ) | | | | ::= ? :
13
Arithmetic expressions ::= | ::=+|- ::=+|-|*|/|%
14
Relational Expression ::= ::= | =|==|!= ::= ! | && | ||
15
Assignments ::= ::= | [ ]… ::= =|+=|-=|*=|/=|%=
16
Increment/Decrement ::= | ::=++ ::= | ::=--
17
Decision Statements ::= | ::= if ( ) [else ]
18
Switch statement ::= switch ( ) { case : … [default: statements] }
19
Loop statements ::= while ( ) |do while (expression) |for ( ; ; )
20
Function calls ::= ::= ([ ]) :: = [, ]
21
Constants ::= | ::=[-]digits[.digits] ::= [ ] ::=0|1|…|9 ::=“ ” ::= ::=A|B|…|z|0|…|9|(|)|!| |.|*|…
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.