-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtst.txt
More file actions
81 lines (61 loc) · 1.55 KB
/
tst.txt
File metadata and controls
81 lines (61 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// -------------------- --------------------
// variabile globale
a : int <~ 2;
b : int <~ 3;
flag : bool <~ true;
T : bool <~ false;
// functie globala (int)
SPELL g(x : int) : int {
PARCHMENT { }
ACCIO x + 1;
}
// functie globala (int)
SPELL f(x : int) : int {
PARCHMENT { }
ACCIO x * 2;
}
// functie globala cu while + bool expr
SPELL antrenament(ore : int) : int {
PARCHMENT {
limita : int <~ 0;
mesaj : string <~ "Antrenament in curs";
}
CHANT (ore > limita && ore + 5 > limita - 2) {
Print(mesaj);
ore <~ ore - 1;
}
ACCIO ore;
}
// -------------------- clasa --------------------
HOUSE Vrajitor {
FIELD putere : int;
// metoda (return int) + while + PROPHECY
CHARM upgrade(ore : int) : int {
PARCHMENT {
eu : Vrajitor <~ SUMMON Vrajitor();
ok : bool <~ T;
}
// while (true)
CHANT (ore > 0 && ok == true) {
// PROPHECY (true) (bloc fara declaratii)
PROPHECY (ore > 2) {
eu ** putere <~ eu ** putere + 1;
} else {
eu ** putere <~ eu ** putere + 1;
}
// expresii + apeluri de functii in expresii
ore <~ ore - 1 + f(g(a + b) + a * b);
Print(eu ** putere);
}
ACCIO eu ** putere;
}
}
// obiect global
Harry : Vrajitor <~ SUMMON Vrajitor();
// ----------------------------------------
DUEL {
antrenament(5);
Harry ** putere <~ 100;
Harry ** upgrade(5);
Print(Harry ** putere);
}