Difference between revisions of "Language Grammar"

From ABL
Jump to: navigation, search
 
m (ABL Language Grammar moved to Language Grammar: No abl prefix.)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
{| border="0"
+
== Introduction ==
| ''Annotation'' ::=
+
The following grammar is generated by [https://javacc.dev.java.net/doc/JJDoc.html JJDoc] and a [[wikify-grammar | custom elisp script]].
| <code>success_test</code>
+
 
|-
+
Any productions referred to but not defined are part of the Java grammar itself, and are mostly self-explanatory.
| align="right" | |
+
 
| <code>priority</code>
+
== Grammar ==
|-
+
<TABLE>
| align="right" | |
+
<TR>
| <code>persistent</code> ''PersistentModifier''
+
<TD ALIGN=RIGHT VALIGN=BASELINE>BehaviorUnit</TD>
|-
+
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
| align="right" | |
+
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>"package"</code> Name <code>";"</code> )? ( ( ImportDeclaration ) | ( ConstantDeclaration ) )* <code>&lt;BEHAVING_ENTITY&gt;</code> AblName <code>&lt;LBRACE&gt;</code> ( TeamNeededForSuccessDefaultDeclaration )? ( DecisionCycleSMCallDeclaration )? ( ConflictDeclaration )* ( AblDeclaration )* ( BehaviorDefinition )* ( InitialTree )* <code>&lt;RBRACE&gt;</code> <code>&lt;EOF&gt;</code></TD>
| <code>effect_only</code><br/>
+
</TR>
|-
+
<TR>
| align="right" | |
+
<TD ALIGN=RIGHT VALIGN=BASELINE>ConstantDeclaration</TD>
| <code>team_effect_only</code><br/>
+
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
|-
+
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;CONSTANTS&gt;</code> Name ( <code>"."</code> <code>"*"</code> )? <code>";"</code></TD>
| align="right" | |
+
</TR>
| <code>ignore_failure</code><br/>
+
<TR>
|-
+
<TD ALIGN=RIGHT VALIGN=BASELINE>ConflictDeclaration</TD>
| align="right" | |
+
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
| <code>priority</code> ''Nat''
+
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;CONFLICT&gt;</code> AblName ( AblName )+ <code>&lt;SEMICOLON&gt;</code></TD>
|-
+
</TR>
| align="right" | |
+
<TR>
| <code>priority_modifier</code> ''Int''
+
<TD ALIGN=RIGHT VALIGN=BASELINE>PropertyDeclaration</TD>
|}
+
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;PROPERTY&gt;</code> Type AblName <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>AblDeclaration</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( AblVariableDeclaration <code>&lt;SEMICOLON&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>WMERegistration</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>ActionRegistration</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>WMEDeclaration</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>PropertyDeclaration</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>WMERegistration</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;REGISTER&gt;</code> <code>&lt;WME&gt;</code> WMEClass <code>&lt;WITH&gt;</code> Name <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>ActionRegistration</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;REGISTER&gt;</code> <code>&lt;ACTION&gt;</code> AblName <code>&lt;LPAREN&gt;</code> ( AblSimpleType ( <code>&lt;COMMA&gt;</code> AblSimpleType )* )? <code>&lt;RPAREN&gt;</code> <code>&lt;WITH&gt;</code> Name <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>BehaviorDefinition</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( BehaviorTypeModifier )* BehaviorType <code>&lt;BEHAVIOR&gt;</code> AblName <code>&lt;LPAREN&gt;</code> ( AblSimpleType AblSimpleType ( <code>&lt;COMMA&gt;</code> AblSimpleType AblSimpleType )* )? <code>&lt;RPAREN&gt;</code> <code>&lt;LBRACE&gt;</code> ( BehaviorModifiers )* ( AblVariableDeclaration <code>&lt;SEMICOLON&gt;</code> )* ( BehaviorStep )* <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>BehaviorModifiers</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( Precondition | Specificity | ContextCondition | EntryCondition | NumberNeededForSuccess | TeamMemberSpecifier | SuccessCondition | ReinforcementSignals | ReinforcementState )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>Specificity</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;SPECIFICITY&gt;</code> <code>&lt;INTEGER_LITERAL&gt;</code> <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>NumberNeededForSuccess</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;NUMBER_NEEDED_FOR_SUCCESS&gt;</code> <code>&lt;INTEGER_LITERAL&gt;</code> <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>TeamMemberSpecifier</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;TEAMMEMBERS&gt;</code> ( <code>&lt;IDENTIFIER&gt;</code> )+ <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>InitialTree</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;INITIAL_TREE&gt;</code> <code>&lt;LBRACE&gt;</code> ( BehaviorStep )* <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>BehaviorType</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;SEQUENTIAL&gt;</code> | <code>&lt;PARALLEL&gt;</code> | <code>&lt;COLLECTION&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>BehaviorTypeModifier</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;ATOMIC&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;JOINT&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;ADAPTIVE&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>Precondition</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;PRECONDITION&gt;</code> <code>&lt;LBRACE&gt;</code> TestExpression <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>TestExpression</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;IDENTIFIER&gt;</code> )? ( WMETestSequence )+</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>DefaultMemoryLookahead</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;IDENTIFIER&gt;</code> WMETestSequence</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>WMETestSequence</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;LBRACE&gt;</code> <code>&lt;IDENTIFIER&gt;</code> ( WMETest | <code>&lt;LPAREN&gt;</code> ConditionalExpression <code>&lt;RPAREN&gt;</code> )+ <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( WMETest | <code>&lt;LPAREN&gt;</code> ConditionalExpression <code>&lt;RPAREN&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>WMETest</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;BANG&gt;</code> )? ( Name <code>&lt;ASSIGN&gt;</code> )? <code>&lt;LPAREN&gt;</code> WMEClass ( WMEFieldTest )* <code>&lt;RPAREN&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>WMEClass</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>AblName</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>WMEFieldTest</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;IDENTIFIER&gt;</code> ( <code>&lt;V_BIND&gt;</code> | <code>&lt;GT&gt;</code> | <code>&lt;LT&gt;</code> | <code>&lt;EQ&gt;</code> | <code>&lt;LE&gt;</code> | <code>&lt;GE&gt;</code> | <code>&lt;NE&gt;</code> ) AblExpression</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>AblLiteral</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;INTEGER_LITERAL&gt;</code> | <code>&lt;FLOATING_POINT_LITERAL&gt;</code> | <code>&lt;DOUBLE_LITERAL&gt;</code> | <code>&lt;CHARACTER_LITERAL&gt;</code> | <code>&lt;STRING_LITERAL&gt;</code> | BooleanLiteral | NullLiteral )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>AblExpression</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( Name | AblLiteral )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>ContextCondition</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;CONTEXT_CONDITION&gt;</code> <code>&lt;LBRACE&gt;</code> TestExpression <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>EntryCondition</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;ENTRY_CONDITION&gt;</code> <code>&lt;LBRACE&gt;</code> TestExpression <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>SuccessCondition</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;SUCCESS_CONDITION&gt;</code> <code>&lt;LBRACE&gt;</code> TestExpression <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>ReinforcementSignals</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;R_SIGNAL&gt;</code> <code>&lt;LBRACE&gt;</code> ( ReinforcementSignal )* <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>ReinforcementSignal</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>AblExpression <code>&lt;IF&gt;</code> <code>&lt;LBRACE&gt;</code> TestExpression <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>ReinforcementState</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;STATE&gt;</code> <code>&lt;LBRACE&gt;</code> StateCondition ( ( AblVariableDeclaration <code>&lt;SEMICOLON&gt;</code> ) | ( Statement ) )* StateReturn <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>StateCondition</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;LBRACE&gt;</code> TestExpression <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>StateReturn</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;STATE&gt;</code> <code>&lt;RETURN&gt;</code> <code>&lt;LPAREN&gt;</code> AblExpression ( <code>&lt;COMMA&gt;</code> AblExpression )* <code>&lt;RPAREN&gt;</code> <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>BehaviorStep</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;WITH&gt;</code> <code>&lt;LPAREN&gt;</code> StepModifier ( <code>&lt;COMMA&gt;</code> StepModifier )* <code>&lt;RPAREN&gt;</code> )? ModifiableStep</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>FailStep</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>SucceedStep</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>ModifiableStep</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>PrimitiveActStep</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>MentalActStep</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>GoalStep</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>ModifyStep</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>AnonymousStep</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>WaitStep</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>PrimitiveActStep</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>PrimitiveAct</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>MentalActStep</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>MentalAct</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>GoalStep</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>Goal</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>WaitStep</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>Wait</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>AnonymousStep</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>AnonymousBlock</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>ModifyStep</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( ( <code>&lt;MOVE_STEP&gt;</code> Name <code>&lt;INTEGER_LITERAL&gt;</code> Name <code>&lt;INTEGER_LITERAL&gt;</code> Name Name <code>&lt;SEMICOLON&gt;</code> ) | ( <code>&lt;DELETE_STEP&gt;</code> Name <code>&lt;INTEGER_LITERAL&gt;</code> Name Name <code>&lt;SEMICOLON&gt;</code> ) | ( <code>&lt;ADD_STEP&gt;</code> Name <code>&lt;INTEGER_LITERAL&gt;</code> Name Name BehaviorStep ) )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>FailStep</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;FAIL&gt;</code> <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>SucceedStep</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;SUCCEED&gt;</code> <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>AnonymousBlock</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>BehaviorType <code>&lt;LBRACE&gt;</code> ( AblVariableDeclaration <code>&lt;SEMICOLON&gt;</code> )* ( BehaviorStep )+ <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>StepModifier</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>SuccessTest</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>PriorityModifier</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;IGNORE_FAILURE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>Persistence</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;EFFECT_ONLY&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;TEAM_EFFECT_ONLY&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>NamedProperty</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;POST&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;POST_TO&gt;</code> <code>&lt;IDENTIFIER&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;ONE_NEEDED_FOR_SUCCESS&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;TEAM_NEEDED_FOR_SUCCESS&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>SuccessTest</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;SUCCESS_TEST&gt;</code> <code>&lt;LBRACE&gt;</code> TestExpression <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>PriorityModifier</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;PRIORITY_MODIFIER&gt;</code> <code>&lt;INTEGER_LITERAL&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;PRIORITY&gt;</code> <code>&lt;INTEGER_LITERAL&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>Persistence</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;PERSISTENT&gt;</code> PersistenceType )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE></TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>|</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;PERSISTENT&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>NamedProperty</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;PROPERTY&gt;</code> AblName AblExpression</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>PersistenceType</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;WHEN_FAILS&gt;</code> | <code>&lt;WHEN_SUCCEEDS&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>PrimitiveAct</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;ACT&gt;</code> AblName <code>&lt;LPAREN&gt;</code> ( AblExpression ( <code>&lt;COMMA&gt;</code> AblExpression )* )? <code>&lt;RPAREN&gt;</code> <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>MentalAct</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;MENTAL_ACT&gt;</code> <code>&lt;LBRACE&gt;</code> ( ( AblVariableDeclaration <code>&lt;SEMICOLON&gt;</code> ) | ( Statement ) )* <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>Goal</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( <code>&lt;JOINT&gt;</code> )? ( <code>&lt;SUBGOAL&gt;</code> | <code>&lt;SPAWNGOAL&gt;</code> ) AblName <code>&lt;LPAREN&gt;</code> ( AblExpression ( <code>&lt;COMMA&gt;</code> AblExpression )* )? <code>&lt;RPAREN&gt;</code> ( <code>&lt;AT&gt;</code> Name )? <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>Wait</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;WAIT&gt;</code> <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>AblVariableDeclaration</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>Type VariableDeclarator ( <code>","</code> VariableDeclarator )*</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>AblSimpleType</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE>( PrimitiveType | <code>&lt;IDENTIFIER&gt;</code> )</TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>AblName</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;IDENTIFIER&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>WMEDeclaration</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;WME&gt;</code> AblName ( <code>&lt;EXTENDS&gt;</code> AblName )? <code>&lt;LBRACE&gt;</code> ( AblVariableDeclaration <code>&lt;SEMICOLON&gt;</code> )* <code>&lt;RBRACE&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>TeamNeededForSuccessDefaultDeclaration</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;JOINT_GOAL_SUCCESS_NEGOTIATION&gt;</code> ( <code>&lt;TEAM_NEEDED_FOR_SUCCESS&gt;</code> | <code>&lt;ONE_NEEDED_FOR_SUCCESS&gt;</code> ) <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
<TR>
 +
<TD ALIGN=RIGHT VALIGN=BASELINE>DecisionCycleSMCallDeclaration</TD>
 +
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
 +
<TD ALIGN=LEFT VALIGN=BASELINE><code>&lt;DECISION_CYCLE_SM_CALL&gt;</code> Name <code>&lt;SEMICOLON&gt;</code></TD>
 +
</TR>
 +
</TABLE>

Latest revision as of 12:52, 31 July 2006

Introduction

The following grammar is generated by JJDoc and a custom elisp script.

Any productions referred to but not defined are part of the Java grammar itself, and are mostly self-explanatory.

Grammar

BehaviorUnit ::= ( "package" Name ";" )? ( ( ImportDeclaration ) | ( ConstantDeclaration ) )* <BEHAVING_ENTITY> AblName <LBRACE> ( TeamNeededForSuccessDefaultDeclaration )? ( DecisionCycleSMCallDeclaration )? ( ConflictDeclaration )* ( AblDeclaration )* ( BehaviorDefinition )* ( InitialTree )* <RBRACE> <EOF>
ConstantDeclaration ::= <CONSTANTS> Name ( "." "*" )? ";"
ConflictDeclaration ::= <CONFLICT> AblName ( AblName )+ <SEMICOLON>
PropertyDeclaration ::= <PROPERTY> Type AblName <SEMICOLON>
AblDeclaration ::= ( AblVariableDeclaration <SEMICOLON> )
| WMERegistration
| ActionRegistration
| WMEDeclaration
| PropertyDeclaration
WMERegistration ::= <REGISTER> <WME> WMEClass <WITH> Name <SEMICOLON>
ActionRegistration ::= <REGISTER> <ACTION> AblName <LPAREN> ( AblSimpleType ( <COMMA> AblSimpleType )* )? <RPAREN> <WITH> Name <SEMICOLON>
BehaviorDefinition ::= ( BehaviorTypeModifier )* BehaviorType <BEHAVIOR> AblName <LPAREN> ( AblSimpleType AblSimpleType ( <COMMA> AblSimpleType AblSimpleType )* )? <RPAREN> <LBRACE> ( BehaviorModifiers )* ( AblVariableDeclaration <SEMICOLON> )* ( BehaviorStep )* <RBRACE>
BehaviorModifiers ::= ( Precondition | Specificity | ContextCondition | EntryCondition | NumberNeededForSuccess | TeamMemberSpecifier | SuccessCondition | ReinforcementSignals | ReinforcementState )
Specificity ::= <SPECIFICITY> <INTEGER_LITERAL> <SEMICOLON>
NumberNeededForSuccess ::= <NUMBER_NEEDED_FOR_SUCCESS> <INTEGER_LITERAL> <SEMICOLON>
TeamMemberSpecifier ::= <TEAMMEMBERS> ( <IDENTIFIER> )+ <SEMICOLON>
InitialTree ::= <INITIAL_TREE> <LBRACE> ( BehaviorStep )* <RBRACE>
BehaviorType ::= ( <SEQUENTIAL> | <PARALLEL> | <COLLECTION> )
BehaviorTypeModifier ::= ( <ATOMIC> )
| ( <JOINT> )
| ( <ADAPTIVE> )
Precondition ::= <PRECONDITION> <LBRACE> TestExpression <RBRACE>
TestExpression ::= ( <IDENTIFIER> )? ( WMETestSequence )+
DefaultMemoryLookahead ::= <IDENTIFIER> WMETestSequence
WMETestSequence ::= <LBRACE> <IDENTIFIER> ( WMETest | <LPAREN> ConditionalExpression <RPAREN> )+ <RBRACE>
| ( WMETest | <LPAREN> ConditionalExpression <RPAREN> )
WMETest ::= ( <BANG> )? ( Name <ASSIGN> )? <LPAREN> WMEClass ( WMEFieldTest )* <RPAREN>
WMEClass ::= AblName
WMEFieldTest ::= <IDENTIFIER> ( <V_BIND> | <GT> | <LT> | <EQ> | <LE> | <GE> | <NE> ) AblExpression
AblLiteral ::= ( <INTEGER_LITERAL> | <FLOATING_POINT_LITERAL> | <DOUBLE_LITERAL> | <CHARACTER_LITERAL> | <STRING_LITERAL> | BooleanLiteral | NullLiteral )
AblExpression ::= ( Name | AblLiteral )
ContextCondition ::= <CONTEXT_CONDITION> <LBRACE> TestExpression <RBRACE>
EntryCondition ::= <ENTRY_CONDITION> <LBRACE> TestExpression <RBRACE>
SuccessCondition ::= <SUCCESS_CONDITION> <LBRACE> TestExpression <RBRACE>
ReinforcementSignals ::= <R_SIGNAL> <LBRACE> ( ReinforcementSignal )* <RBRACE>
ReinforcementSignal ::= AblExpression <IF> <LBRACE> TestExpression <RBRACE>
ReinforcementState ::= <STATE> <LBRACE> StateCondition ( ( AblVariableDeclaration <SEMICOLON> ) | ( Statement ) )* StateReturn <RBRACE>
StateCondition ::= <LBRACE> TestExpression <RBRACE>
StateReturn ::= <STATE> <RETURN> <LPAREN> AblExpression ( <COMMA> AblExpression )* <RPAREN> <SEMICOLON>
BehaviorStep ::= ( <WITH> <LPAREN> StepModifier ( <COMMA> StepModifier )* <RPAREN> )? ModifiableStep
| FailStep
| SucceedStep
ModifiableStep ::= PrimitiveActStep
| MentalActStep
| GoalStep
| ModifyStep
| AnonymousStep
| WaitStep
PrimitiveActStep ::= PrimitiveAct
MentalActStep ::= MentalAct
GoalStep ::= Goal
WaitStep ::= Wait
AnonymousStep ::= AnonymousBlock
ModifyStep ::= ( ( <MOVE_STEP> Name <INTEGER_LITERAL> Name <INTEGER_LITERAL> Name Name <SEMICOLON> ) | ( <DELETE_STEP> Name <INTEGER_LITERAL> Name Name <SEMICOLON> ) | ( <ADD_STEP> Name <INTEGER_LITERAL> Name Name BehaviorStep ) )
FailStep ::= <FAIL> <SEMICOLON>
SucceedStep ::= <SUCCEED> <SEMICOLON>
AnonymousBlock ::= BehaviorType <LBRACE> ( AblVariableDeclaration <SEMICOLON> )* ( BehaviorStep )+ <RBRACE>
StepModifier ::= SuccessTest
| PriorityModifier
| <IGNORE_FAILURE>
| Persistence
| <EFFECT_ONLY>
| <TEAM_EFFECT_ONLY>
| NamedProperty
| <POST>
| <POST_TO> <IDENTIFIER>
| <ONE_NEEDED_FOR_SUCCESS>
| <TEAM_NEEDED_FOR_SUCCESS>
SuccessTest ::= <SUCCESS_TEST> <LBRACE> TestExpression <RBRACE>
PriorityModifier ::= ( <PRIORITY_MODIFIER> <INTEGER_LITERAL> )
| ( <PRIORITY> <INTEGER_LITERAL> )
Persistence ::= ( <PERSISTENT> PersistenceType )
| ( <PERSISTENT> )
NamedProperty ::= <PROPERTY> AblName AblExpression
PersistenceType ::= ( <WHEN_FAILS> | <WHEN_SUCCEEDS> )
PrimitiveAct ::= <ACT> AblName <LPAREN> ( AblExpression ( <COMMA> AblExpression )* )? <RPAREN> <SEMICOLON>
MentalAct ::= <MENTAL_ACT> <LBRACE> ( ( AblVariableDeclaration <SEMICOLON> ) | ( Statement ) )* <RBRACE>
Goal ::= ( <JOINT> )? ( <SUBGOAL> | <SPAWNGOAL> ) AblName <LPAREN> ( AblExpression ( <COMMA> AblExpression )* )? <RPAREN> ( <AT> Name )? <SEMICOLON>
Wait ::= <WAIT> <SEMICOLON>
AblVariableDeclaration ::= Type VariableDeclarator ( "," VariableDeclarator )*
AblSimpleType ::= ( PrimitiveType | <IDENTIFIER> )
AblName ::= <IDENTIFIER>
WMEDeclaration ::= <WME> AblName ( <EXTENDS> AblName )? <LBRACE> ( AblVariableDeclaration <SEMICOLON> )* <RBRACE>
TeamNeededForSuccessDefaultDeclaration ::= <JOINT_GOAL_SUCCESS_NEGOTIATION> ( <TEAM_NEEDED_FOR_SUCCESS> | <ONE_NEEDED_FOR_SUCCESS> ) <SEMICOLON>
DecisionCycleSMCallDeclaration ::= <DECISION_CYCLE_SM_CALL> Name <SEMICOLON>