Browse Source

Deux versions Compilateur et Interpreteur terminé, TAF : finir la version non sécurisée du processeur, tester

Paul Faure 2 years ago
parent
commit
be9c40eece
6 changed files with 33 additions and 23 deletions
  1. 1
    1
      Compilateur
  2. 1
    1
      Interpreteur
  3. 2
    2
      Makefile
  4. 26
    0
      juste_prix.c
  5. 3
    16
      max.c
  6. 0
    3
      prog.c

+ 1
- 1
Compilateur

@@ -1 +1 @@
1
-Subproject commit 7718e9c861a78b48272d5d8a759a922594e25a16
1
+Subproject commit b501ce3389db4142df557e6bca95434e591741f6

+ 1
- 1
Interpreteur

@@ -1 +1 @@
1
-Subproject commit 9c38352e612609ceb06ea82c10c31790e89feae8
1
+Subproject commit c9c60001de4ae1f8e379dbc210b7a70a6b2dd934

+ 2
- 2
Makefile View File

@@ -53,7 +53,7 @@ ifeq ($(QUOI),compile)
53 53
 	@echo "Compilation terminée"
54 54
 else ifeq ($(QUOI),interprete)
55 55
 	@echo "Interpretation"
56
-	cat $(SOURCE).memasm | Interpreteur/rondoudou_interpreter
56
+	Interpreteur/rondoudou_interpreter $(SOURCE).memasm 
57 57
 	@echo "Interpretation terminée"
58 58
 else ifeq ($(QUOI),cross_assemble)
59 59
 	@echo "CrossAssemblage"
@@ -72,7 +72,7 @@ else ifeq ($(QUOI),all)
72 72
 	@mv output.txt $(SOURCE).memasm
73 73
 	@echo "Compilation terminée"
74 74
 	@echo "Interpretation"
75
-	cat $(SOURCE).memasm | Interpreteur/rondoudou_interpreter
75
+	Interpreteur/rondoudou_interpreter $(SOURCE).memasm 
76 76
 	@echo "Interpretation terminée"
77 77
 	@echo "CrossAssemblage"
78 78
 	cat $(SOURCE).memasm | CrossAssembleur/rondoudou_cross_assembleur

+ 26
- 0
juste_prix.c View File

@@ -0,0 +1,26 @@
1
+int chose_number() {
2
+	int i = get();	
3
+	return i;
4
+}
5
+
6
+int compare(int nb, int prop) {
7
+	int rt;
8
+	if (prop > nb) {
9
+		rt = -1;
10
+	} else if (prop < nb) {
11
+		rt = 1;
12
+	} else {
13
+		rt = 0;
14
+	}
15
+
16
+	return rt;
17
+}
18
+
19
+int main() {
20
+	int valeur = chose_number();
21
+	int prop = valeur + 50;
22
+	while (!(prop == valeur)) {
23
+		prop = get();
24
+		printf(compare(valeur, prop));
25
+	}
26
+}

+ 3
- 16
max.c View File

@@ -1,14 +1,5 @@
1 1
 int get_value() {
2
-	int i = 0;
3
-	while (i<5) {
4
-		printf(0);
5
-		stop(1);
6
-		printf(255);
7
-		stop(1);
8
-		i = i+1;
9
-	}
10
-	stop(15);
11
-	i = get();
2
+	int i = get();
12 3
 	return i;
13 4
 }
14 5
 
@@ -32,13 +23,9 @@ int main() {
32 23
 		i = i+1;
33 24
 	}
34 25
 	i = 0;
35
-	while (i<5) {
36
-		printf(170);
37
-		stop(1);
38
-		printf(85);
39
-		stop(1);
26
+	while (i<10) {
27
+		printf(tab[i]);
40 28
 		i = i+1;
41 29
 	}
42
-	stop(3);
43 30
 	printf(max(tab, 10));
44 31
 }

+ 0
- 3
prog.c View File

@@ -1,12 +1,9 @@
1 1
 int max(int * tab, int size) {
2 2
 	int i = 0;
3 3
 	int max = 0;
4
-	printf(size);
5 4
 	while (i<size) {
6
-		printf(tab[i]);
7 5
 		if (tab[i] > max) {
8 6
 			max = tab[i];
9
-			printf(200);
10 7
 		}
11 8
 		i = i+1;
12 9
 	}

Loading…
Cancel
Save