Give the regular expression, must include two binary operators and unary operato
ID: 3597544 • Letter: G
Question
Give the regular expression, must include two binary operators and unary operator, = symbol.
If you do not understand, please do not answer
Show step! please help!
7. 7 Question Consider boolean expressions: the constants are True and False, the boolean variable names start with a s followed by any number (including 0) of lower and upper case letters (thus $ is a valid name for a boolean variable), there are two boolean binary operators and and or and a unary operator not. The expressions can be parenthesized, and we will also have an assignment expression usi ng symbolGive the regular expression description (using the same notation as in Question 6) of all the tokens you will be using in Question 8.Explanation / Answer
Using the description of the regular expressions in the context, we can write any regular expression with 2 binary operators namely AND and OR and a unary operator NOT.
Consider the following operation:
$result = (($x and $y ) or $z) and (not $w)
Now say x=True, y=False, z=False, w=True
$result=((True and False) or False) and (not True)
= (False or false) and False
So $result = False
Similarly, other regular expressions can be evaluated.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.