Add files via upload
RegEx
This commit is contained in:
commit
b48d3ec773
13 changed files with 2817 additions and 0 deletions
59
dfa.hpp
Normal file
59
dfa.hpp
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// dfa.hpp
|
||||
// lab2
|
||||
//
|
||||
// Created by Владислав Агибалов on 19.07.2025.
|
||||
//
|
||||
|
||||
#ifndef dfa_hpp
|
||||
#define dfa_hpp
|
||||
|
||||
#include <stdio.h>
|
||||
#include "dfa_node.hpp"
|
||||
#include "nfa.hpp"
|
||||
#include "match.hpp"
|
||||
|
||||
namespace regex {
|
||||
|
||||
class dfa{
|
||||
|
||||
std::shared_ptr<dfa_node> start_;
|
||||
|
||||
std::set<std::shared_ptr<dfa_node>> all_nodes_;
|
||||
|
||||
std::set<std::shared_ptr<dfa_node>> common_nodes_;
|
||||
|
||||
std::set<std::shared_ptr<dfa_node>> finish_nodes_;
|
||||
|
||||
static std::set<size_t> getAlphabet(std::set<std::shared_ptr<dfa_node>> const&);
|
||||
|
||||
std::map<std::shared_ptr<dfa_node>, std::set<std::shared_ptr<dfa_node>>> generateSets(dfa const&) const;
|
||||
|
||||
std::pair<std::map<std::shared_ptr<dfa_node>, size_t>, std::vector<std::vector<std::pair<bool, std::string>>>> matrix_generate() const;
|
||||
|
||||
public:
|
||||
|
||||
dfa();
|
||||
|
||||
void dfaGenerate(nfa const&);
|
||||
|
||||
void minimization(dfa const&);
|
||||
|
||||
void print(std::string const &) const;
|
||||
|
||||
size_t find(std::string const &, match&) const;
|
||||
|
||||
dfa copy() const;
|
||||
|
||||
std::string rebirth() const;
|
||||
|
||||
bool operator==(const dfa&) const;
|
||||
|
||||
dfa intersection(const dfa&);
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif /* dfa_hpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue