#pragma once #include #include #include "storm/storage/sparse/ModelComponents.h" #include "storm/models/sparse/MarkovAutomaton.h" #include "storm/generator/StateBehavior.h" #include "storm-parsers/parser/SpiritErrorHandler.h" namespace storm { namespace parser { template class ImcaParserGrammar : public qi::grammar(), Skipper> { public: ImcaParserGrammar(); private: void initialize(); std::pair createStateValuePair(StateType const& state, ValueType const& value); StateType getStateIndex(std::string const& stateString); void addInitialState(StateType const& state); void addGoalState(StateType const& state); void addChoiceToStateBehavior(StateType const& state, std::string const& label, std::vector> const& transitions, boost::optional const& reward); storm::storage::sparse::ModelComponents createModelComponents(); qi::rule(), Skipper> start; qi::rule initials; qi::rule goals; qi::rule transitions; qi::rule choice; qi::rule(), Skipper> transition; qi::rule choicelabel; qi::rule reward; qi::rule state; qi::rule value; bool buildChoiceLabels; StateType numStates; StateType numChoices; StateType numTransitions; bool hasStateReward; bool hasActionReward; std::vector> stateBehaviors; storm::storage::BitVector initialStates, goalStates, markovianStates; std::map stateIndices; }; template class ImcaMarkovAutomatonParser { public: /*! * Parses the given file under the assumption that it contains a Markov automaton specified in the imca format. * * @param filename The name of the file to parse. * @return The obtained Markov automaton */ static std::shared_ptr> parseImcaFile(std::string const& filename); }; } // namespace parser } // namespace storm