[notes]
In this case, we use predicates that depend on global information
like we would do for a symbol table. We simply execute
the predicates assuming that all necessary information is available.
The i++ action is done outside of the prediction and so it is executed.

[type]
Parser

[grammar]
grammar T;
@parser::members {<InitIntMember("i","0")>}
s : ({<AddMember("i","1")>
<write("\"i=\"")>
<writeln(GetMember("i"))>} a)+ ;
a : {<ModMemberEquals("i","2","0")>}? ID {<writeln("\"alt 1\"")>}
  | {<ModMemberNotEquals("i","2","0")>}? ID {<writeln("\"alt 2\"")>}
  ;
ID : 'a'..'z'+ ;
INT : '0'..'9'+;
WS : (' '|'\n') -> skip ;

[start]
s

[input]
x x y

[output]
i=1
alt 2
i=2
alt 1
i=3
alt 2

