A.0 XPOZ Grammar

The following is the actual XPOZ grammar in PCCTS format with actions and token definitions removed. Its form is BNF-like and demonstrates the recursive-descent nature of the parser. Items in all uppercase represent the token to be matched. Other identifiers in lowercase or mixed case correspond to a rule elsewhere in the grammar. Groups of tokens/rules enclosed in >{}= represent optional components. Groups enclosed in >( )= followed by a >+= indicate >one or more= of those groups and a >*= following a group represents zero or more of the groups.

declaration:
  {PRIVATE} DATATYPE IDENTIFIER { arraynotation } { ASSIGN initialize }
  ( COMMA IDENTIFIER { arraynotation } { ASSIGN initialize } )* SEMICOLON ;
block:
  LBRACE { combo_list } RBRACE; 
combo:
  ( declaration | statement ); 
combo_list:
  ( combo )+ ; 
statement:
  ( expression SEMICOLON 
  | block 
  | IF LPAREN expression RPAREN combo { ELSE combo } 
  | WHILE LPARENexpression RPAREN combo
  | DO combo WHILE LPAREN expression RPAREN SEMICOLON 
  | FOR LPAREN {expression } SEMICOLON { expression } SEMICOLON { expression } RPAREN combo 
  | SWITCH expression 
    ยท LBRACE ( CASE expression COLON { combo_list } )* { DEFAULT COLON { combo_list } } RBRACE 
  | CONTINUE SEMICOLON 
  | BREAK SEMICOLON
  | RETURN { expression } SEMICOLON
  | EXIT SEMICOLON
  | SEMICOLON 
  ); 
expression:
  assignment_expression ( COMMA assignment_expression )* ; 
assignment_expression:
  logical_OR_expression { OPERAND assignment_expression }; 
logical_OR_expression:
  logical_AND_expression ( LOGICAL_OR logical_AND_expression )* ; 
logical_AND_expression:
  bitwise_OR_expression ( LOGICAL_AND bitwise_OR_expression )* ; 
bitwise_OR_expression:
  exclusive_OR_expression ( BITWISE_OR exclusive_OR_expression )* ;
exclusive_OR_expression:
  bitwise_AND_expression ( BITWISE_XOR bitwise_AND_expression )* ;
bitwise_AND_expresion:
  equality_expression ( BITWISE_AND equality_expression )* ; 
equality_expression:
  relational_expression ( EQUALITY relational_expression )* ; 
relational_expression:
  additive_expression ( RELATIONAL additive_expression )* ; 
additive_expression:
  multiplicative_expression ( ADDITIVE multiplicative_expression )* ; 
multiplicative_expression:
  unary_expression ( MULTIPLICITIVE unary_expression )* ; 
unary_expression:
  ( PLUS unary_expression 
  | MINUS unary_expression
  | NOT unary_expression 
  | INCREMENT unary_expression 
  | DECREMENT unary_expression
  | primary_expression ( INCREMENT | DECREMENT | //Nothing ) 
  ); 
primary_expression:
  ( LITERAL_STRING_DELIM
  | LITERAL_CHARACTER_DELIM
  | number 
  | identifier { LPAREN { argument_list } RPAREN }
  | LPAREN expression RPAREN
  | boolean 
  ); 
argument_list:
  argument ((COMMA argument)* | SEMICOLON ( argument SEMICOLON )* ) ; 
argument:
  IDENTIFIER ASSIGN initialize; 
identifier:
  IDENTIFIER { arraynotation }; 
initialize:
  ( element_set | assignment_expression ) ; 
element_set:
  LBRACE set_member ( COMMA set_member )* RBRACE;
set_member:
  ( element_set | logical_OR_expression ); 
number:
  ( OCT_NUM
  | HEX_NUM
  | INT_NUM
  | U_OCT_NUM 
  | U_INT_NUM 
  | U_HEX_NUM
  | L_OCT_NUM 
  | L_HEX_NUM
  | L_INT_NUM
  ) ; 
arraynotation:
  LBRACK ( assignment_expression ) RBRACK ; 
boolean:
  ( TRUETOKEN | FALSETOKEN ) ;
start:
  ( declaration | statement )* ( XPOZEOF | . );