-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cambio en convertion para calcular los nuevos estados
- Loading branch information
Showing
8 changed files
with
184 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "../automata/dfa/DeterministicFiniteAutomata.h" | ||
#include "../automata/ndfa/NotDeterministicFiniteAutomata.h" | ||
#include "../automata/convertion/ConvertionOfAutomatas.h" | ||
|
||
int main(){ | ||
using std::cout; | ||
NotDeterministicFiniteAutomata ndfa; | ||
|
||
ConvertionOfAutomatas conversor; | ||
ndfa.setInitialState(10); | ||
ndfa.setAlphabet({1,2}); //a, b | ||
ndfa.setStates({10,11,12,13}); | ||
ndfa.addPath(10,1,11); | ||
ndfa.addPath(10,-1,11); | ||
ndfa.addPath(11,-1,12); | ||
ndfa.addPath(11,2,11); | ||
ndfa.addPath(11,2,12); | ||
ndfa.addPath(11,1,13); | ||
ndfa.addPath(13,1,13); | ||
ndfa.addPath(13,2,13); | ||
ndfa.addFinalState(12); | ||
conversor.setNDFA(ndfa); | ||
|
||
set<int> clausura = conversor.getLambdaClosure({10}); | ||
for (int state : clausura){ | ||
std::cout << state << ' '; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "../automata/dfa/DeterministicFiniteAutomata.h" | ||
#include "../automata/ndfa/NotDeterministicFiniteAutomata.h" | ||
#include "../automata/convertion/ConvertionOfAutomatas.h" | ||
|
||
int main(){ | ||
using std::cout; | ||
NotDeterministicFiniteAutomata ndfa; | ||
|
||
ConvertionOfAutomatas conversor; | ||
ndfa.setInitialState(10); | ||
ndfa.setAlphabet({1,2}); //a, b | ||
ndfa.setStates({10,11,12,13}); | ||
ndfa.addPath(10,1,11); | ||
ndfa.addPath(10,-1,11); | ||
ndfa.addPath(11,-1,12); | ||
ndfa.addPath(11,2,11); | ||
ndfa.addPath(11,2,12); | ||
ndfa.addPath(11,1,13); | ||
ndfa.addPath(13,1,13); | ||
ndfa.addPath(13,2,13); | ||
ndfa.addFinalState(12); | ||
conversor.setNDFA(ndfa); | ||
|
||
set<int> clausura = conversor.move({11},2); | ||
for (int state : clausura){ | ||
std::cout << state << ' '; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <bits/stdc++.h> | ||
#include "../automata/dfa/DeterministicFiniteAutomata.h" | ||
#include "../automata/ndfa/NotDeterministicFiniteAutomata.h" | ||
#include "../parser/Parser.h" | ||
using namespace std; | ||
|
||
const string filename = "TP/testing/output.txt"; | ||
|
||
int main() { | ||
ifstream file(filename); // Abrir el archivo | ||
Parser parser = *new Parser(); | ||
|
||
if (!file.is_open()) { // Verificar si el archivo se abrió correctamente | ||
cerr << "No se pudo abrir el archivo." << endl; | ||
return -1; | ||
} | ||
|
||
string line; | ||
|
||
if (!getline(file, line)) { // Leer la primera línea | ||
cerr << "No se pudo leer la primera línea." << endl; | ||
return -1; | ||
} | ||
if(!Parser::validateTransitionLine(line)){ | ||
cerr << "Formato invalido del archivo." << endl; | ||
return -1; | ||
} | ||
|
||
file.close(); | ||
|
||
//NotDeterministicFiniteAutomata nda = parser.getNDA(); | ||
//nda.show(); //TODO: IMPLEMENTAR | ||
} |