Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

submit a .regex file with a regular expression defining the given language Use t

ID: 3594799 • Letter: S

Question

submit a .regex file with a regular expression defining the given language


Use the regular expression evaluator to test each regex: http://web.cs.ucdavis.edu/-doty automata/regex.html. Do not test them using the regular expression library of a programming language; typically these are more powerful and have many more features that are not available in the mathematical definition of regular expressions from the textbook. Only the special symbols CI are allowed, as well as "input alphabet" symbols: alphanumeric, and . and 0. r has at least three O's, y starts with 120 and ends in 21, and z contains the substring 011211

Explanation / Answer

S --> xyz
x --> (0|1|2)*000(0|1|2)*
y --> 120(0|1|2)*21
z --> (0|1|2)*011211(0|1|2)*

state 0 1 2 qxs qx0 qxs qxs qx0 qx00 qxs qxs qx00 qx000 qxs qxs qx000 qx000 qy1 qx000 qy1 qx000 qx000 qy12 qy12 qy120 qx000 qx000 qy120 qy120 qy120 qy2 qy2 qy120 qy21 qy120 qy21 qz0 qy21 qy21 qz0 qy21 qz01 qy21 qz01 qy21 qz011 qy21 qz011 qy21 qy21 qz0112 qz0112 qy21 qz01121 qy21 qz01121 qy21 qaccept qy21 qaccept qaccept qaccept qaccept