diff --git a/alib2algo/src/automaton/transform/RHPDAToPDA.cpp b/alib2algo/src/automaton/transform/RHPDAToPDA.cpp index b490884f7b241a875e05ed0c4007fb5a0f8c658d..3f320e1adcb03e1dc47de1dc1688e3051f878d24 100644 --- a/alib2algo/src/automaton/transform/RHPDAToPDA.cpp +++ b/alib2algo/src/automaton/transform/RHPDAToPDA.cpp @@ -20,6 +20,8 @@ #include <queue> #include <iostream> +#include <std/map.hpp> + namespace automaton { automaton::DPDA RHPDAToPDA::convert( const automaton::RealTimeHeightDeterministicDPDA & pda ) { @@ -30,7 +32,6 @@ automaton::DPDA RHPDAToPDA::convert( const automaton::RealTimeHeightDeterministi if(std::get<1>(transition.first).is<string::Epsilon>()) { auto& epsT = epsilonTransitions[std::get<0>(transition.first)]; const auto& to = transition.second; - if(to.second.getData() == alphabet::BottomOfTheStackSymbol::BOTTOM_OF_THE_STACK) throw exception::AlibException("Cannot convert"); epsT.insert(std::make_tuple(std::vector<alphabet::Symbol>{}, to.first, std::vector<alphabet::Symbol>{to.second})); } else { auto& readT = readingTransitions[std::make_tuple(std::get<0>(transition.first), std::get<1>(transition.first).get<alphabet::Symbol>(), std::vector<alphabet::Symbol>{})]; @@ -52,10 +53,10 @@ automaton::DPDA RHPDAToPDA::convert( const automaton::RealTimeHeightDeterministi } for(const auto& transition : pda.getReturnTransitions()) { + if(std::get<2>(transition.first).getData() == alphabet::BottomOfTheStackSymbol::BOTTOM_OF_THE_STACK) continue; if(std::get<1>(transition.first).is<string::Epsilon>()) { auto& epsT = epsilonTransitions[std::get<0>(transition.first)]; const auto& to = transition.second; - if(std::get<2>(transition.first).getData() == alphabet::BottomOfTheStackSymbol::BOTTOM_OF_THE_STACK) throw exception::AlibException("Cannot convert"); epsT.insert(std::make_tuple(std::vector<alphabet::Symbol>{std::get<2>(transition.first)}, to, std::vector<alphabet::Symbol>{})); } else { auto& readT = readingTransitions[std::make_tuple(std::get<0>(transition.first), std::get<1>(transition.first).get<alphabet::Symbol>(), std::vector<alphabet::Symbol>{std::get<2>(transition.first)})]; @@ -98,6 +99,7 @@ automaton::DPDA RHPDAToPDA::convert( const automaton::RealTimeHeightDeterministi res.setInputSymbols(pda.getInputAlphabet()); res.setStackSymbols(pda.getStackAlphabet()); + res.removeStackSymbol(alphabet::Symbol { alphabet::BottomOfTheStackSymbol::BOTTOM_OF_THE_STACK }); for(const auto& st : readingTransitions) { for(const auto& to : st.second) {