pd_lang_k.h
Go to the documentation of this file.
1 /** @file pd_lang_k.h Test class to derive strings from pushdown automata */
2 
3 
4 /* Pushdown plugin for FAU Discrete Event Systems Library (libfaudes)
5 
6  Copyright (C) 2013 Stefan Jacobi, Sven Schneider, Anne-Kathrin Hess
7 
8 */
9 
10 
11 #ifndef FAUDES_PD_LANG_K_H
12 #define FAUDES_PD_LANG_K_H
13 
14 #include "corefaudes.h"
15 #include "pd_include.h"
16 
17 
18 namespace faudes {
19 
20 
21 /**
22 * This class is used to find all words that can be found when traversing a maximum of
23 * k transitions of a given generator. It is intended mainly for debugging purposes,
24 * not for finding whole languages.
25 *
26 * Note: length k can include "empty" (lambda) strings
27 *
28 *
29 *
30 *
31 * @ingroup PushdownPlugin
32 *
33 * @section Overview
34 * Overview
35 *
36 * @section Contents
37 * Contents
38 */
39 
41 
42  public:
43 
44  /**
45  * Constructor
46  *
47  * @param gen
48  * the generator
49  */
50  LangK(const PushdownGenerator& gen) : pd(gen) {};
51 
52  /**
53  * find all words that can be generated by traversing k transitions
54  *
55  * @param k
56  * number of transitions to traverse
57  * @param showStack
58  * show stack while traversing, defaults to false
59  */
60  std::set<std::string> FindLangK(uint k, bool showStack = false);
61 
62  /**
63  * Print the words that were found in the last execution of FindLangK
64  */
65  void PrintWords();
66 
67  private:
68 
69  /** storage for the words*/
70  std::set<std::string> words;
71  /** the generator*/
73  /** maximum word length*/
75 
76  /**
77  * Recursively traverse the generator and build new words until word length is k.
78  *
79  * @param i
80  * Index of the current state
81  * @param word
82  * current word
83  * @param stack
84  * current stack
85  * @param depth
86  * current length
87  * @param showStack
88  * indicator whether to print the stack or not
89  */
90  void Traverse(Idx i, std::string word, std::vector<Idx> stack, uint depth, bool showStack);
91 
92 };
93 
94 } // namespace faudes
95 
96 #endif

libFAUDES 2.28c --- 2016.09.30 --- c++ api documentaion by doxygen