Advertisement
Guest User

Expression grammar

a guest
Jul 12th, 2011
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. expr := comma_expr
  2.  
  3. comma_expr := (comma_expr ',')? assignment_expr
  4.  
  5. assignment_expr := conditional_expr (('=' | '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=') assignment_expr)?
  6.  
  7. conditional_expr := logical_or_expr ('?' logical_or_expr ':' conditional_expr)?
  8.  
  9. logical_or_expr := (logical_or_expr '||')? logical_and_expr
  10.  
  11. logical_and_expr := (logical_and_expr '&&')? bitwise_or_expr
  12.  
  13. bitwise_or_expr := (bitwise_or_expr '|')? bitwise_xor_expr
  14.  
  15. bitwise_xor_expr := (bitwise_xor_expr '^')? bitwise_and_expr
  16.  
  17. bitwise_and_expr := (bitwise_and_expr '&')? equality_expr
  18.  
  19. equality_expr := (equality_expr ('==' | '!='))? comparison_expr
  20.  
  21. comparison_expr := (comparison_expr ('<' | '<=' | '>' | '>='))? bitwise_shift_expr
  22.  
  23. bitwise_shift_expr := (bitwise_shift_expr ('<<' | '>>'))? additive_expr
  24.  
  25. additive_expr := (additive_expr ('+' | '-'))? multiplicative_expr
  26.  
  27. multiplicative_expr := (multiplicative_expr ('*' | '/' | '%'))? unary_expr
  28.  
  29. unary_expr := ('!' | '~' | '-' | '+' | '*' | '&' | 'sizeof' | '++' | '--' )? basic_expr
  30.  
  31. basic_expr := numbers_and_shit
  32. := '(' expr ')'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement