syntax.txt: initial
This commit is contained in:
parent
4dd67c7204
commit
8722f30eb6
133
syntax.txt
Normal file
133
syntax.txt
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
identifier:
|
||||||
|
identifier-start
|
||||||
|
identifier identifier-continue
|
||||||
|
|
||||||
|
identifier-start:
|
||||||
|
nondigit
|
||||||
|
|
||||||
|
identifier-contine:
|
||||||
|
digit
|
||||||
|
nondigit
|
||||||
|
|
||||||
|
primary-expression:
|
||||||
|
identifier
|
||||||
|
constant
|
||||||
|
"(" expression ")"
|
||||||
|
|
||||||
|
postfix-expression:
|
||||||
|
primary-expression
|
||||||
|
postfix-expression "[" expression "]"
|
||||||
|
postfix-expression "(" argument-expression-list? ")"
|
||||||
|
postfix-expression "<" for-expression ">"
|
||||||
|
postfix-expression "." identifier
|
||||||
|
|
||||||
|
for-expression:
|
||||||
|
primary-expression
|
||||||
|
primary-expression "FOR" primary-expression
|
||||||
|
|
||||||
|
argument-expression-list:
|
||||||
|
assignment-expression
|
||||||
|
argument-expression-list "," assignment-expression
|
||||||
|
|
||||||
|
unary-expression:
|
||||||
|
postfix-expression
|
||||||
|
"NOT" unary-expression
|
||||||
|
"INT" unary-expression
|
||||||
|
"~" unary-expression # bitwise complement
|
||||||
|
"-" unary-expression # integer negation
|
||||||
|
"|" unary-expression "|" # integer absolute value
|
||||||
|
|
||||||
|
multiplicative-expression:
|
||||||
|
unary-expression
|
||||||
|
multiplicative-expression "×" unary-expression
|
||||||
|
multiplicative-expression "/" unary-expression
|
||||||
|
|
||||||
|
additive-expression:
|
||||||
|
multiplicative-expression
|
||||||
|
additive-expression "+" multiplicative-expression
|
||||||
|
additive-expression "-" multiplicative-expression
|
||||||
|
|
||||||
|
shift-expression:
|
||||||
|
additive-expression
|
||||||
|
shift-expression "<<" additive-expression
|
||||||
|
shift-expression ">>" additive-expression
|
||||||
|
|
||||||
|
relational-expression:
|
||||||
|
shift-expression
|
||||||
|
relational-expression "<" shift-expression
|
||||||
|
relational-expression ">" shift-expression
|
||||||
|
relational-expression "≤" shift-expression
|
||||||
|
relational-expression "≥" shift-expression
|
||||||
|
|
||||||
|
equality-expression:
|
||||||
|
relational-expression
|
||||||
|
equality-expression "=" relational-expression
|
||||||
|
equality-expression "≠" relational-expression
|
||||||
|
|
||||||
|
bitwise-AND-expression:
|
||||||
|
equality-expression
|
||||||
|
bitwise-AND-expression "∧" equality-expression
|
||||||
|
|
||||||
|
bitwise-XOR-expression:
|
||||||
|
bitwise-AND-expression
|
||||||
|
bitwise-XOR-expression "⊕" bitwise-AND-expression
|
||||||
|
|
||||||
|
bitwise-OR-expression:
|
||||||
|
bitwise-XOR-expression
|
||||||
|
bitwise-OR-expression "∨" bitwise-XOR-expression
|
||||||
|
|
||||||
|
logical-AND-expression:
|
||||||
|
bitwise-OR-expression
|
||||||
|
logical-AND-expression "AND" bitwise-OR-expression
|
||||||
|
|
||||||
|
logical-XOR-expression:
|
||||||
|
logical-AND-expression
|
||||||
|
logical-XOR-expression "XOR" logical-AND-expression
|
||||||
|
|
||||||
|
logical-OR-expression:
|
||||||
|
logical-XOR-expression
|
||||||
|
logical-OR-expression "OR" logical-XOR-expression
|
||||||
|
|
||||||
|
assignment-expression:
|
||||||
|
logical-OR-expression
|
||||||
|
unary-expression "←" assignment-expression
|
||||||
|
|
||||||
|
expression:
|
||||||
|
assignment-expression
|
||||||
|
|
||||||
|
# statement
|
||||||
|
|
||||||
|
statement:
|
||||||
|
unlabeled-statement
|
||||||
|
|
||||||
|
unlabeled-statement:
|
||||||
|
expression-statement
|
||||||
|
primary-block
|
||||||
|
|
||||||
|
primary-block:
|
||||||
|
compound-statement
|
||||||
|
selection-statement
|
||||||
|
throw-statement
|
||||||
|
|
||||||
|
secondary-block:
|
||||||
|
statement
|
||||||
|
|
||||||
|
compound-statement:
|
||||||
|
"{" block-item-list? "}"
|
||||||
|
|
||||||
|
block-item-list:
|
||||||
|
block-item
|
||||||
|
block-item-list block-item
|
||||||
|
|
||||||
|
block-item:
|
||||||
|
unlabeled-statement
|
||||||
|
|
||||||
|
expression-statement:
|
||||||
|
expression ";"
|
||||||
|
|
||||||
|
selection-statement:
|
||||||
|
"IF" "(" expression ")" secondary-block
|
||||||
|
"IF" "(" expression ")" secondary-block "ELSE" secondary-block
|
||||||
|
|
||||||
|
throw-statement:
|
||||||
|
"THROW" secondary-block
|
Loading…
x
Reference in New Issue
Block a user