Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
GasTexConverter.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <ext/ostream>
9#include <ext/sstream>
10
11#include <ext/utility>
12#include <ext/typeinfo>
13
14#include <alib/map>
15#include <alib/vector>
16#include <alib/set>
17
19#include <string/String.h>
20
21#include <automaton/FSM/NFA.h>
24#include <automaton/FSM/DFA.h>
27#include <automaton/TA/NFTA.h>
28#include <automaton/TA/DFTA.h>
29#include <automaton/PDA/DPDA.h>
37#include <automaton/PDA/NPDA.h>
40
42
46
47namespace convert {
48
50 static void printTransitionMap( const ext::map<std::pair<std::string, std::string>, std::string> & transitionMap, ext::ostream& out);
51
52 template < class SymbolType >
53 static std::string getStackSymbols(const ext::vector<SymbolType>& stackSymbols);
54
55 template < class SymbolType, class StateType >
56 static void transitions(const automaton::DFA < SymbolType, StateType > & fsm, ext::ostream & out);
57
58 template < class SymbolType, class StateType >
59 static void transitions(const automaton::NFA < SymbolType, StateType > & fsm, ext::ostream & out);
60
61 template < class SymbolType, class StateType >
62 static void transitions(const automaton::MultiInitialStateNFA < SymbolType, StateType > & fsm, ext::ostream & out);
63
64 template < class SymbolType, class StateType >
65 static void transitions(const automaton::EpsilonNFA < SymbolType, StateType > & fsm, ext::ostream & out);
66
67 template < class SymbolType, class StateType >
68 static void transitions(const automaton::ExtendedNFA < SymbolType, StateType > & fsm, ext::ostream & out);
69
70 template < class SymbolType, class StateType >
71 static void transitions(const automaton::CompactNFA < SymbolType, StateType > & fsm, ext::ostream & out);
72
73 template < class SymbolType, class StateType >
74 static void transitions(const automaton::NFTA < SymbolType, StateType > & fsm, ext::ostream & out);
75
76 template < class SymbolType, class StateType >
77 static void transitions(const automaton::DFTA < SymbolType, StateType > & fsm, ext::ostream & out);
78
79 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
81
82 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
84
85 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
87
88 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
90
91 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
93
94 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
96
97 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
99
100 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
102
103 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
105
106 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
108
109 template < class SymbolType, class StateType >
110 static void transitions(const automaton::OneTapeDTM < SymbolType, StateType > & tm, ext::ostream & out);
111public:
112 template < class SymbolType, class StateType >
114
115 template < class SymbolType, class StateType >
117
118 template < class SymbolType, class StateType >
120
121 template < class SymbolType, class StateType >
123
124 template < class SymbolType, class StateType >
126
127 template < class SymbolType, class StateType >
129
130 template < class SymbolType, class StateType >
132
133 template < class SymbolType, class StateType >
135
136 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
138
139 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
141
142 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
144
145 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
147
148 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
150
151 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
153
154 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
156
157 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
159
160 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
162
163 template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
165
166 template < class SymbolType, class StateType >
168
169 template < class T >
170 static std::string convert ( const T & automaton ) {
172 convert ( ss, automaton );
173 return ss.str ( );
174 }
175};
176
177template < class SymbolType, class StateType >
179 out << "\\begin{center}\n";
180 out << "\\begin{picture}(,)(,)\n";
181
182 for (auto& state : a.getStates()) {
183 bool initial = false;
184 bool final = false;
185
186 if(a.getInitialState() == state){
187 initial = true;
188 }
189 if(a.getFinalStates().count(state)){
190 final = true;
191 }
192
193 if(initial || final) {
194 out << "\\node[Nmarks=";
195 if(initial){
196 out << "i";
197 }
198 if(final){
199 out << "r";
200 }
201 out<<"](";
202 } else {
203 out <<"\\node(";
204 }
205
206 out << state;
207 out << ")(,){";
208 out << state;
209 out << "}\n";
210 }
211
212 transitions(a, out);
213 out << "\\end{center}\n";
214 out << "\\end{picture}\n";
215}
216
217template < class SymbolType, class StateType >
219 out << "\\begin{center}\n";
220 out << "\\begin{picture}(,)(,)\n";
221
222 for (auto& state : a.getStates()) {
223 bool initial = false;
224 bool final = false;
225
226 if(a.getInitialStates().count(state)){
227 initial = true;
228 }
229 if(a.getFinalStates().count(state)){
230 final = true;
231 }
232
233 if(initial || final) {
234 out << "\\node[Nmarks=";
235 if(initial){
236 out << "i";
237 }
238 if(final){
239 out << "r";
240 }
241 out<<"](";
242 } else {
243 out <<"\\node(";
244 }
245
246 out << state;
247 out << ")(,){";
248 out << state;
249 out << "}\n";
250 }
251
252 transitions(a, out);
253 out << "\\end{center}\n";
254 out << "\\end{picture}\n";
255}
256
257template < class SymbolType, class StateType >
259 out << "\\begin{center}\n";
260 out << "\\begin{picture}(,)(,)\n";
261
262 for (auto& state : a.getStates()) {
263 bool initial = false;
264 bool final = false;
265
266 if(a.getInitialState() == state){
267 initial = true;
268 }
269 if(a.getFinalStates().count(state)){
270 final = true;
271 }
272
273 if(initial || final) {
274 out << "\\node[Nmarks=";
275 if(initial){
276 out << "i";
277 }
278 if(final){
279 out << "r";
280 }
281 out<<"](";
282 } else {
283 out <<"\\node(";
284 }
285
286 out << state;
287 out << ")(,){";
288 out << state;
289 out << "}\n";
290 }
291
292 transitions(a, out);
293 out << "\\end{center}\n";
294 out << "\\end{picture}\n";
295}
296
297template < class SymbolType, class StateType >
299 out << "\\begin{center}\n";
300 out << "\\begin{picture}(,)(,)\n";
301
302 for (auto& state : a.getStates()) {
303 bool initial = false;
304 bool final = false;
305
306 if(a.getInitialState() == state){
307 initial = true;
308 }
309 if(a.getFinalStates().count(state)){
310 final = true;
311 }
312
313 if(initial || final) {
314 out << "\\node[Nmarks=";
315 if(initial){
316 out << "i";
317 }
318 if(final){
319 out << "r";
320 }
321 out<<"](";
322 } else {
323 out <<"\\node(";
324 }
325
326 out << state;
327 out << ")(,){";
328 out << state;
329 out << "}\n";
330 }
331
332 transitions(a, out);
333 out << "\\end{center}\n";
334 out << "\\end{picture}\n";
335}
336
337template < class SymbolType, class StateType >
339 out << "\\begin{center}\n";
340 out << "\\begin{picture}(,)(,)\n";
341
342 for (auto& state : a.getStates()) {
343 bool initial = false;
344 bool final = false;
345
346 if(a.getInitialState() == state){
347 initial = true;
348 }
349 if(a.getFinalStates().count(state)){
350 final = true;
351 }
352
353 if(initial || final) {
354 out << "\\node[Nmarks=";
355 if(initial){
356 out << "i";
357 }
358 if(final){
359 out << "r";
360 }
361 out<<"](";
362 } else {
363 out <<"\\node(";
364 }
365
366 out << state;
367 out << ")(,){";
368 out << state;
369 out << "}\n";
370 }
371
372 transitions(a, out);
373 out << "\\end{center}\n";
374 out << "\\end{picture}\n";
375}
376
377template < class SymbolType, class StateType >
379 out << "\\begin{center}\n";
380 out << "\\begin{picture}(,)(,)\n";
381
382 for (auto& state : a.getStates()) {
383 bool initial = false;
384 bool final = false;
385
386 if(a.getInitialState() == state){
387 initial = true;
388 }
389 if(a.getFinalStates().count(state)){
390 final = true;
391 }
392
393 if(initial || final) {
394 out << "\\node[Nmarks=";
395 if(initial){
396 out << "i";
397 }
398 if(final){
399 out << "r";
400 }
401 out<<"](";
402 } else {
403 out <<"\\node(";
404 }
405
406 out << state;
407 out << ")(,){";
408 out << state;
409 out << "}\n";
410 }
411
412 transitions(a, out);
413 out << "\\end{center}\n";
414 out << "\\end{picture}\n";
415}
416
417template < class SymbolType, class StateType >
419 //TODO
420}
421
422template < class SymbolType, class StateType >
424 //TODO
425}
426
427template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
429 out << "\\begin{center}\n";
430 out << "\\begin{picture}(,)(,)\n";
431
432 for (auto& state : a.getStates()) {
433 bool initial = false;
434 bool final = false;
435
436 if(a.getInitialState() == state) {
437 initial = true;
438 }
439 if(a.getFinalStates().count(state)) {
440 final = true;
441 }
442
443 if(initial || final) {
444 out << "\\node[Nmarks=";
445 if(initial){
446 out << "i";
447 }
448 if(final){
449 out << "r";
450 }
451 out<<"](";
452 } else {
453 out <<"\\node(";
454 }
455
456 out << state;
457 out << ")(,){";
458 out << state;
459 out << "}\n";
460 }
461
462 transitions(a, out);
463 out << "\\end{center}\n";
464 out << "\\end{picture}\n";
465}
466
467template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
469 out << "\\begin{center}\n";
470 out << "\\begin{picture}(,)(,)\n";
471
472 for (auto& state : a.getStates()) {
473 bool initial = false;
474 bool final = false;
475
476 if(a.getInitialState() == state) {
477 initial = true;
478 }
479 if(a.getFinalStates().count(state)){
480 final = true;
481 }
482
483 if(initial || final) {
484 out << "\\node[Nmarks=";
485 if(initial){
486 out << "i";
487 }
488 if(final){
489 out << "r";
490 }
491 out<<"](";
492 } else {
493 out <<"\\node(";
494 }
495
496 out << state;
497 out << ")(,){";
498 out << state;
499 out << "}\n";
500 }
501
502 transitions(a, out);
503 out << "\\end{center}\n";
504 out << "\\end{picture}\n";
505}
506
507template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
509 out << "\\begin{center}\n";
510 out << "\\begin{picture}(,)(,)\n";
511
512 for (auto& state : a.getStates()) {
513 bool initial = false;
514 bool final = false;
515
516 if(a.getInitialState() == state){
517 initial = true;
518 }
519 if(a.getFinalStates().count(state)){
520 final = true;
521 }
522
523 if(initial || final) {
524 out << "\\node[Nmarks=";
525 if(initial){
526 out << "i";
527 }
528 if(final){
529 out << "r";
530 }
531 out<<"](";
532 } else {
533 out <<"\\node(";
534 }
535
536 out << state;
537 out << ")(,){";
538 out << state;
539 out << "}\n";
540 }
541
542 transitions(a, out);
543 out << "\\end{center}\n";
544 out << "\\end{picture}\n";
545}
546
547template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
549 out << "\\begin{center}\n";
550 out << "\\begin{picture}(,)(,)\n";
551
552 for (auto& state : a.getStates()) {
553 bool initial = false;
554 bool final = false;
555
556 if(a.getInitialState() == state){
557 initial = true;
558 }
559 if(a.getFinalStates().count(state)){
560 final = true;
561 }
562
563 if(initial || final) {
564 out << "\\node[Nmarks=";
565 if(initial){
566 out << "i";
567 }
568 if(final){
569 out << "r";
570 }
571 out<<"](";
572 } else {
573 out <<"\\node(";
574 }
575
576 out << state;
577 out << ")(,){";
578 out << state;
579 out << "}\n";
580 }
581
582 transitions(a, out);
583 out << "\\end{center}\n";
584 out << "\\end{picture}\n";
585}
586
587template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
589 out << "\\begin{center}\n";
590 out << "\\begin{picture}(,)(,)\n";
591
592 for (auto& state : a.getStates()) {
593 bool initial = false;
594 bool final = false;
595
596 if(a.getInitialState() == state){
597 initial = true;
598 }
599 if(a.getFinalStates().count(state)){
600 final = true;
601 }
602
603 if(initial || final) {
604 out << "\\node[Nmarks=";
605 if(initial){
606 out << "i";
607 }
608 if(final){
609 out << "r";
610 }
611 out<<"](";
612 } else {
613 out <<"\\node(";
614 }
615
616 out << state;
617 out << ")(,){";
618 out << state;
619 out << "}\n";
620 }
621
622 transitions(a, out);
623 out << "\\end{center}\n";
624 out << "\\end{picture}\n";
625}
626
627template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
629 out << "\\begin{center}\n";
630 out << "\\begin{picture}(,)(,)\n";
631
632 for (auto& state : a.getStates()) {
633 bool initial = false;
634 bool final = false;
635
636 if(a.getInitialStates().count(state)){
637 initial = true;
638 }
639 if(a.getFinalStates().count(state)){
640 final = true;
641 }
642
643 if(initial || final) {
644 out << "\\node[Nmarks=";
645 if(initial){
646 out << "i";
647 }
648 if(final){
649 out << "r";
650 }
651 out<<"](";
652 } else {
653 out <<"\\node(";
654 }
655
656 out << state;
657 out << ")(,){";
658 out << state;
659 out << "}\n";
660 }
661
662 transitions(a, out);
663 out << "\\end{center}\n";
664 out << "\\end{picture}\n";
665}
666
667template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
669 out << "\\begin{center}\n";
670 out << "\\begin{picture}(,)(,)\n";
671
672 for (auto& state : a.getStates()) {
673 bool initial = false;
674 bool final = false;
675
676 if(a.getInitialState() == state){
677 initial = true;
678 }
679 if(a.getFinalStates().count(state)){
680 final = true;
681 }
682
683 if(initial || final) {
684 out << "\\node[Nmarks=";
685 if(initial){
686 out << "i";
687 }
688 if(final){
689 out << "r";
690 }
691 out<<"](";
692 } else {
693 out <<"\\node(";
694 }
695
696 out << state;
697 out << ")(,){";
698 out << state;
699 out << "}\n";
700 }
701
702 transitions(a, out);
703 out << "\\end{center}\n";
704 out << "\\end{picture}\n";
705}
706
707template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
709 out << "\\begin{center}\n";
710 out << "\\begin{picture}(,)(,)\n";
711
712 for (auto& state : a.getStates()) {
713 bool initial = false;
714 bool final = false;
715
716 if(a.getInitialStates().count(state)){
717 initial = true;
718 }
719 if(a.getFinalStates().count(state)){
720 final = true;
721 }
722
723 if(initial || final) {
724 out << "\\node[Nmarks=";
725 if(initial){
726 out << "i";
727 }
728 if(final){
729 out << "r";
730 }
731 out<<"](";
732 } else {
733 out <<"\\node(";
734 }
735
736 out << state;
737 out << ")(,){";
738 out << state;
739 out << "}\n";
740 }
741
742 transitions(a, out);
743 out << "\\end{center}\n";
744 out << "\\end{picture}\n";
745}
746
747template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
749 out << "\\begin{center}\n";
750 out << "\\begin{picture}(,)(,)\n";
751
752 for (auto& state : a.getStates()) {
753 bool initial = false;
754 bool final = false;
755
756 if(a.getInitialState() == state){
757 initial = true;
758 }
759 if(a.getFinalStates().count(state)){
760 final = true;
761 }
762
763 if(initial || final) {
764 out << "\\node[Nmarks=";
765 if(initial){
766 out << "i";
767 }
768 if(final){
769 out << "r";
770 }
771 out<<"](";
772 } else {
773 out <<"\\node(";
774 }
775
776 out << state;
777 out << ")(,){";
778 out << state;
779 out << "}\n";
780 }
781
782 transitions(a, out);
783 out << "\\end{center}\n";
784 out << "\\end{picture}\n";
785}
786
787template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
789 out << "\\begin{center}\n";
790 out << "\\begin{picture}(,)(,)\n";
791
792 for (auto& state : a.getStates()) {
793 bool initial = false;
794 bool final = false;
795
796 if(a.getInitialState() == state){
797 initial = true;
798 }
799 if(a.getFinalStates().count(state)){
800 final = true;
801 }
802
803 if(initial || final) {
804 out << "\\node[Nmarks=";
805 if(initial){
806 out << "i";
807 }
808 if(final){
809 out << "r";
810 }
811 out<<"](";
812 } else {
813 out <<"\\node(";
814 }
815
816 out << state;
817 out << ")(,){";
818 out << state;
819 out << "}\n";
820 }
821
822 transitions(a, out);
823 out << "\\end{center}\n";
824 out << "\\end{picture}\n";
825}
826
827template < class SymbolType, class StateType >
829 out << "\\begin{center}\n";
830 out << "\\begin{picture}(,)(,)\n";
831
832 for (auto& state : a.getStates()) {
833 bool initial = false;
834 bool final = false;
835
836 if(a.getInitialState() == state){
837 initial = true;
838 }
839 if(a.getFinalStates().count(state)){
840 final = true;
841 }
842
843 if(initial || final) {
844 out << "\\node[Nmarks=";
845 if(initial){
846 out << "i";
847 }
848 if(final){
849 out << "r";
850 }
851 out<<"](";
852 } else {
853 out <<"\\node(";
854 }
855
856 out << state;
857 out << ")(,){";
858 out << state;
859 out << "}\n";
860 }
861
862 transitions(a, out);
863 out << "\\end{center}\n";
864 out << "\\end{picture}\n";
865}
866
867template< class SymbolType >
868std::string GasTexConverter::getStackSymbols(const ext::vector<SymbolType>& stackSymbols) {
869 if (stackSymbols.empty ( )) {
870 return "$\\varepsilon$";
871 }
872
873 std::string symbols = "";
874 int i=0;
875 for (const SymbolType & symbol : stackSymbols) {
876 if(i++ !=0) {
877 symbols +=" ";
878 }
879 symbols += replace ( factory::StringDataFactory::toString ( symbol ), "\"", "\\\"" );
880 }
881 return symbols;
882}
883
884template<class SymbolType, class StateType>
885void GasTexConverter::transitions(const automaton::EpsilonNFA < SymbolType, StateType > & fsm, ext::ostream& out) {
886 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
887 for (const auto& transition : fsm.getTransitions()) {
888 std::pair<std::string, std::string> key(replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
889
890 std::string symbol;
891 if (transition.first.second.is_epsilon()) {
892 symbol = "$\\varepsilon$";
893 } else {
894 symbol = replace ( factory::StringDataFactory::toString ( transition.first.second.getSymbol ( ) ), "\"", "\\\"" );
895 }
896
897 auto mapIterator = transitionMap.find(key);
898 if (mapIterator == transitionMap.end()) {
899 transitionMap.insert(make_pair(key, symbol));
900 } else {
901 mapIterator->second += ", " + symbol;
902 }
903 }
904 printTransitionMap(transitionMap, out);
905}
906
907template<class SymbolType, class StateType>
908void GasTexConverter::transitions(const automaton::MultiInitialStateNFA < SymbolType, StateType >& fsm, ext::ostream& out) {
909 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
910 for (const auto& transition : fsm.getTransitions()) {
911 std::pair<std::string, std::string> key(replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
912
913 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
914
915 auto mapIterator = transitionMap.find(key);
916 if (mapIterator == transitionMap.end()) {
917 transitionMap.insert(make_pair(key, symbol));
918 } else {
919 mapIterator->second += ", " + symbol;
920 }
921 }
922 printTransitionMap(transitionMap, out);
923}
924
925template<class SymbolType, class StateType>
926void GasTexConverter::transitions(const automaton::NFA < SymbolType, StateType > & fsm, ext::ostream& out) {
927 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
928 for (const auto& transition : fsm.getTransitions()) {
929 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
930
931 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
932
933 auto mapIterator = transitionMap.find(key);
934 if (mapIterator == transitionMap.end()) {
935 transitionMap.insert(make_pair(key, symbol));
936 } else {
937 mapIterator->second += ", " + symbol;
938 }
939 }
940 printTransitionMap(transitionMap, out);
941}
942
943template<class SymbolType, class StateType>
944void GasTexConverter::transitions(const automaton::DFA < SymbolType, StateType > & fsm, ext::ostream& out) {
945 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
946 for (const auto& transition : fsm.getTransitions()) {
947 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
948
949 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
950
951 auto mapIterator = transitionMap.find(key);
952 if (mapIterator == transitionMap.end()) {
953 transitionMap.insert(make_pair(key, symbol));
954 } else {
955 mapIterator->second += ", " + symbol;
956 }
957 }
958 printTransitionMap(transitionMap, out);
959}
960
961template<class SymbolType, class StateType>
962void GasTexConverter::transitions(const automaton::ExtendedNFA < SymbolType, StateType > & fsm, ext::ostream& out) {
963 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
964
965 for (const auto& transition : fsm.getTransitions()) {
966 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
967
968 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
969
970 auto mapIterator = transitionMap.find(key);
971 if (mapIterator == transitionMap.end()) {
972 transitionMap.insert(make_pair(key, symbol));
973 } else {
974 mapIterator->second += ", " + symbol;
975 }
976 }
977 printTransitionMap(transitionMap, out);
978}
979
980template<class SymbolType, class StateType>
981void GasTexConverter::transitions(const automaton::CompactNFA < SymbolType, StateType > & fsm, ext::ostream& out) {
982 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
983
984 for (const auto& transition : fsm.getTransitions()) {
985 std::pair<std::string, std::string> key(replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
986
987 std::string symbol = replace ( factory::StringDataFactory::toString ( string::stringFrom(transition.first.second )), "\"", "\\\"" );
988
989 auto mapIterator = transitionMap.find(key);
990 if (mapIterator == transitionMap.end()) {
991 transitionMap.insert(make_pair(key, symbol));
992 } else {
993 mapIterator->second += ", " + symbol;
994 }
995 }
996 printTransitionMap(transitionMap, out);
997}
998
999template<class SymbolType, class StateType>
1000void GasTexConverter::transitions(const automaton::NFTA < SymbolType, StateType > &, ext::ostream&) {
1001 //TODO
1002}
1003
1004template<class SymbolType, class StateType>
1005void GasTexConverter::transitions(const automaton::DFTA < SymbolType, StateType > &, ext::ostream&) {
1006 //TODO
1007}
1008
1009template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
1010void GasTexConverter::transitions(const automaton::DPDA < InputSymbolType, PushdownStoreSymbolType, StateType > & pda, ext::ostream& out) {
1011 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1012
1013 for (const auto& transition : pda.getTransitions()) {
1014 std::pair<std::string, std::string> key(replace ( factory::StringDataFactory::toString ( std::get<0>(transition.first ) ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second.first ), "\"", "\\\"" ) );
1015 auto mapIterator = transitionMap.find(key);
1016
1017 std::string symbol;
1018 if (std::get<1>(transition.first).is_epsilon ( ) ) {
1019 symbol = "$\\varepsilon;$";
1020 } else {
1021 symbol = replace ( factory::StringDataFactory::toString ( std::get<1>(transition.first ).getSymbol ( ) ), "\"", "\\\"" );
1022 }
1023
1024 symbol += "|";
1025
1026 symbol += getStackSymbols(std::get<2>(transition.first));
1027 symbol += "\\rarrow";
1028 symbol += getStackSymbols(transition.second.second);
1029
1030 if (mapIterator == transitionMap.end()) {
1031 transitionMap.insert(std::make_pair(key, symbol));
1032 } else {
1033 mapIterator->second += "; " + symbol;
1034 }
1035 }
1036
1037 printTransitionMap(transitionMap, out);
1038}
1039
1040template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
1042 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1043
1044 for (const auto& transition : pda.getTransitions()) {
1045 std::pair<std::string, std::string> key(replace ( factory::StringDataFactory::toString ( std::get<0>(transition.first ) ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second.first ), "\"", "\\\"" ) );
1046 auto mapIterator = transitionMap.find(key);
1047
1048 std::string symbol;
1049 if (std::get<1>(transition.first).is_epsilon ( )) {
1050 symbol = "$\\varepsilon;$";
1051 } else {
1052 symbol = replace ( factory::StringDataFactory::toString ( std::get<1>(transition.first ).getSymbol ( )), "\"", "\\\"" );
1053 }
1054
1055 symbol += "|";
1056
1057 symbol += replace ( factory::StringDataFactory::toString ( std::get<2>(transition.first )), "\"", "\\\"" );
1058 symbol += "\\rarrow";
1059 symbol += getStackSymbols(transition.second.second);
1060
1061 if (mapIterator == transitionMap.end()) {
1062 transitionMap.insert(std::make_pair(key, symbol));
1063 } else {
1064 mapIterator->second += "; " + symbol;
1065 }
1066 }
1067
1068 printTransitionMap(transitionMap, out);
1069}
1070
1071template<class SymbolType, class PushdownStoreSymbolType, class StateType>
1073 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1074
1075 const auto& symbolToPDSOperation = pda.getPushdownStoreOperations();
1076 for (const auto& transition : pda.getTransitions()) {
1077 const auto& pop = symbolToPDSOperation.find(std::get<1>(transition.first))->second.first;
1078 const auto& push = symbolToPDSOperation.find(std::get<1>(transition.first))->second.second;
1079
1080 const auto& to = transition.second;
1081 std::pair<std::string, std::string> key(replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( to ), "\"", "\\\"" ) );
1082 auto mapIterator = transitionMap.find(key);
1083
1084 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
1085
1086 symbol += "|";
1087
1088 symbol += getStackSymbols(pop);
1089 symbol += "\\rarrow";
1090 symbol += getStackSymbols(push);
1091
1092 if (mapIterator == transitionMap.end()) {
1093 transitionMap.insert(std::make_pair(key, symbol));
1094 } else {
1095 mapIterator->second += "; " + symbol;
1096 }
1097 }
1098
1099 printTransitionMap(transitionMap, out);
1100}
1101
1102template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
1104 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1105
1106 const auto& symbolToPDSOperation = pda.getPushdownStoreOperations();
1107 for (const auto& transition : pda.getTransitions()) {
1108 const auto& pop = symbolToPDSOperation.find(std::get<1>(transition.first))->second.first;
1109 const auto& push = symbolToPDSOperation.find(std::get<1>(transition.first))->second.second;
1110
1111 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
1112 auto mapIterator = transitionMap.find(key);
1113
1114 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
1115
1116 symbol += "|";
1117
1118 symbol += getStackSymbols(pop);
1119 symbol += "\\rarrow";
1120 symbol += getStackSymbols(push);
1121
1122 if (mapIterator == transitionMap.end()) {
1123 transitionMap.insert(std::make_pair(key, symbol));
1124 } else {
1125 mapIterator->second += "; " + symbol;
1126 }
1127 }
1128
1129 printTransitionMap(transitionMap, out);
1130}
1131
1132template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
1134 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1135
1136 for (const auto& transition : pda.getCallTransitions()) {
1137 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second.first ), "\"", "\\\"" ) );
1138 auto mapIterator = transitionMap.find(key);
1139
1140 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
1141
1142 symbol += "|";
1143
1144 symbol += "$\\varepsilon;$";
1145 symbol += "\\rarrow";
1146 symbol += replace ( factory::StringDataFactory::toString ( transition.second.second ), "\"", "\\\"" );
1147
1148 if (mapIterator == transitionMap.end()) {
1149 transitionMap.insert(std::make_pair(key, symbol));
1150 } else {
1151 mapIterator->second += "; " + symbol;
1152 }
1153 }
1154
1155 for (const auto& transition : pda.getReturnTransitions()) {
1156 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( std::get<0>(transition.first ) ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
1157 auto mapIterator = transitionMap.find(key);
1158
1159 std::string symbol = replace ( factory::StringDataFactory::toString ( std::get<1>(transition.first )), "\"", "\\\"" );
1160
1161 symbol += "|";
1162
1163 symbol += replace ( factory::StringDataFactory::toString ( std::get<2>(transition.first )), "\"", "\\\"" );
1164 symbol += "\\rarrow";
1165 symbol += "$\\varepsilon;$";
1166
1167 if (mapIterator == transitionMap.end()) {
1168 transitionMap.insert(std::make_pair(key, symbol));
1169 } else {
1170 mapIterator->second += "; " + symbol;
1171 }
1172 }
1173
1174 for (const auto& transition : pda.getLocalTransitions()) {
1175 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
1176 auto mapIterator = transitionMap.find(key);
1177
1178 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
1179
1180 symbol += "|";
1181
1182 symbol += "$\\varepsilon;$";
1183 symbol += "\\rarrow";
1184 symbol += "$\\varepsilon;$";
1185
1186 if (mapIterator == transitionMap.end()) {
1187 transitionMap.insert(std::make_pair(key, symbol));
1188 } else {
1189 mapIterator->second += "; " + symbol;
1190 }
1191 }
1192
1193 printTransitionMap(transitionMap, out);
1194}
1195
1196template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
1198 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1199
1200 for (const auto& transition : pda.getCallTransitions()) {
1201 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second.first ), "\"", "\\\"" ) );
1202 auto mapIterator = transitionMap.find(key);
1203
1204 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
1205
1206 symbol += "|";
1207
1208 symbol += "$\\varepsilon;$";
1209 symbol += "\\rarrow";
1210 symbol += replace ( factory::StringDataFactory::toString ( transition.second.second ), "\"", "\\\"" );
1211
1212 if (mapIterator == transitionMap.end()) {
1213 transitionMap.insert(std::make_pair(key, symbol));
1214 } else {
1215 mapIterator->second += "; " + symbol;
1216 }
1217 }
1218
1219 for (const auto& transition : pda.getReturnTransitions()) {
1220 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( std::get<0>(transition.first ) ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
1221 auto mapIterator = transitionMap.find(key);
1222
1223 std::string symbol = replace ( factory::StringDataFactory::toString ( std::get<1>(transition.first )), "\"", "\\\"" );
1224
1225 symbol += "|";
1226
1227 symbol += replace ( factory::StringDataFactory::toString ( std::get<2>(transition.first )), "\"", "\\\"" );
1228 symbol += "\\rarrow";
1229 symbol += "$\\varepsilon;$";
1230
1231 if (mapIterator == transitionMap.end()) {
1232 transitionMap.insert(std::make_pair(key, symbol));
1233 } else {
1234 mapIterator->second += "; " + symbol;
1235 }
1236 }
1237
1238 for (const auto& transition : pda.getLocalTransitions()) {
1239 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
1240 auto mapIterator = transitionMap.find(key);
1241
1242 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
1243
1244 symbol += "|";
1245
1246 symbol += "$\\varepsilon;$";
1247 symbol += "\\rarrow";
1248 symbol += "$\\varepsilon;$";
1249
1250 if (mapIterator == transitionMap.end()) {
1251 transitionMap.insert(std::make_pair(key, symbol));
1252 } else {
1253 mapIterator->second += "; " + symbol;
1254 }
1255 }
1256
1257 printTransitionMap(transitionMap, out);
1258}
1259
1260template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
1262 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1263
1264 for (const auto& transition : pda.getCallTransitions()) {
1265 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second.first ), "\"", "\\\"" ) );
1266 auto mapIterator = transitionMap.find(key);
1267
1268 std::string symbol;
1269 if(transition.first.second.is_epsilon ( ))
1270 symbol = "$\\varepsilon;$";
1271 else
1272 symbol = replace ( factory::StringDataFactory::toString ( transition.first.second.getSymbol ( )), "\"", "\\\"" );
1273
1274 symbol += "|";
1275
1276 symbol += "$\\varepsilon;$";
1277 symbol += "\\rarrow";
1278 symbol += replace ( factory::StringDataFactory::toString ( transition.second.second ), "\"", "\\\"" );
1279
1280 if (mapIterator == transitionMap.end()) {
1281 transitionMap.insert(std::make_pair(key, symbol));
1282 } else {
1283 mapIterator->second += "; " + symbol;
1284 }
1285 }
1286
1287 for (const auto& transition : pda.getReturnTransitions()) {
1288 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( std::get<0>(transition.first ) ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
1289 auto mapIterator = transitionMap.find(key);
1290
1291 std::string symbol;
1292 if(std::get<1>(transition.first).is_epsilon ( ))
1293 symbol = "$\\varepsilon;$";
1294 else
1295 symbol = replace ( factory::StringDataFactory::toString ( std::get<1>(transition.first ).getSymbol ( )), "\"", "\\\"" );
1296
1297 symbol += "|";
1298
1299 symbol += replace ( factory::StringDataFactory::toString ( std::get<2>(transition.first )), "\"", "\\\"" );
1300 symbol += "\\rarrow";
1301 symbol += "$\\varepsilon;$";
1302
1303 if (mapIterator == transitionMap.end()) {
1304 transitionMap.insert(std::make_pair(key, symbol));
1305 } else {
1306 mapIterator->second += "; " + symbol;
1307 }
1308 }
1309
1310 for (const auto& transition : pda.getLocalTransitions()) {
1311 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
1312 auto mapIterator = transitionMap.find(key);
1313
1314 std::string symbol;
1315 if(transition.first.second.is_epsilon ( ))
1316 symbol = "$\\varepsilon;$";
1317 else
1318 symbol = replace ( factory::StringDataFactory::toString ( transition.first.second.getSymbol ( )), "\"", "\\\"" );
1319
1320 symbol += "|";
1321
1322 symbol += "$\\varepsilon;$";
1323 symbol += "\\rarrow";
1324 symbol += "$\\varepsilon;$";
1325
1326 if (mapIterator == transitionMap.end()) {
1327 transitionMap.insert(std::make_pair(key, symbol));
1328 } else {
1329 mapIterator->second += "; " + symbol;
1330 }
1331 }
1332
1333 printTransitionMap(transitionMap, out);
1334}
1335
1336template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
1338 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1339
1340 for (const auto& transition : pda.getCallTransitions()) {
1341 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second.first ), "\"", "\\\"" ) );
1342 auto mapIterator = transitionMap.find(key);
1343
1344 std::string symbol;
1345 if(transition.first.second.is_epsilon ( ))
1346 symbol = "$\\varepsilon;$";
1347 else
1348 symbol = replace ( factory::StringDataFactory::toString ( transition.first.second.getSymbol ( )), "\"", "\\\"" );
1349
1350 symbol += "|";
1351
1352 symbol += "$\\varepsilon;$";
1353 symbol += "\\rarrow";
1354 symbol += replace ( factory::StringDataFactory::toString ( transition.second.second ), "\"", "\\\"" );
1355
1356 if (mapIterator == transitionMap.end()) {
1357 transitionMap.insert(std::make_pair(key, symbol));
1358 } else {
1359 mapIterator->second += "; " + symbol;
1360 }
1361 }
1362
1363 for (const auto& transition : pda.getReturnTransitions()) {
1364 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( std::get<0>(transition.first ) ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
1365 auto mapIterator = transitionMap.find(key);
1366
1367 std::string symbol;
1368 if(std::get<1>(transition.first).is_epsilon ( ))
1369 symbol = "$\\varepsilon;$";
1370 else
1371 symbol = replace ( factory::StringDataFactory::toString ( std::get<1>(transition.first ).getSymbol ( )), "\"", "\\\"" );
1372
1373 symbol += "|";
1374
1375 symbol += replace ( factory::StringDataFactory::toString ( std::get<2>(transition.first )), "\"", "\\\"" );
1376 symbol += "\\rarrow";
1377 symbol += "$\\varepsilon;$";
1378
1379 if (mapIterator == transitionMap.end()) {
1380 transitionMap.insert(std::make_pair(key, symbol));
1381 } else {
1382 mapIterator->second += "; " + symbol;
1383 }
1384 }
1385
1386 for (const auto& transition : pda.getLocalTransitions()) {
1387 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second ), "\"", "\\\"" ) );
1388 auto mapIterator = transitionMap.find(key);
1389
1390 std::string symbol;
1391 if(transition.first.second.is_epsilon ( ))
1392 symbol = "$\\varepsilon;$";
1393 else
1394 symbol = replace ( factory::StringDataFactory::toString ( transition.first.second.getSymbol ( )), "\"", "\\\"" );
1395
1396 symbol += "|";
1397
1398 symbol += "$\\varepsilon;$";
1399 symbol += "\\rarrow";
1400 symbol += "$\\varepsilon;$";
1401
1402 if (mapIterator == transitionMap.end()) {
1403 transitionMap.insert(std::make_pair(key, symbol));
1404 } else {
1405 mapIterator->second += "; " + symbol;
1406 }
1407 }
1408
1409 printTransitionMap(transitionMap, out);
1410}
1411
1412template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
1413void GasTexConverter::transitions(const automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType > & pda, ext::ostream& out) {
1414 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1415
1416 for (const auto& transition : pda.getTransitions()) {
1417 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( std::get<0>(transition.first ) ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second.first ), "\"", "\\\"" ) );
1418 auto mapIterator = transitionMap.find(key);
1419
1420 std::string symbol;
1421 if (std::get<1>(transition.first).is_epsilon ( ) ) {
1422 symbol = "$\\varepsilon;$";
1423 } else {
1424 symbol = replace ( factory::StringDataFactory::toString ( std::get<1>(transition.first ).getSymbol ( ) ), "\"", "\\\"" );
1425 }
1426
1427 symbol += "|";
1428
1429 symbol += getStackSymbols(std::get<2>(transition.first));
1430 symbol += "\\rarrow";
1431 symbol += getStackSymbols(transition.second.second);
1432
1433 if (mapIterator == transitionMap.end()) {
1434 transitionMap.insert(std::make_pair(key, symbol));
1435 } else {
1436 mapIterator->second += "; " + symbol;
1437 }
1438 }
1439
1440 printTransitionMap(transitionMap, out);
1441}
1442
1443template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
1445 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1446
1447 for (const auto& transition : pda.getTransitions()) {
1448 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( std::get<0>(transition.first ) ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( transition.second.first ), "\"", "\\\"" ) );
1449 auto mapIterator = transitionMap.find(key);
1450
1451 std::string symbol;
1452 if (std::get<1>(transition.first).is_epsilon ( )) {
1453 symbol = "$\\varepsilon;$";
1454 } else {
1455 symbol = replace ( factory::StringDataFactory::toString ( std::get<1>(transition.first ).getSymbol ( )), "\"", "\\\"" );
1456 }
1457
1458 symbol += "|";
1459
1460 symbol += replace ( factory::StringDataFactory::toString ( std::get<2>(transition.first )), "\"", "\\\"" );
1461 symbol += "\\rarrow";
1462 symbol += getStackSymbols(transition.second.second);
1463
1464 if (mapIterator == transitionMap.end()) {
1465 transitionMap.insert(std::make_pair(key, symbol));
1466 } else {
1467 mapIterator->second += "; " + symbol;
1468 }
1469 }
1470
1471 printTransitionMap(transitionMap, out);
1472}
1473
1474template<class SymbolType, class StateType>
1475void GasTexConverter::transitions(const automaton::OneTapeDTM < SymbolType, StateType > & tm, ext::ostream& out) {
1476 ext::map<std::pair<std::string, std::string>, std::string> transitionMap;
1477
1478 for (auto& transition : tm.getTransitions()) {
1479 std::pair<std::string, std::string> key( replace ( factory::StringDataFactory::toString ( transition.first.first ), "\"", "\\\"" ), replace ( factory::StringDataFactory::toString ( std::get<0>(transition.second )), "\"", "\\\"" ));
1480 auto mapIterator = transitionMap.find(key);
1481
1482 std::string symbol = replace ( factory::StringDataFactory::toString ( transition.first.second ), "\"", "\\\"" );
1483 symbol += "/";
1484 symbol += replace ( factory::StringDataFactory::toString ( std::get<1>(transition.second )), "\"", "\\\"" );
1485 symbol += ",";
1486 switch(std::get<2>(transition.second)) {
1488 symbol += "$\\leftarrow$";
1489 break;
1491 symbol += "$\\rightarrow$";
1492 break;
1494 symbol += "$\\times$";
1495 break;
1496 default:
1497 throw exception::CommonException("Unexpected shift direction");
1498 }
1499
1500 if (mapIterator == transitionMap.end()) {
1501 transitionMap.insert(std::make_pair(key, symbol));
1502 } else {
1503 mapIterator->second += "; " + symbol;
1504 }
1505 }
1506
1507 printTransitionMap(transitionMap, out);
1508}
1509
1510} /* namespace convert */
1511
Compact nondeterministic finite automaton. Accepts regular languages. The automaton has a list of sym...
Definition: CompactNFA.h:78
const ext::set< StateType > & getFinalStates() const &
Definition: CompactNFA.h:232
const ext::multimap< ext::pair< StateType, ext::vector< SymbolType > >, StateType > & getTransitions() const &
Definition: CompactNFA.h:555
const ext::set< StateType > & getStates() const &
Definition: CompactNFA.h:183
const StateType & getInitialState() const &
Definition: CompactNFA.h:154
Deterministic finite automaton. Accepts regular languages.
Definition: DFA.h:71
const ext::set< StateType > & getFinalStates() const &
Definition: DFA.h:183
const ext::map< ext::pair< StateType, SymbolType >, StateType > & getTransitions() const &
Definition: DFA.h:473
const StateType & getInitialState() const &
Definition: DFA.h:105
const ext::set< StateType > & getStates() const &
Definition: DFA.h:134
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: DFTA.h:74
Deterministic pushdown automaton. Accepts subset of context free languages.
Definition: DPDA.h:78
const ext::set< StateType > & getStates() const &
Definition: DPDA.h:145
const ext::map< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, ext::vector< PushdownStoreSymbolType > >, ext::pair< StateType, ext::vector< PushdownStoreSymbolType > > > & getTransitions() const &
Definition: DPDA.h:682
const ext::set< StateType > & getFinalStates() const &
Definition: DPDA.h:194
const StateType & getInitialState() const &
Definition: DPDA.h:116
Epsilon nondeterministic finite automaton. Accepts regular languages.
Definition: EpsilonNFA.h:74
const ext::set< StateType > & getStates() const &
Definition: EpsilonNFA.h:158
const ext::set< StateType > & getFinalStates() const &
Definition: EpsilonNFA.h:207
const ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< SymbolType > >, StateType > & getTransitions() const &
Definition: EpsilonNFA.h:666
const StateType & getInitialState() const &
Definition: EpsilonNFA.h:129
Extended nondeterministic finite automaton. Accepts regular languages. The automaton has a regular ex...
Definition: ExtendedNFA.h:80
const StateType & getInitialState() const &
Definition: ExtendedNFA.h:156
const ext::multimap< ext::pair< StateType, regexp::UnboundedRegExpStructure< SymbolType > >, StateType > & getTransitions() const &
Definition: ExtendedNFA.h:581
const ext::set< StateType > & getStates() const &
Definition: ExtendedNFA.h:185
const ext::set< StateType > & getFinalStates() const &
Definition: ExtendedNFA.h:234
Deterministic input driven pushdown automaton. Accepts subset of context free languages.
Definition: InputDrivenDPDA.h:79
const ext::map< ext::pair< StateType, InputSymbolType >, StateType > & getTransitions() const &
Definition: InputDrivenDPDA.h:655
const ext::set< StateType > & getStates() const &
Definition: InputDrivenDPDA.h:160
const ext::set< StateType > & getFinalStates() const &
Definition: InputDrivenDPDA.h:209
const ext::map< InputSymbolType, ext::pair< ext::vector< PushdownStoreSymbolType >, ext::vector< PushdownStoreSymbolType > > > & getPushdownStoreOperations() const &
Definition: InputDrivenDPDA.h:604
const StateType & getInitialState() const &
Definition: InputDrivenDPDA.h:131
Nondeterministic input driven pushdown automaton. Accepts subset of context free languages.
Definition: InputDrivenNPDA.h:79
const ext::map< InputSymbolType, ext::pair< ext::vector< PushdownStoreSymbolType >, ext::vector< PushdownStoreSymbolType > > > & getPushdownStoreOperations() const &
Definition: InputDrivenNPDA.h:614
const ext::multimap< ext::pair< StateType, InputSymbolType >, StateType > & getTransitions() const &
Definition: InputDrivenNPDA.h:661
const ext::set< StateType > & getFinalStates() const &
Definition: InputDrivenNPDA.h:209
const StateType & getInitialState() const &
Definition: InputDrivenNPDA.h:131
const ext::set< StateType > & getStates() const &
Definition: InputDrivenNPDA.h:160
Nondeterministic finite automaton with multiple initial states. Accepts regular languages.
Definition: MultiInitialStateNFA.h:69
const ext::set< StateType > & getInitialStates() const &
Definition: MultiInitialStateNFA.h:117
const ext::set< StateType > & getStates() const &
Definition: MultiInitialStateNFA.h:166
const ext::multimap< ext::pair< StateType, SymbolType >, StateType > & getTransitions() const &
Definition: MultiInitialStateNFA.h:520
const ext::set< StateType > & getFinalStates() const &
Definition: MultiInitialStateNFA.h:215
Nondeterministic finite automaton. Accepts regular languages.
Definition: NFA.h:66
const ext::set< StateType > & getStates() const &
Definition: NFA.h:136
const StateType & getInitialState() const &
Definition: NFA.h:107
const ext::multimap< ext::pair< StateType, SymbolType >, StateType > & getTransitions() const &
Definition: NFA.h:484
const ext::set< StateType > & getFinalStates() const &
Definition: NFA.h:185
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: NFTA.h:72
Definition: NPDA.h:74
const ext::set< StateType > & getFinalStates() const &
Definition: NPDA.h:197
const StateType & getInitialState() const &
Definition: NPDA.h:119
const ext::set< StateType > & getStates() const &
Definition: NPDA.h:148
const ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, ext::vector< PushdownStoreSymbolType > >, ext::pair< StateType, ext::vector< PushdownStoreSymbolType > > > & getTransitions() const &
Definition: NPDA.h:644
Deterministic single tape turing machine. Accepts recursive languages.
Definition: OneTapeDTM.h:71
const StateType & getInitialState() const &
Definition: OneTapeDTM.h:108
const ext::set< StateType > & getFinalStates() const &
Definition: OneTapeDTM.h:186
const ext::map< ext::pair< StateType, SymbolType >, ext::tuple< StateType, SymbolType, Shift > > & getTransitions() const &
Definition: OneTapeDTM.h:526
const ext::set< StateType > & getStates() const &
Definition: OneTapeDTM.h:137
Deterministic real time height deterministic pushdown automaton. Accepts subset of context free langu...
Definition: RealTimeHeightDeterministicDPDA.h:89
const StateType & getInitialState() const &
Definition: RealTimeHeightDeterministicDPDA.h:149
const ext::map< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, ext::pair< StateType, PushdownStoreSymbolType > > & getCallTransitions() const &
Definition: RealTimeHeightDeterministicDPDA.h:1062
const ext::map< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, StateType > & getLocalTransitions() const &
Definition: RealTimeHeightDeterministicDPDA.h:1082
const ext::map< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, StateType > & getReturnTransitions() const &
Definition: RealTimeHeightDeterministicDPDA.h:1072
const ext::set< StateType > & getStates() const &
Definition: RealTimeHeightDeterministicDPDA.h:178
const ext::set< StateType > & getFinalStates() const &
Definition: RealTimeHeightDeterministicDPDA.h:227
Nondeterministic real time height deterministic pushdown automaton. Accepts subset of context free la...
Definition: RealTimeHeightDeterministicNPDA.h:76
const ext::set< StateType > & getInitialStates() const &
Definition: RealTimeHeightDeterministicNPDA.h:175
const ext::set< StateType > & getStates() const &
Definition: RealTimeHeightDeterministicNPDA.h:126
const ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, StateType > & getLocalTransitions() const &
Definition: RealTimeHeightDeterministicNPDA.h:1004
const ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, ext::pair< StateType, PushdownStoreSymbolType > > & getCallTransitions() const &
Definition: RealTimeHeightDeterministicNPDA.h:984
const ext::set< StateType > & getFinalStates() const &
Definition: RealTimeHeightDeterministicNPDA.h:224
const ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, StateType > & getReturnTransitions() const &
Definition: RealTimeHeightDeterministicNPDA.h:994
Deterministic pushdown automaton requiring a symbol pop from pushdown store on each transition use....
Definition: SinglePopDPDA.h:78
const StateType & getInitialState() const &
Definition: SinglePopDPDA.h:116
const ext::set< StateType > & getFinalStates() const &
Definition: SinglePopDPDA.h:194
const ext::set< StateType > & getStates() const &
Definition: SinglePopDPDA.h:145
const ext::map< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, ext::pair< StateType, ext::vector< PushdownStoreSymbolType > > > & getTransitions() const &
Definition: SinglePopDPDA.h:639
Definition: SinglePopNPDA.h:72
const StateType & getInitialState() const &
Definition: SinglePopNPDA.h:110
const ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, ext::pair< StateType, ext::vector< PushdownStoreSymbolType > > > & getTransitions() const &
Definition: SinglePopNPDA.h:617
const ext::set< StateType > & getStates() const &
Definition: SinglePopNPDA.h:139
const ext::set< StateType > & getFinalStates() const &
Definition: SinglePopNPDA.h:188
Deterministic visibly pushdown automaton. Accepts subset of context free languages.
Definition: VisiblyPushdownDPDA.h:86
const ext::map< ext::tuple< StateType, InputSymbolType, PushdownStoreSymbolType >, StateType > & getReturnTransitions() const &
Definition: VisiblyPushdownDPDA.h:899
const ext::map< ext::pair< StateType, InputSymbolType >, StateType > & getLocalTransitions() const &
Definition: VisiblyPushdownDPDA.h:909
const ext::set< StateType > & getFinalStates() const &
Definition: VisiblyPushdownDPDA.h:224
const ext::map< ext::pair< StateType, InputSymbolType >, ext::pair< StateType, PushdownStoreSymbolType > > & getCallTransitions() const &
Definition: VisiblyPushdownDPDA.h:889
const ext::set< StateType > & getStates() const &
Definition: VisiblyPushdownDPDA.h:175
const StateType & getInitialState() const &
Definition: VisiblyPushdownDPDA.h:146
Nondeterministic visibly pushdown automaton. Accepts subset of context free languages.
Definition: VisiblyPushdownNPDA.h:81
const ext::set< StateType > & getInitialStates() const &
Definition: VisiblyPushdownNPDA.h:131
const ext::set< StateType > & getStates() const &
Definition: VisiblyPushdownNPDA.h:180
const ext::multimap< ext::pair< StateType, InputSymbolType >, StateType > & getLocalTransitions() const &
Definition: VisiblyPushdownNPDA.h:884
const ext::set< StateType > & getFinalStates() const &
Definition: VisiblyPushdownNPDA.h:229
const ext::multimap< ext::tuple< StateType, InputSymbolType, PushdownStoreSymbolType >, StateType > & getReturnTransitions() const &
Definition: VisiblyPushdownNPDA.h:874
const ext::multimap< ext::pair< StateType, InputSymbolType >, ext::pair< StateType, PushdownStoreSymbolType > > & getCallTransitions() const &
Definition: VisiblyPushdownNPDA.h:864
Definition: GasTexConverter.h:49
static std::string convert(const T &automaton)
Definition: GasTexConverter.h:170
static void convert(ext::ostream &out, const automaton::DFA< SymbolType, StateType > &a)
Definition: GasTexConverter.h:298
Basic exception from which all other exceptions are derived.
Definition: CommonException.h:21
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
std::pair< iterator, bool > insert(const T &key, const R &value)
Insert variant with explicit key and value parameters.
Definition: map.hpp:118
auto end() &
Inherited behavior of end for non-const instance.
Definition: map.hpp:215
Definition: ostream.h:14
Definition: sstream.h:15
std::string str() const &
Definition: sstream.cpp:29
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
static std::string toString(const T &data)
Definition: StringDataFactory.hpp:89
int i
Definition: AllEpsilonClosure.h:118
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
Definition: ToGrammar.h:31
Definition: converterCommon.hpp:8
auto replace
Definition: converterCommon.hpp:19
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
string::LinearString< char > stringFrom(const std::string &string)
Definition: String.cpp:10