(This is my first post here so do bear in mind if what I'm asking is seriously too much and that I should consider tackling this piece carefully one at a time, if my question is too specific, too broad, not focused down to a single problem, requiring significantly more info, or otherwise, please don't hesitate to comment down)
In C++, I'm currently in the process of doing Thompson's Construction in a certain way without using the regex header and I'm anxiously stuck on how to proceed and why,
Say I have the following String expression in which '.' is Concatenation, '|' is Union, and '*' is KleeneStar, we can assume the syntax is already checked beforehand, and that they can be read as:
a or
(a)|(b) or
(a).(b) or
((a)|(b)).(c) or
((c)|(d)).((a)|(b)) or
(a)* or
((a)*)|((b)*) or
The goal here is to extract, call, or read the string expression that would lay out a set of strings as its expected output resulting from their corresponding expression (note an empty string could be output as '_') in which:
a outputs {a}
(a)|(b) outputs {a, b}
(a).(b) outputs {ab}
((a)|(b)).(c) outputs {ac, bc}
((c)|(d)).((a)|(b)) outputs {ca, da, cb, db}
(a)* outputs {_, a, aa, aaa, aaaa, ...} (we can consider putting a limit here)
((a)*)|((b)*) outputs {_, a, b, aa, ab, ba, bb, aaa, aab, aba, abb, baa, bab, bba, bbb, ...} (we can consider putting a limit here)
I'm sure there's a better way to do this beforehand using algorithms, pseudo-code, parsing, and more, or that my lack of practice leaves me serious gaps in my coding knowledge to perform such a thing.
As of now, I'm seriously wondering a number of factors such as what functions to make, what recursion calls to make, pointers, stacks, vectors, where and when, etc., and that such a process can perhaps really stress the program to calculate ALL possibilities for whatever I'm achieving, say, matching an input string from a user to match the set of strings listed.
and that perhaps one of the posts I've looked over in forums wasn't fully read over enough to understand. I'm completely overwhelmed in my perspective and would like a walkthrough on what to do one step at a time, further guidance and assistance are seriously greatly appreciated. A complete walkthrough for any solutions or even your own codes posted would be of great help for me to learn. Any suggestions would really help. Again any critical terms that I've forgotten to mention or anything specific please post your comments, Thank you for your time.
EDIT: I've been told that what I'm suggesting can be quite concerning with the KleeneStar operator and that generating the output would may become nontrivial? I was wondering if setting an int limit would be possible or that could still seriously cause even more complications.