@ -46,146 +46,108 @@ namespace storm {
atomicNumericalExpression % = minMaxExpression | floorCeilExpression | numericalVariableExpression | qi : : lit ( " ( " ) > > numericalExpression > > qi : : lit ( " ) " ) ;
atomicNumericalExpression . name ( " numerical expression " ) ;
minMaxExpression % = ( ( qi : : lit ( " min " ) [ qi : : _a = true ] | qi : : lit ( " max " ) [ qi : : _a = false ] ) > > qi : : lit ( " ( " ) > > numericalExpression > > qi : : lit ( " , " ) > > numericalExpression > > qi : : lit ( " ) " ) ) [ phoenix : : if_ ( qi : : _a ) [ qi : : _val = phoenix : : bind ( & storm : : expressions : : Expression : : minimum , qi : : _1 , qi : : _2 ) ] . else_ [ qi : : _val = phoenix : : bind ( & storm : : expressions : : Expression : : maximum , qi : : _1 , qi : : _2 ) ] ] ;
minMaxExpression = ( ( qi : : lit ( " min " ) [ qi : : _a = true ] | qi : : lit ( " max " ) [ qi : : _a = false ] ) > > qi : : lit ( " ( " ) > > numericalExpression > > qi : : lit ( " , " ) > > numericalExpression > > qi : : lit ( " ) " ) ) [ phoenix : : if_ ( qi : : _a ) [ qi : : _val = phoenix : : bind ( & storm : : expressions : : Expression : : minimum , qi : : _1 , qi : : _2 ) ] . else_ [ qi : : _val = phoenix : : bind ( & storm : : expressions : : Expression : : maximum , qi : : _1 , qi : : _2 ) ] ] ;
minMaxExpression . name ( " min/max expression " ) ;
floorCeilExpression % = ( ( qi : : lit ( " floor " ) [ qi : : _a = true ] | qi : : lit ( " ceil " ) [ qi : : _a = false ] ) > > qi : : lit ( " ( " ) > > numericalExpression > > qi : : lit ( " ) " ) ) [ phoenix : : if_ ( qi : : _a ) [ qi : : _val = phoenix : : bind ( & storm : : expressions : : Expression : : floor , qi : : _1 ) ] . else_ [ qi : : _val = phoenix : : bind ( & storm : : expressions : : Expression : : ceil , qi : : _1 ) ] ] ;
floorCeilExpression = ( ( qi : : lit ( " floor " ) [ qi : : _a = true ] | qi : : lit ( " ceil " ) [ qi : : _a = false ] ) > > qi : : lit ( " ( " ) > > numericalExpression > > qi : : lit ( " ) " ) ) [ phoenix : : if_ ( qi : : _a ) [ qi : : _val = phoenix : : bind ( & storm : : expressions : : Expression : : floor , qi : : _1 ) ] . else_ [ qi : : _val = phoenix : : bind ( & storm : : expressions : : Expression : : ceil , qi : : _1 ) ] ] ;
floorCeilExpression . name ( " integer floor/ceil expression " ) ;
numericalVariableExpression = identifier [ qi : : _val = phoenix : : bind ( & storm : : expressions : : Expression : : createDoubleVariable , qi : : _1 ) ] ;
numericalVariableExpression . name ( " numerical variable " ) ;
// Parse a model type.
modelTypeDefinition = modelType_ ;
modelTypeDefinition . name ( " model type " ) ;
undefinedConstantDefinition = ( undefinedBooleanConstantDefinition ( qi : : _r1 ) | undefinedIntegerConstantDefinition ( qi : : _r1 ) | undefinedDoubleConstantDefinition ( qi : : _r1 ) ) ;
undefinedConstantDefinition . name ( " undefined constant definition " ) ;
programHeader = modelTypeDefinition [ phoenix : : bind ( & GlobalProgramInformation : : modelType , qi : : _r1 ) = qi : : _1 ]
> * ( undefinedConstantDefinition ( qi : : _r1 )
| definedConstantDefinition ( qi : : _r1 )
| formulaDefinition ( qi : : _r1 )
| globalVariableDefinition ( qi : : _r1 )
) ;
programHeader . name ( " program header " ) ;
undefinedBooleanConstantDefinition = ( ( qi : : lit ( " const " ) > > qi : : lit ( " bool " ) ) > identifier > qi : : lit ( " ; " ) ) [ qi : : _pass = phoenix : : bind ( & PrismGrammar : : addUndefinedBooleanConstant , phoenix : : bind ( & GlobalProgramInformation : : undefinedBooleanConstants , qi : : _r1 ) , qi : : _1 ) ] ;
undefinedBooleanConstantDefinition . name ( " undefined boolean constant declaration " ) ;
// This block defines all entities that are needed for parsing global variable definitions.
globalVariableDefinitionList = * ( qi : : lit ( " global " ) > ( booleanVariableDefinition ( bind ( & GlobalVariableInformation : : booleanVariables , qi : : _r1 ) , bind ( & GlobalVariableInformation : : booleanVariableToIndexMap , qi : : _r1 ) , true ) | integerVariableDefinition ( bind ( & GlobalVariableInformation : : integerVariables , qi : : _r1 ) , bind ( & GlobalVariableInformation : : integerVariableToIndexMap , qi : : _r1 ) , true ) ) ) ;
globalVariableDefinitionList . name ( " global variable declaration list " ) ;
undefinedIntegerConstantDefinition = ( ( qi : : lit ( " const " ) > > qi : : lit ( " int " ) ) > identifier > qi : : lit ( " ; " ) ) [ qi : : _pass = phoenix : : bind ( & PrismGrammar : : addUndefinedIntegerConstant , phoenix : : bind ( & GlobalProgramInformation : : undefinedIntegerConstants , qi : : _r1 ) , qi : : _1 ) ] ;
undefinedIntegerConstantDefinition . name ( " undefined integer constant declaration " ) ;
// This block defines all entities that are needed for parsing constant definitions.
definedBooleanConstantDefinition = ( ( qi : : lit ( " const " ) > > qi : : lit ( " bool " ) > > identifier > > qi : : lit ( " = " ) ) > expression > qi : : lit ( " ; " ) ) [ phoenix : : bind ( this - > state - > booleanConstants_ . add , qi : : _1 , qi : : _2 ) , phoenix : : bind ( this - > state - > allConstantNames_ . add , qi : : _1 , qi : : _1 ) , qi : : _val = qi : : _2 ] ;
undefinedDoubleConstantDefinition = ( ( qi : : lit ( " const " ) > > qi : : lit ( " double " ) ) > identifier > qi : : lit ( " ; " ) ) [ qi : : _pass = phoenix : : bind ( & PrismGrammar : : addUndefinedDoubleConstant , phoenix : : bind ( & GlobalProgramInformation : : undefinedDoubleConstants , qi : : _r1 ) , qi : : _1 ) ] ;
undefinedDoubleConstantDefinition . name ( " undefined double constant definition " ) ;
definedConstantDefinition % = ( definedBooleanConstantDefinition ( qi : : _r1 ) | definedIntegerConstantDefinition ( qi : : _r1 ) | definedDoubleConstantDefinition ( qi : : _r1 ) ) ;
definedConstantDefinition . name ( " defined constant definition " ) ;
definedBooleanConstantDefinition = ( ( qi : : lit ( " const " ) > > qi : : lit ( " bool " ) > > identifier > > qi : : lit ( " = " ) ) > expression > qi : : lit ( " ; " ) ) [ qi : : _pass = phoenix : : bind ( & PrismGrammar : : addDefinedBooleanConstant , phoenix : : bind ( & GlobalProgramInformation : : definedBooleanConstants , qi : : _r1 ) , qi : : _1 , qi : : _2 ) ] ;
definedBooleanConstantDefinition . name ( " defined boolean constant declaration " ) ;
definedIntegerConstantDefinition = ( qi : : lit ( " const " ) > > qi : : lit ( " int " ) > > FreeIdentifierGrammar : : instance ( this - > state ) > > qi : : lit ( " = " ) > > ConstIntegerExpressionGrammar : : instance ( this - > state ) > > qi : : lit ( " ; " ) ) [ phoenix : : bind ( this - > state - > integerConstants_ . add , qi : : _1 , qi : : _2 ) , phoenix : : bind ( this - > state - > allConstantNames_ . add , qi : : _1 , qi : : _1 ) , qi : : _val = qi : : _2 ] ;
definedIntegerConstantDefinition = ( ( qi : : lit ( " const " ) > > qi : : lit ( " int " ) > > identifier > > qi : : lit ( " = " ) ) > expression > > qi : : lit ( " ; " ) ) [ qi : : _pass = phoenix : : bind ( & PrismGrammar : : addDefinedIntegerConstant , phoenix : : bind ( & GlobalProgramInformation : : definedIntegerConstants , qi : : _r1 ) , qi : : _1 , qi : : _2 ) ] ;
definedIntegerConstantDefinition . name ( " defined integer constant declaration " ) ;
definedDoubleConstantDefinition = ( qi : : lit ( " const " ) > > qi : : lit ( " double " ) > > FreeIdentifierGrammar : : instance ( this - > state ) > > qi : : lit ( " = " ) > ConstDoubleExpressionGrammar : : instance ( this - > state ) > qi : : lit ( " ; " ) ) [ phoenix : : bind ( this - > state - > doubleConstants_ . add , qi : : _1 , qi : : _2 ) , phoenix : : bind ( this - > state - > allConstantNames_ . add , qi : : _1 , qi : : _1 ) , qi : : _val = qi : : _2 ] ;
definedDoubleConstantDefinition = ( ( qi : : lit ( " const " ) > > qi : : lit ( " double " ) > > identifier > > qi : : lit ( " = " ) ) > expression > qi : : lit ( " ; " ) ) [ qi : : _pass = phoenix : : bind ( & PrismGrammar : : addDefinedDoubleConstant , phoenix : : bind ( & GlobalProgramInformation : : definedDoubleConstants , qi : : _r1 ) , qi : : _1 , qi : : _2 ) ] ;
definedDoubleConstantDefinition . name ( " defined double constant declaration " ) ;
undefinedBooleanConstantDefinition = ( qi : : lit ( " const " ) > > qi : : lit ( " bool " ) > FreeIdentifierGrammar : : instance ( this - > state ) > qi : : lit ( " ; " ) ) [ phoenix : : bind ( & PrismGrammar : : addUndefinedBooleanConstant , this , qi : : _1 , qi : : _r1 ) ] ;
undefinedBooleanConstantDefinition . name ( " undefined boolean constant declaration " ) ;
undefinedIntegerConstantDefinition = ( qi : : lit ( " const " ) > > qi : : lit ( " int " ) > FreeIdentifierGrammar : : instance ( this - > state ) > qi : : lit ( " ; " ) ) [ phoenix : : bind ( & PrismGrammar : : addUndefinedIntegerConstant , this , qi : : _1 , qi : : _r1 ) ] ;
undefinedIntegerConstantDefinition . name ( " undefined integer constant declaration " ) ;
undefinedDoubleConstantDefinition = ( qi : : lit ( " const " ) > > qi : : lit ( " double " ) > FreeIdentifierGrammar : : instance ( this - > state ) > qi : : lit ( " ; " ) ) [ phoenix : : bind ( & PrismGrammar : : addUndefinedDoubleConstant , this , qi : : _1 , qi : : _r1 ) ] ;
undefinedDoubleConstantDefinition . name ( " undefined double constant definition " ) ;
definedConstantDefinition % = ( definedBooleanConstantDefinition ( qi : : _r1 ) | definedIntegerConstantDefinition ( qi : : _r2 ) | definedDoubleConstantDefinition ( qi : : _r3 ) ) ;
definedConstantDefinition . name ( " defined constant definition " ) ;
undefinedConstantDefinition = ( undefinedBooleanConstantDefinition ( qi : : _r1 ) | undefinedIntegerConstantDefinition ( qi : : _r2 ) | undefinedDoubleConstantDefinition ( qi : : _r3 ) ) ;
undefinedConstantDefinition . name ( " undefined constant definition " ) ;
// Parse the ingredients of a probabilistic program.
start = ( qi : : eps >
programHeader ( qi : : _a ) >
formulaDefinitionList >
globalVariableDefinitionList ( qi : : _d ) >
moduleDefinitionList >
rewardDefinitionList ( qi : : _e ) >
labelDefinitionList ( qi : : _f ) ) [ qi : : _val = phoenix : : bind ( & createProgram , qi : : _1 , qi : : _a , qi : : _b , qi : : _c , qi : : _d , qi : : _2 , qi : : _e , qi : : _f ) ] ;
start . name ( " probabilistic program declaration " ) ;
formulaDefinition = ( qi : : lit ( " formula " ) > identifier > qi : : lit ( " = " ) > expression > qi : : lit ( " ; " ) ) [ qi : : _pass = phoenix : : bind ( & PrismGrammar : : addFormula , phoenix : : bind ( & GlobalProgramInformation : : formulas , qi : : _r1 ) , qi : : _1 , qi : : _2 ) ] ;
formulaDefinition . name ( " formula definition " ) ;
labelDefinition = ( qi : : lit ( " label " ) > > - qi : : lit ( " \" " ) > > FreeIdentifierGrammar : : instance ( this - > state ) > > - qi : : lit ( " \" " ) > > qi : : lit ( " = " ) > > BooleanExpressionGrammar : : instance ( this - > state ) > > qi : : lit ( " ; " ) )
[ phoenix : : bind ( & PrismGrammar : : addLabel , this , qi : : _1 , qi : : _2 , qi : : _r1 ) ] ;
labelDefinition . name ( " label declaration " ) ;
labelDefinitionList % = * labelDefinition ( qi : : _r1 ) ;
labelDefinitionList . name ( " label declaration list " ) ;
globalVariableDefinition = ( qi : : lit ( " global " ) > ( booleanVariableDefinition ( phoenix : : bind ( & GlobalProgramInformation : : globalBooleanVariables , qi : : _r1 ) ) | integerVariableDefinition ( phoenix : : bind ( & GlobalProgramInformation : : globalIntegerVariables , qi : : _r1 ) ) ) ) ;
globalVariableDefinition . name ( " global variable declaration list " ) ;
// This block defines all entities that are needed for parsing a reward model.
stateRewardDefinition = ( BooleanExpressionGrammar : : instance ( this - > state ) > qi : : lit ( " : " ) > ConstDoubleExpressionGrammar : : instance ( this - > state ) > > qi : : lit ( " ; " ) ) [ qi : : _val = phoenix : : bind ( & createStateReward , qi : : _1 , qi : : _2 ) ] ;
programHeader = modelTypeDefinition [ phoenix : : bind ( & GlobalProgramInformation : : modelType , qi : : _r1 ) = qi : : _1 ]
> * ( undefinedConstantDefinition ( qi : : _r1 )
| definedConstantDefinition ( qi : : _r1 )
| formulaDefinition ( qi : : _r1 )
| globalVariableDefinition ( qi : : _r1 )
) ;
programHeader . name ( " program header " ) ;
rewardModelDefinition = ( qi : : lit ( " rewards " ) > qi : : lit ( " \" " ) > identifier > qi : : lit ( " \" " )
> + ( stateRewardDefinition [ phoenix : : push_back ( qi : : _a , qi : : _1 ) ]
| transitionRewardDefinition [ phoenix : : push_back ( qi : : _b , qi : : _1 ) ]
)
> > qi : : lit ( " endrewards " ) ) [ phoenix : : bind ( & PrismGrammar : : addRewardModel , phoenix : : bind ( & GlobalProgramInformation : : rewardModels , qi : : _r1 ) , qi : : _1 , qi : : _a , qi : : _b ) ] ;
rewardModelDefinition . name ( " reward model definition " ) ;
stateRewardDefinition = ( booleanExpression > qi : : lit ( " : " ) > numericalExpression > > qi : : lit ( " ; " ) ) [ qi : : _val = phoenix : : bind ( & PrismGrammar : : createStateReward , qi : : _1 , qi : : _2 ) ] ;
stateRewardDefinition . name ( " state reward definition " ) ;
transitionRewardDefinition = ( qi : : lit ( " [ " ) > - ( commandName [ qi : : _a = qi : : _1 ] ) > qi : : lit ( " ] " ) > BooleanExpressionGrammar : : instance ( this - > state ) > qi : : lit ( " : " ) > ConstDoubleExpressionGrammar : : instance ( this - > state ) > qi : : lit ( " ; " ) ) [ qi : : _val = phoenix : : bind ( & createTransitionReward , qi : : _a , qi : : _2 , qi : : _3 ) ] ;
transitionRewardDefinition = ( qi : : lit ( " [ " ) > - ( identifier [ qi : : _a = qi : : _1 ] ) > qi : : lit ( " ] " ) > booleanExpression > qi : : lit ( " : " ) > numericalExpression > qi : : lit ( " ; " ) ) [ qi : : _val = phoenix : : bind ( & PrismGrammar : : createTransitionReward , qi : : _a , qi : : _2 , qi : : _3 ) ] ;
transitionRewardDefinition . name ( " transition reward definition " ) ;
rewardDefinition = ( qi : : lit ( " rewards " ) > qi : : lit ( " \" " ) > FreeIdentifierGrammar : : instance ( this - > state ) > qi : : lit ( " \" " ) > + ( stateRewardDefinition [ phoenix : : push_back ( qi : : _a , qi : : _1 ) ] | transitionRewardDefinition [ phoenix : : push_back ( qi : : _b , qi : : _1 ) ] ) > > qi : : lit ( " endrewards " ) )
[ phoenix : : bind ( & createRewardModel , qi : : _1 , qi : : _a , qi : : _b , qi : : _r1 ) ] ;
rewardDefinition . name ( " reward definition " ) ;
rewardDefinitionList = * rewardDefinition ( qi : : _r1 ) ;
rewardDefinitionList . name ( " reward definition list " ) ;
commandName % = this - > state - > commandNames_ ;
commandName . name ( " command name " ) ;
unassignedLocalBooleanVariableName % = ( this - > state - > localBooleanVariables_ | this - > state - > globalBooleanVariables_ ) - this - > state - > assignedBooleanVariables_ ;
unassignedLocalBooleanVariableName . name ( " unassigned local/global boolean variable " ) ;
unassignedLocalIntegerVariableName % = ( this - > state - > localIntegerVariables_ | this - > state - > globalIntegerVariables_ ) - this - > state - > assignedIntegerVariables_ ;
unassignedLocalIntegerVariableName . name ( " unassigned local/global integer variable " ) ;
// This block defines all entities that are needed for parsing a single command.
assignmentDefinition =
( qi : : lit ( " ( " ) > > unassignedLocalIntegerVariableName > qi : : lit ( " ' " ) > qi : : lit ( " = " ) > IntegerExpressionGrammar : : instance ( this - > state ) > qi : : lit ( " ) " ) ) [ phoenix : : bind ( & PrismGrammar : : addIntegerAssignment , this , qi : : _1 , qi : : _2 , qi : : _r2 ) ] |
( qi : : lit ( " ( " ) > > unassignedLocalBooleanVariableName > qi : : lit ( " ' " ) > qi : : lit ( " = " ) > BooleanExpressionGrammar : : instance ( this - > state ) > qi : : lit ( " ) " ) ) [ phoenix : : bind ( & PrismGrammar : : addBooleanAssignment , this , qi : : _1 , qi : : _2 , qi : : _r1 ) ] ;
labelDefinition = ( qi : : lit ( " label " ) > - qi : : lit ( " \" " ) > identifier > - qi : : lit ( " \" " ) > qi : : lit ( " = " ) > booleanExpression > > qi : : lit ( " ; " ) ) [ qi : : _pass = phoenix : : bind ( & PrismGrammar : : addLabel , phoenix : : bind ( & GlobalProgramInformation : : labels , qi : : _r1 ) , qi : : _1 , qi : : _2 ) ] ;
labelDefinition . name ( " label definition " ) ;
assignmentDefinition = ( qi : : lit ( " ( " ) > identifier > qi : : lit ( " ' " ) > qi : : lit ( " = " ) > expression > qi : : lit ( " ) " ) ) [ qi : : _pass = phoenix : : bind ( & PrismGrammar : : addAssignment , qi : : _r1 , qi : : _1 , qi : : _2 ) ] ;
assignmentDefinition . name ( " assignment " ) ;
assignmentDefinitionList = assignmentDefinition ( qi : : _r1 , qi : : _r2 ) % " & " ;
assignmentDefinitionList = assignmentDefinition ( qi : : _r1 ) % " & " ;
assignmentDefinitionList . name ( " assignment list " ) ;
updateDefinition = ( ( ( ConstDoubleExpressionGrammar : : instance ( this - > state ) > > qi : : lit ( " : " ) )
| qi : : attr ( std : : shared_ptr < BaseExpression > ( new storm : : ir : : expressions : : DoubleLiteralExpression ( 1 ) ) ) ) [ phoenix : : clear ( phoenix : : ref ( this - > state - > assignedBooleanVariables_ ) ) , phoenix : : clear ( phoenix : : ref ( this - > state - > assignedIntegerVariables_ ) ) ]
> > assignmentDefinitionList ( qi : : _a , qi : : _b ) ) [ qi : : _val = phoenix : : bind ( & PrismGrammar : : createUpdate , this , qi : : _1 , qi : : _a , qi : : _b ) ] ;
moduleDefinitionList % = + ( moduleDefinition ( qi : : _r1 ) | moduleRenaming ( qi : : _r1 ) ) ;
moduleDefinitionList . name ( " module list " ) ;
updateDefinition = ( ( ( numericalExpression > > qi : : lit ( " : " ) ) | qi : : attr ( storm : : expressions : : Expression : : createDoubleLiteral ( 1 ) ) ) > > assignmentDefinitionList ( qi : : _a ) ) [ qi : : _val = phoenix : : bind ( & PrismGrammar : : createUpdate , qi : : _1 , qi : : _a ) ] ;
updateDefinition . name ( " update " ) ;
updateListDefinition = + updateDefinition % " + " ;
updateListDefinition % = + updateDefinition % " + " ;
updateListDefinition . name ( " update list " ) ;
commandDefinition = (
qi : : lit ( " [ " ) > - (
( FreeIdentifierGrammar : : instance ( this - > state ) [ phoenix : : bind ( this - > state - > commandNames_ . add , qi : : _1 , qi : : _1 ) ] | commandName ) [ qi : : _a = qi : : _1 ]
) > qi : : lit ( " ] " ) > BooleanExpressionGrammar : : instance ( this - > state ) > qi : : lit ( " -> " ) > updateListDefinition > qi : : lit ( " ; " )
) [ qi : : _val = phoenix : : bind ( & PrismGrammar : : createCommand , this , qi : : _a , qi : : _2 , qi : : _3 ) ] ;
commandDefinition . name ( " command " ) ;
// This block defines all entities that are needed for parsing variable definitions.
booleanVariableDefinition = ( FreeIdentifierGrammar : : instance ( this - > state ) > > qi : : lit ( " : " ) > > qi : : lit ( " bool " ) > - ( qi : : lit ( " init " ) > ConstBooleanExpressionGrammar : : instance ( this - > state ) [ qi : : _b = phoenix : : construct < std : : shared_ptr < BaseExpression > > ( qi : : _1 ) ] ) > qi : : lit ( " ; " ) )
[ phoenix : : bind ( & PrismGrammar : : createBooleanVariable , this , qi : : _1 , qi : : _b , qi : : _r1 , qi : : _r2 , qi : : _r3 ) ] ;
booleanVariableDefinition . name ( " boolean variable declaration " ) ;
integerVariableDefinition = ( FreeIdentifierGrammar : : instance ( this - > state ) > > qi : : lit ( " : " ) > > qi : : lit ( " [ " ) > ConstIntegerExpressionGrammar : : instance ( this - > state ) > qi : : lit ( " .. " ) > ConstIntegerExpressionGrammar : : instance ( this - > state ) > qi : : lit ( " ] " ) > - ( qi : : lit ( " init " ) > ConstIntegerExpressionGrammar : : instance ( this - > state ) [ qi : : _b = phoenix : : construct < std : : shared_ptr < BaseExpression > > ( qi : : _1 ) ] ) > qi : : lit ( " ; " ) )
[ phoenix : : bind ( & PrismGrammar : : createIntegerVariable , this , qi : : _1 , qi : : _2 , qi : : _3 , qi : : _b , qi : : _r1 , qi : : _r2 , qi : : _r3 ) ] ;
integerVariableDefinition . name ( " integer variable declaration " ) ;
variableDefinition = ( booleanVariableDefinition ( qi : : _r1 , qi : : _r3 , false ) | integerVariableDefinition ( qi : : _r2 , qi : : _r4 , false ) ) ;
variableDefinition . name ( " variable declaration " ) ;
// This block defines all entities that are needed for parsing a module.
moduleDefinition = ( qi : : lit ( " module " ) > > FreeIdentifierGrammar : : instance ( this - > state ) [ phoenix : : bind ( & VariableState : : clearLocalVariables , * this - > state ) ]
> > * ( variableDefinition ( qi : : _a , qi : : _b , qi : : _c , qi : : _d ) ) > > + commandDefinition > qi : : lit ( " endmodule " ) )
[ qi : : _val = phoenix : : bind ( & PrismGrammar : : createModule , this , qi : : _1 , qi : : _a , qi : : _b , qi : : _c , qi : : _d , qi : : _2 ) ] ;
moduleDefinition . name ( " module " ) ;
moduleRenaming = ( qi : : lit ( " module " ) > > FreeIdentifierGrammar : : instance ( this - > state ) > > qi : : lit ( " = " )
> this - > state - > moduleNames_ > qi : : lit ( " [ " ) > * (
( IdentifierGrammar : : instance ( this - > state ) > qi : : lit ( " = " ) > IdentifierGrammar : : instance ( this - > state ) > > - qi : : lit ( " , " ) ) [ phoenix : : insert ( qi : : _a , phoenix : : construct < std : : pair < std : : string , std : : string > > ( qi : : _1 , qi : : _2 ) ) ]
) > qi : : lit ( " ] " ) > qi : : lit ( " endmodule " ) )
[ qi : : _val = phoenix : : bind ( & PrismGrammar : : renameModule , this , qi : : _1 , qi : : _2 , qi : : _a ) ] ;
moduleRenaming . name ( " renamed module " ) ;
moduleDefinitionList % = + ( moduleDefinition | moduleRenaming ) ;
moduleDefinitionList . name ( " module list " ) ;
commandDefinition = ( qi : : lit ( " [ " ) > - ( identifier [ qi : : _a = qi : : _1 ] ) > qi : : lit ( " ] " ) > booleanExpression > qi : : lit ( " -> " ) > updateListDefinition > qi : : lit ( " ; " ) ) [ qi : : _val = phoenix : : bind ( & PrismGrammar : : createCommand , qi : : _a , qi : : _2 , qi : : _3 ) ] ;
commandDefinition . name ( " command definition " ) ;
booleanVariableDefinition = ( ( identifier > > qi : : lit ( " : " ) > > qi : : lit ( " bool " ) ) > ( ( qi : : lit ( " init " ) > booleanExpression ) | qi : : attr ( storm : : expressions : : Expression : : createFalse ( ) ) ) > qi : : lit ( " ; " ) ) [ phoenix : : bind ( & PrismGrammar : : addBooleanVariable , qi : : _r1 , qi : : _1 , qi : : _2 ) ] ;
booleanVariableDefinition . name ( " boolean variable definition " ) ;
integerVariableDefinition = ( ( identifier > > qi : : lit ( " : " ) > > qi : : lit ( " [ " ) ) > numericalExpression [ qi : : _a = qi : : _1 ] > qi : : lit ( " .. " ) > numericalExpression > qi : : lit ( " ] " ) > - ( qi : : lit ( " init " ) > numericalExpression [ qi : : _a = qi : : _1 ] ) > qi : : lit ( " ; " ) ) [ phoenix : : bind ( & PrismGrammar : : addIntegerVariable , qi : : _r1 , qi : : _1 , qi : : _2 , qi : : _3 , qi : : _a ) ] ;
integerVariableDefinition . name ( " integer variable definition " ) ;
constantBooleanFormulaDefinition = ( qi : : lit ( " formula " ) > > FreeIdentifierGrammar : : instance ( this - > state ) > > qi : : lit ( " = " ) > > ConstBooleanExpressionGrammar : : instance ( this - > state ) > > qi : : lit ( " ; " ) ) [ phoenix : : bind ( this - > state - > constantBooleanFormulas_ . add , qi : : _1 , qi : : _2 ) ] ;
constantBooleanFormulaDefinition . name ( " constant boolean formula definition " ) ;
booleanFormulaDefinition = ( qi : : lit ( " formula " ) > > FreeIdentifierGrammar : : instance ( this - > state ) > > qi : : lit ( " = " ) > > BooleanExpressionGrammar : : instance ( this - > state ) > > qi : : lit ( " ; " ) ) [ phoenix : : bind ( this - > state - > booleanFormulas_ . add , qi : : _1 , qi : : _2 ) ] ;
booleanFormulaDefinition . name ( " boolean formula definition " ) ;
constantIntegerFormulaDefinition = ( qi : : lit ( " formula " ) > > FreeIdentifierGrammar : : instance ( this - > state ) > > qi : : lit ( " = " ) > > ConstIntegerExpressionGrammar : : instance ( this - > state ) > > qi : : lit ( " ; " ) ) [ phoenix : : bind ( this - > state - > constantIntegerFormulas_ . add , qi : : _1 , qi : : _2 ) ] ;
constantIntegerFormulaDefinition . name ( " constant integer formula definition " ) ;
integerFormulaDefinition = ( qi : : lit ( " formula " ) > > FreeIdentifierGrammar : : instance ( this - > state ) > > qi : : lit ( " = " ) > > IntegerExpressionGrammar : : instance ( this - > state ) > > qi : : lit ( " ; " ) ) [ phoenix : : bind ( this - > state - > integerFormulas_ . add , qi : : _1 , qi : : _2 ) ] ;
integerFormulaDefinition . name ( " integer formula definition " ) ;
constantDoubleFormulaDefinition = ( qi : : lit ( " formula " ) > > FreeIdentifierGrammar : : instance ( this - > state ) > > qi : : lit ( " = " ) > > ConstDoubleExpressionGrammar : : instance ( this - > state ) > > qi : : lit ( " ; " ) ) [ phoenix : : bind ( this - > state - > constantDoubleFormulas_ . add , qi : : _1 , qi : : _2 ) ] ;
constantDoubleFormulaDefinition . name ( " constant double formula definition " ) ;
formulaDefinition = constantBooleanFormulaDefinition | booleanFormulaDefinition | constantIntegerFormulaDefinition | integerFormulaDefinition | constantDoubleFormulaDefinition ;
formulaDefinition . name ( " formula definition " ) ;
formulaDefinitionList = * formulaDefinition ;
formulaDefinitionList . name ( " formula definition list " ) ;
variableDefinition = ( booleanVariableDefinition ( qi : : _r1 ) | integerVariableDefinition ( qi : : _r2 ) ) ;
variableDefinition . name ( " variable declaration " ) ;
moduleDefinition = ( ( qi : : lit ( " module " ) > > identifier > > * ( variableDefinition ( qi : : _a , qi : : _b ) ) ) > + commandDefinition > qi : : lit ( " endmodule " ) ) [ qi : : _val = phoenix : : bind ( & PrismGrammar : : createModule , qi : : _1 , qi : : _a , qi : : _b , qi : : _2 ) ] ;
moduleDefinition . name ( " module definition " ) ;
moduleRenaming = ( ( qi : : lit ( " module " ) > > identifier > > qi : : lit ( " = " ) ) > identifier > qi : : lit ( " [ " )
> ( ( identifier > qi : : lit ( " = " ) > identifier ) [ phoenix : : insert ( qi : : _a , phoenix : : construct < std : : pair < std : : string , std : : string > > ( qi : : _1 , qi : : _2 ) ) ] % " , " ) > qi : : lit ( " ] " )
> qi : : lit ( " endmodule " ) ) [ qi : : _val = phoenix : : bind ( & PrismGrammar : : createRenamedModule , qi : : _1 , qi : : _2 , qi : : _a , qi : : _r1 ) ] ;
moduleRenaming . name ( " module definition via renaming " ) ;
start = ( qi : : eps > programHeader ( qi : : _a ) > moduleDefinitionList ( qi : : _a ) > * ( rewardModelDefinition ( qi : : _a ) | labelDefinition ( qi : : _a ) ) ) [ qi : : _val = phoenix : : bind ( & PrismGrammar : : createProgram , qi : : _a , qi : : _1 ) ] ;
start . name ( " probabilistic program " ) ;
}
} // namespace prism
} // namespace parser
xxxxxxxxxx