#pragma once #include "types.hpp" #include #include #include /* * These maps record the translation used while reading. */ struct translation { std::map input_indices; input max_input = 0; std::map output_indices; output max_output = 0; }; struct mealy; // Read a mealy machine while extending the translation mealy read_mealy_from_dot(std::istream & in, translation & t); mealy read_mealy_from_dot(const std::string & filename, translation & t); // Read a mealy machine, starting with the empty translation std::pair read_mealy_from_dot(std::istream & in); std::pair read_mealy_from_dot(const std::string & filename); // Used to invert the input_indices and output_indices maps template std::vector create_reverse_map(std::map const & indices){ std::vector ret(indices.size()); for(auto&& p : indices){ ret[p.second] = p.first; } return ret; }