МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ
НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ “ЛЬВІВСЬКА ПОЛІТЕХНІКА”
ІНСТИТУТ ПРИКЛАДНОЇ МАТЕМАТИКИ ТА ФУНДАМЕНТАЛЬНИХ НАУК
КАФЕДРА ПРИКЛАДНОЇ МАТЕМАТИКИ
Розрахункова робота
з курсу Системного програмування
Початкова граматика:
Вибрана та перетворена граматика:
Будую відношення передування:
L(U)
R(U)
S
begin
.
O
O1, Z, M, P, U, i, if
O1, Z, M, P, U, V, I, I1, T, T1, K, i, c, )
O1
O1, Z, M, P, U, i, if
Z, M, P, U, V, I, I1, T, T1, K, i, c, )
Z
M, P, U, i, if
M, P, U, V, I, I1, T, T1, K, i, c, )
M
P, U, i, if
P, U, V, I, I1, T, T1, K, i, c, )
P
i
V, I, I1, T, T1, K, i, c, )
U
if
Z, M, P, U, V, I, I1, T, T1, K, i, c, )
Z1
Z, M, P, U, i, if
Z, M, P, U, V, I, I1, T, T1, K, i, c, )
V
I, I1, T, T1, K, i, c, (
I, I1, T, T1, K, i, c, )
I
I1, T, T1, K, i, c, (
I1, T, T1, K, i, c, )
I1
I1, T, T1, K, i, c, (
T, T1, K, i, c, )
T
T1, K, i, c, (
T1, K, i, c, )
T1
T1, K, i, c, (
K, i, c, )
K
i, c, (
i, c, )
S
O
O1
Z
M
P
U
Z1
V
I
I1
T
T1
K
begin
end
if
then
else
a
i
c
.
;
:=
>
<
+
-
*
(
)
S
O
=
O1
>
=
Z
>
>
>
M
>
>
>
P
>
>
>
U
>
>
>
Z1
=
V
>
=
>
>
=
I
>
>
>
>
=
=
>
I1
>
>
>
>
>
>
=
=
>
T
>
>
>
>
>
>
>
>
>
T1
>
>
>
=
>
>
>
>
>
=
>
K
>
>
>
>
>
>
>
>
>
>
>
begin
=
<
<
<
<
<
<
<
end
=
if
=
<
<
<
<
<
<
<
<
then
<
<
<
<
=
<
<
else
=
<
<
<
<
<
a
=
<
<
<
i
>
>
>
>
=
>
>
>
>
>
>
c
>
>
>
>
>
>
>
>
>
>
.
;
=
<
<
<
<
>
<
:=
=
<
<
<
<
<
>
<
<
<
<
=
<
<
<
<
<
<
<
>
=
<
<
<
<
>
<
<
<
+
=
<
<
<
<
<
-
=
<
<
<
<
<
*
=
<
<
<
(
=
<
<
<
<
<
<
<
<
)
>
>
>
>
>
>
>
>
>
>
Будую синтаксичний аналіз знизу догори:
$ < begin
$ < begin < i
$ < begin < i = :=
$ < begin < i = := < 1
$ < begin < i = := < 1 > ;
$ < begin < i = := < K > ;
$ < begin < i = := < T1 > ;
$ < begin < i = := < T > ;
$ < begin < i = := < I1 > ;
$ < begin < i = := < I > ;
$ < begin < i = := < V > ;
$ < begin < P > ;
$ < begin < M > ;
$ < begin < Z > ;
$ < begin < O1 = ;
$ < begin < O1 = ; < j
$ < begin < O1 = ; < j = :=
$ < begin < O1 = ; < j = := < 10
$ < begin < O1 = ; < j = := < 10 > ;
$ < begin < O1 = ; < j = := < K > ;
$ < begin < O1 = ; < j = := < T1 > ;
$ < begin < O1 = ; < j = := < T > ;
$ < begin < O1 = ; < j = := < I1 > ;
$ < begin < O1 = ; < j = := < I > ;
$ < begin < O1 = ; < j = := < V > ;
$ < begin < O1 = ; < P > ;
$ < begin < O1 = ; < M > ;
$ < begin < O1 = ; < Z > ;
$ < begin < O1 = ;
$ < begin < O1 = ; < k
$ < begin < O1 = ; < k = :=
$ < begin < O1 = ; < k = := < 30
$ < begin < O1 = ; < k = := < 30 > ;
$ < begin < O1 = ; < k = := < K > ;
$ < begin < O1 = ; < k = := < T1 > ;
$ < begin < O1 = ; < k = := < T > ;
$ < begin < O1 = ; < k = := < I1 > ;
$ < begin < O1 = ; < k = := < I > ;
$ < begin < O1 = ; < k = := < V > ;
$ < begin < O1 = ; < P > ;
$ < begin < O1 = ; < M > ;
$ < begin < O1 = ; < Z > ;
$ < begin < O1 = ;
$ < begin < O1 = ; < if
$ < begin < O1 = ; < if < (< j
$ < begin < O1 = ; < if < (< j > <
$ < begin < O1 = ; < if < (< K > <
$ < begin < O1 = ; < if < (< T1 > <
$ < begin < O1 = ; < if < (< T > <
$ < begin < O1 = ; < if < (< I1 > <
$ < begin < O1 = ; < if < (< I = < < k
$ < begin < O1 = ; < if < (< I1 = < < i > )
$ < begin < O1 = ; < if < (< I1 = < < K > )
$ < begin < O1 = ; < if < (< I1 = < < T1 > )
$ < begin < O1 = ; < if < (< I1 = < < T > )
$ < begin < O1 = ; < if < (< I1 = < < I1 > )
$ < begin < O1 = ; < if < (< I1 = < < I > )
$ < begin < O1 = ; < if < ( = V = )
$ < begin < O1 = ; < if < K
$ < begin < O1 = ; < if < K > a
$ < begin < O1 = ; < if < T1 = a
$ < begin < O1 = ; < if < T1 = a < (
$ < begin < O1 = ; < if < T1 = a < ( < j
$ < begin < O1 = ; < if < T1 = a < ( < j > >
$ < begin < O1 = ; < if < T1 = a < ( < i > >
$ < begin < O1 = ; < if < T1 = a < ( < K > >
$ < begin < O1 = ; < if < T1 = a < ( < T1 > >
$ < begin < O1 = ; < if < T1 = a < ( < T > >
$ < begin < O1 = ; < if < T1 = a < ( < I1 > >
$ < begin < O1 = ; < if < T1 = a < ( < I = > < i
$ < begin < O1 = ; < if < T1 = a < ( < I = > < i > )
$ < begin < O1 = ; < if < T1 = a < ( < I = > < z > )
$ < begin < O1 = ; < if < T1 = a < ( < I = > < K > )
$ < begin < O1 = ; < if < T1 = a < ( < I= > < T1 > )
$ < begin < O1 = ; < if < T1 = a < ( < I = > < T > )
$ < begin < O1 = ; < if < T1 = a < ( < I = > < I1 > )
$ < begin < O1 = ; < if < T1 = a < ( < I = > < I > )
$ < begin < O1 = ; < if < T1 = a < ( = V = )
$ < begin < O1 = ; < if < T1 = a < K
$ < begin < O1 = ; < if < T1
$ < begin < O1 = ; < if < T
$ < begin < O1 = ; < if < I1
$ < begin < O1 = ; < if < I
$ < begin < O1 = ; < if = V
$ < begin < O1 = ; < if = V = then < x
$ < begin < O1 = ; < if = V = then < x >
$ < begin < O1 = ; < if = V = then < z = :=
$ < begin < O1 = ; < if = V = then < z = := < (
$ < begin < O1 = ; < if = V = then < z = := < ( < j
$ < begin < O1 = ; < if = V = then < z = := < ( < j > -
$ < begin < O1 = ; < if = V = then < z = := < ( < z > -
$ < begin < O1 = ; < if = V = then < z = := < ( < K > -
$ < begin < O1 = ; < if = V = then < z = := < ( < T1 > -
$ < begin < O1 = ; < if = V = then < z = := < ( < T > -
$ < begin < O1 = ; < if = V = then < z = := < ( < K > -
$ < begin < O1 = ; < if = V = then < z = := < ( < I1 = - < i
$ < begin < O1 = ; < if = V = then < z = := < ( < I1 = - < i > )
$ < begin < O1 = ; < if = V = then < z = := < ( < I1 = - < z > )
$ < begin < O1 = ; < if = V = then < z = := < ( < I1 = - < K > )
$ < begin < O1 = ; < if = V = then < z = := < ( < I1 = - < T1 > )
$ < begin < O1 = ; < if = V = then < z = := < ( < I1 = - < T > )
$ < begin < O1 = ; < if = V = then < z = := < ( < I1 = - < i > )
$ < begin < O1 = ; < if = V = then < z = := < ( < I1 > )
$ < begin < O1 = ; < if = V = then < z = := < ( < I > )
$ < begin < O1 = ; < if = V = then < z = := < ( < V > )
$ < begin < O1 = ; < if = V = then < z = := < K
$ < begin < O1 = ; < if = V = then < z = := < T1
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < (
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < k > -
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < z > -
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < K > -
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < T1 > -
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < T > -
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < I1 = - < j
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < I1 = - < z > )
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < I1 = - < K > )
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < I1 = - < T1 > )
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < I1 = - < T > )
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < I1 > )
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < I > )
$ < begin < O1 = ; < if = V = then < z = := < T1 = * < ( < V > )
$ < begin < O1 = ; < if = V = then < z = := < T1 = * = K
$ < begin < O1 = ; < if = V = then < z = := < T1
$ < begin < O1 = ; < if = V = then < z = := < T
$ < begin < O1 = ; < if = V = then < z = := < I1
$ < begin < O1 = ; < if = V = then < z = := < I
$ < begin < O1 = ; < if = V = then < z = := = V
$ < begin < O1 = ; < if = V = then < P
$ < begin < O1 = ; < if = V = then < M
$ < begin < O1 = ; < if = V = then < Z
$ < begin < O1 = ; < if = V = then = Z1
$ < begin < O1 = ; < if = V = then = Z1 = else < x
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < i
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < z > +
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < K > +
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < T1> +
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < T > +
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + < j
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + < z
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + < K > +
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + < T1> +
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + = T > +
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + < k
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + < z
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + < z > )
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + < K > )
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + < T1> )
$ < begin < O1 = ; < if = V = then = Z1 = else < z = := < ( < I1 = + = T > )
$ < begin < A1 = ; < p = := < K1 = * < w > end
$ < begin < A1 = ; < p = := < K1 = * = L > end
…
$ < begin < A1 = ; < p = := = H > end
$ < begin < A1 = ; < D > end
$ < begin < A1 = ; < C > end
$ < begin < A1 = ; = B > end
$ < begin < A1 > end
$ < begin = A = end
$ < begin = A = end = .
$ < begin = A = end = . > $
$ < S> $Будую дерево виводу:
Будую тетради:
:= x, _, 3
;= y, _, 4
:= q, _, 10
+ x, y, t1
– t1, 10, t2
BPZ, 11
– x, y, t3
* t3, d, t4
:= w, _, t4
BR 16
* x, d, t5
/ y, u, t6
– t5, t6, t7
+ t7, v, t8
:= w, _, t8
* p, w, t9
:= p, _, t9