Good Day all,
Assignment 2 is due in two days, and fortunately, I'm progressing fairly well. I got stumped on the is_regex function for a while, but once I found out how to split up / iterate through a regular expression, the rest of the solution came easy. Since we aren't being marked on efficiency, all_regex_permutations was defined fairly easy because some code Dan supplied in a pervious lecture. I just finished defining the build_regex_tree function, and now am currently stuck on the regex_match function. I'm having a difficult time matching a regex string with any star regex. For example:
Code:
>>> tree = StarTree(DotTree(RegexTree("1", []), RegexTree('0', [])))
>>> regex_match(tree, "1010101010")
True
>>> regex_match(tree, '1101')
False
I am having a hard time finding a way to implement the difference between the two given strings. I'm finding this the hardest part of the assignment..... What do you all think?
P.S. The link to the A2 outline slides, Dan put on the discussion board, have been very helpful!
No comments:
Post a Comment