C++ Program Grammar (Backus-Naur Notation)
<program> ::= <preprocessor> <program-body>
<preprocessor> ::= {"using" <namespace-definiton>";"}
<namespace-definiton> ::= <identifier> | <identifier>"."<namespace-definiton>
<program-body> ::= [<function>|<var-definitons>|<struct-statement>]{<program-body>}
<function> ::= <type> <identifier>"("[parameter-list]")" "{" {<statement>} "}"
<var-definition> ::= <type> (<identifier> | <identifier>"="<expression>)
<var-definitions> ::= <type> (<identifier> | <identifier>"="<expression>){"," <identifier> | <identifier>"="<expression>}";"
<type> ::= <const-type> | <default-type>
<default-type> ::= <identifier>
<const-type> ::= "const" <default-type>
<parameter-list> ::= <var-definition> {","<var-definition>}
<identifier> ::= (letter | "_" ) { letter | "_" | digit }
<letter> ::= "a" | "b" | ... | "z" | "A" | "B" | ... | "Z"
<digit> ::= "0" | "1" | ... | "9"
<statement> ::= "{"{<statement>}"}" | <var-definitions> | <expression-statement> | <if-statement> | <goto-statement>| <return-statement> | <while-statement>
| <for-statement> | <switch-statement>
<expression-statement> ::= <expression>";"
<if-statement> ::= "if("<expression>")" <statement> ["else" <statement>]
<goto-statement> ::= ("goto" <identifier> | "break" | "continue")";"
<return-statement> ::= "return" [<expression>]";"
<while-statement> ::= "while" "("<expression>")" (<statement> | ";")
<for-statement> ::= "for" "("[<expression>]";"[<expression>]";"[<expression>]")"<statement>
<switch-block> ::= "case" <expression>":"<statement>
<switch-statement> ::= "switch" "("<expression>"){"[<switch-block>]["default" ":"<statement>]"}"
<number> ::= ["+" | "-"]<digit>{<digit>}
<operand> ::= "("<expression>")" | <field> | <literal>
<field> ::= <identifier>{("."<identifier> | "["<expression>"]" | "("[<expression>{","<expression>}]")")}
<expression> ::= <assignment-expression>{"," <assignment-expression>}
<assignment-expression> ::= <logical-or-expression>{("=" | "+=" | "-=" | "*=" | "/=" | "%=" | ">>=" | "<<=" | "&=" | "^=" | "|=" | "->=" | "~=")<logical-or-expression>}
<logical-or-expression> ::= <logical-and-expression>{"||" <logical-and-expression>}
<logical-and-expression> ::= <bitwise-or-expression>{"&&" <bitwise-or-expression>}
<bitwise-or-expression> ::= <bitwise-xor-expression>{"|" <bitwise-xor-expression>}
<bitwise-xor-expression> ::= <bitwise-consequence-expression>{"^" <bitwise-consequence-expression>}
<bitwise-consequence-expression> ::= <bitwise-and-expression>{"->" <bitwise-and-expression>}
<bitwise-and-expression> ::= <equality-expression>{"&" <equality-expression>}
<equality-expression> ::= <comparison-expression>{("!=" | "==") <comparison-expression>}
<comparison-expression> ::= <bitwise-shift-expression>{(">" | ">=" | "<" | "<=") <bitwise-shift-expression>}
<bitwise-shift-expression> ::= <plus-expression>{(">>" | "<<") <plus-expression>}
<plus-expression> ::= <multiply-expression>{("+" | "-") <multiply-expression>}
<multiply-expression> ::= <unary-expression>{("*" | "/" | "%") <unary-expression>}
<unary-expression> ::= <construct-expression>{("+" | "-" | "!" | "~" | "++" | "--") <construct-expression>}
<construct-expression> ::= <identifier> | <literal> | <field> | "("<expression>")"
<double-literal> ::= <number>"."[<number>]".l"
<float-literal> ::= <number>"."[<number>][".f"]
<unsigned-long-long-literal> ::= <number>"UL"
<long-long-literal> ::= <number>"L"
<unsigned-int-literal> ::= <number>"U"
<int-literal> ::= <number>
<bool-literal> ::= "true" | "false"
<char-literal> ::= "'"<letter>"'"
<string-literal> ::= "\\""({<any-char>} | eps)"\\""
<literal> ::= <double-literal> | <float-literal> | <unsigned-long-long-literal> | <long-long-literal> | <unsigned-int-literal> | <int-literal> | <bool-literal> | <char-literal>
| <string-literal>
<end-of-line> ::= "\\n" | "\\r\\n"
<struct-statement> ::= "struct" <default-type> "{" <program-body> "}" ";"