Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
BNF 2.71 KB | None | 0 0
  1. program := definitions
  2. definitions := definition [definitions]
  3.  
  4. definition := type-definition
  5.            := variable-definition
  6.            := namespace-definition
  7.  
  8. type-definition := [const] [volatile] identifier [ '[' expression ']' ]
  9.                 := expression
  10.                 := type-literal
  11.                
  12. variable-definition := [variable-modifiers] identifier
  13.                     := [variable-modifiers] identifier function-call
  14.                     := [variable-modifiers] identifier '=' expression
  15.  
  16. namespace-definition := 'namespace' identifier '{' [definitions] '}'
  17.  
  18. function-definition := [type-definition] identifier function-arguments-list
  19.  
  20. function-arguments-list := function-arguments [function-arguments-list]
  21.  
  22. function-arguments := [type-definition] identifier
  23.  
  24. variable-modifiers := [static] [auto] [type-definition]
  25.  
  26. type-definition-list := type-definition [',' type-definition-list]
  27.  
  28. function-call := '(' [expression-list] ')' [function-call]
  29.  
  30. function-call-expression := expression function-call
  31.  
  32. identifier := [_\w][_\w\d]*
  33.  
  34. cast-expression := 'static_cast' function-call
  35.                 := 'dynamic_cast' function-call
  36.                 := 'reinterpret_cast' function-call
  37.                 := 'const_cast' function-call
  38.  
  39. arithmetic-expression := expression '*' expression
  40.                       := expression '+' expression
  41.                       := expression '/' expression
  42.                       := expression '-' expression
  43.                       := '+' expression
  44.                       := '-' expression
  45.  
  46. boolean-expression := expression '>' expression
  47.                    := expression '<' expression
  48.                    := expression '==' expression
  49.                    := expression '!=' expression
  50.                    := expression '<=' expression
  51.                    := expression '>=' expression
  52.  
  53. member-expression := expression '.' identifier
  54.                   := expression '->' identifier
  55.  
  56. type-literal := 'type' [':' type-definition-list] '{' [definitions] '}'
  57.  
  58. integral-literal := \d+
  59.                  := '0x' [\dA-F]+
  60.  
  61. floating-point-literal := \d+ '.' \d+
  62.  
  63. literal-expression := type-literal
  64.                    := integral-literal
  65.                    := floating-point-literal
  66.  
  67. access-expression := expression '[' expression ']'
  68.  
  69. assignment-expression := expression '=' expression;
  70.  
  71. expression-list := [expression [',' expression-list]]
  72.  
  73. expression := member-expression
  74.            := boolean-expression
  75.            := arithmetic-expression
  76.            := cast-expression
  77.            := function-call-expression
  78.            := access-expression
  79.            := assignment-expression
  80.            := type-definition
  81.            := identifier
  82.            := literal-expression
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement