This commit is contained in:
Jonas_Jones 2022-12-23 03:10:28 +01:00
parent 4c6caa686a
commit 381e7dced0

29
task2_epi.txt Normal file
View file

@ -0,0 +1,29 @@
__author__ = "7987847, Werner, 7347119, Fajst, 7735965, Melikidze"
================================================================================================================
a) The context-free grammar generates words that consist of variables (V), which can be any lowercase letter from a to z,
and operators (O), which can be +, -, *, or /. These variables and operators are combined using parentheses (T).
Specifically, the grammar generates words by either replacing the start symbol T with a variable (V),
or by replacing T with an opening parenthesis followed by a combination of a T, an operator (O), and another T, followed by a closing parenthesis.
b) The word "(a + ((x - z) / y))" can be generated by the context-free grammar. One possible order of derivation rules to create this word is as follows:
T -> (TOT)
T -> V
O -> +
T -> (TOT)
T -> (TOT)
T -> V
O -> -
T -> V
O -> /
T -> V
The word "((p) + (o))" can also be generated by the context-free grammar. One possible order of derivation rules to create this word is as follows:
T -> (TOT)
T -> V
O -> +
T -> (TOT)
T -> V