feroldi / cci

DEPRECATED PROJECT, see README
MIT License
37 stars 5 forks source link

statement #14

Closed feroldi closed 7 years ago

feroldi commented 7 years ago
statement:
  labeled-statement
  compound-statement
  expression-statement
  selection-statement
  iteration-statement
  jump-statement
  // missing `asm` statement

labeled-statement:
  identifier ':' statement
  'case' constant-expression ':' statement
  'default' ':' statement

compound-statement:
  '{' block-item-list? '}'

block-item-list:
  block-item
  block-item-list block-item

block-item:
  declaration
  statement

expression-statement:
  expression? ';'

selection-statement:
  'if' '(' expression ')' statement ('else' statement)?
  'switch' '(' expression ')' statement

iteration-statement:
  'while' '(' expression ')' statement
  'do' statement 'while' '(' expression ')' ';'
  'for' '(' expression? ';' expression? ';' expression? ')' statement
  'for' '(' declaration expression? ';' expression? ')' statement

jump-statement:
  'goto' identifier ';'
  'continue' ';'
  'break' ';'
  'return' expression? ';'