Sunday, 23 March 2014

Regex Everything

    Last week's assignment required me to write the longest set of 4 functions that I ever had to write. It also required a ton a of recursion, and a lot of logic.

    The 4 different functions all required similar styles of recursion, but they also had essentially the same process. They all either recalled to themselves or a helper function, which then used a series of if statements to repeat the process. Essentially, the different functions all performed different concepts on either strings, or trees. The trees could be either binary or unary depending on their symbol. Binary tree symbols at '.' ,and '|'. The symbol for an unary tree is '*'.  Trees without any children are considered leaves. Leaves have a symbol of either '0', '1', '2', and 'e'.

    The 4 functions required me to decided whether a string was a valid regex, whether a string could be permeated to make a valid regex, to return a set of valid regexes, and to build a tree with regex inputs. Chronologically, the order makes sense, because you would call the previous function to complete the function being called.

No comments:

Post a Comment