Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Verif |
|
| 1.0;1 |
1 | package ProjetCompil.Verif.Src; | |
2 | ||
3 | import ProjetCompil.Global.Src.*; | |
4 | ||
5 | /** | |
6 | * Cette classe permet de réaliser la vérification et la décoration | |
7 | * de l'arbre abstrait d'un programme. | |
8 | */ | |
9 | public class Verif { | |
10 | ||
11 | private Environ env; // L'environnement des identificateurs | |
12 | ||
13 | /** | |
14 | * Constructeur. | |
15 | */ | |
16 | 1 | public Verif() { |
17 | 1 | env = new Environ(); |
18 | 1 | } |
19 | ||
20 | /** | |
21 | * Vérifie les contraintes contextuelles du programme correspondant à | |
22 | * l'arbre abstrait a, qui est décoré et enrichi. | |
23 | * Les contraintes contextuelles sont décrites | |
24 | * dans Context.txt. | |
25 | * En cas d'erreur contextuelle, un message d'erreur est affiché et | |
26 | * l'exception ErreurVerif est levée. | |
27 | */ | |
28 | public void verifierDecorer(Arbre a) throws ErreurVerif { | |
29 | 1 | verifier_PROGRAMME(a); |
30 | 1 | } |
31 | ||
32 | /** | |
33 | * Initialisation de l'environnement avec les identificateurs prédéfinis. | |
34 | */ | |
35 | private void initialiserEnv() { | |
36 | Defn def; | |
37 | // integer | |
38 | 1 | def = Defn.creationType(Type.Integer); |
39 | 1 | def.setGenre(Genre.PredefInteger); |
40 | 1 | env.enrichir("integer", def); |
41 | ||
42 | // ------------ | |
43 | // A COMPLETER | |
44 | // ------------ | |
45 | 1 | } |
46 | ||
47 | /************************************************************************** | |
48 | * PROGRAMME | |
49 | **************************************************************************/ | |
50 | private void verifier_PROGRAMME(Arbre a) throws ErreurVerif { | |
51 | 1 | initialiserEnv(); |
52 | 1 | verifier_LISTE_DECL(a.getFils1()); |
53 | 1 | verifier_LISTE_INST(a.getFils2()); |
54 | 1 | } |
55 | ||
56 | /************************************************************************** | |
57 | * LISTE_DECL | |
58 | **************************************************************************/ | |
59 | private void verifier_LISTE_DECL(Arbre a) throws ErreurVerif { | |
60 | // A COMPLETER | |
61 | 1 | } |
62 | ||
63 | /************************************************************************** | |
64 | * LISTE_INST | |
65 | **************************************************************************/ | |
66 | private void verifier_LISTE_INST(Arbre a) throws ErreurVerif { | |
67 | // A COMPLETER | |
68 | 1 | } |
69 | ||
70 | // ------------------------------------------------------------------------ | |
71 | // COMPLETER les operations de vérifications et de décoration pour toutes | |
72 | // les constructions d'arbres | |
73 | // ------------------------------------------------------------------------ | |
74 | ||
75 | } |