Remove last test
This commit is contained in:
@@ -1,17 +0,0 @@
|
|||||||
CC = gcc
|
|
||||||
|
|
||||||
LIBS = -lm
|
|
||||||
CCFLAGS = -Wall -ggdb
|
|
||||||
|
|
||||||
all: compare_arbres_xml
|
|
||||||
|
|
||||||
compare_arbres_xml: compare_arbres_xml.c analyseur_xml.o
|
|
||||||
$(CC) $(CCFLAGS) -o compare_arbres_xml compare_arbres_xml.c analyseur_xml.o
|
|
||||||
|
|
||||||
analyseur_xml.o: analyseur_xml.c
|
|
||||||
$(CC) $(CCFLAGS) -c analyseur_xml.c
|
|
||||||
|
|
||||||
.PHONY : clean
|
|
||||||
|
|
||||||
clean:
|
|
||||||
- rm -rf *.o compare_arbres_xml output
|
|
||||||
Binary file not shown.
@@ -1,323 +0,0 @@
|
|||||||
#include<stdio.h>
|
|
||||||
#include<stdlib.h>
|
|
||||||
#include<string.h>
|
|
||||||
#include"analyseur_xml.h"
|
|
||||||
|
|
||||||
/* symboles terminaux */
|
|
||||||
|
|
||||||
#define CHEVRON_FERMANT 1
|
|
||||||
#define DEBUT_BF 2
|
|
||||||
#define DEBUT_BO 3
|
|
||||||
#define CHAINE 4
|
|
||||||
#define FIN 5
|
|
||||||
|
|
||||||
#define ISSPACE(a) (a == ' ') || (a == '\n') || (a == '\t')
|
|
||||||
|
|
||||||
#define YYTEXT_MAX 100
|
|
||||||
|
|
||||||
/* fonctions pour arbre abstrait */
|
|
||||||
|
|
||||||
noeud *cree_noeud(char *nom)
|
|
||||||
{
|
|
||||||
noeud *n = malloc(sizeof(noeud));
|
|
||||||
if(n == NULL){
|
|
||||||
fprintf(stderr, "erreur d'allocation\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
n->nom = nom;
|
|
||||||
n->premier_fils = NULL;
|
|
||||||
n->dernier_fils = NULL;
|
|
||||||
n->suiv = NULL;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
noeud *ajoute_fils(noeud *pere, noeud *fils)
|
|
||||||
{
|
|
||||||
if(pere->premier_fils == NULL){
|
|
||||||
pere->premier_fils = pere->dernier_fils = fils;
|
|
||||||
return pere;
|
|
||||||
}
|
|
||||||
pere->dernier_fils->suiv = fils;
|
|
||||||
pere->dernier_fils = fils;
|
|
||||||
return pere;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void affiche_arbre(noeud *racine){
|
|
||||||
noeud *n;
|
|
||||||
printf("<%s> ", racine->nom);
|
|
||||||
for(n=racine->premier_fils; n!=NULL; n = n->suiv){
|
|
||||||
affiche_arbre(n);
|
|
||||||
}
|
|
||||||
printf("</%s> ", racine->nom);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int compare_arbres_rec(noeud *racine1, noeud *racine2, int verbose, int profondeur)
|
|
||||||
{
|
|
||||||
noeud *f1, *f2;
|
|
||||||
int resultat = 1;
|
|
||||||
int i;
|
|
||||||
if(verbose){
|
|
||||||
for(i=0; i<profondeur; i++) printf(" ");
|
|
||||||
printf("%s <------------> %s\n", racine1->nom, racine2->nom);
|
|
||||||
}
|
|
||||||
if(strcmp(racine1->nom, racine2->nom))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for(f1 = racine1->premier_fils, f2 = racine2->premier_fils;
|
|
||||||
f1 && f2 && resultat;
|
|
||||||
f1 = f1->suiv, f2 = f2->suiv){
|
|
||||||
resultat = compare_arbres_rec(f1, f2, verbose, profondeur+1);
|
|
||||||
}
|
|
||||||
return ((f1 == NULL) && (f2 == NULL) && resultat);
|
|
||||||
}
|
|
||||||
|
|
||||||
int compare_arbres(noeud *racine1, noeud *racine2, int verbose)
|
|
||||||
{
|
|
||||||
return compare_arbres_rec(racine1, racine2, verbose, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void libere_arbre(noeud *racine)
|
|
||||||
{
|
|
||||||
noeud *n;
|
|
||||||
for(n=racine->premier_fils; n!=NULL; n = n->suiv){
|
|
||||||
libere_arbre(n);
|
|
||||||
}
|
|
||||||
free(racine);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* analyseur lexical */
|
|
||||||
|
|
||||||
int DEBUG = 0;
|
|
||||||
char yytext[YYTEXT_MAX];
|
|
||||||
int yyleng;
|
|
||||||
int yylval;
|
|
||||||
/* Compter les lignes pour afficher les messages d'erreur avec numero ligne */
|
|
||||||
int nb_ligne;
|
|
||||||
int cc;
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Fonction qui ignore les espaces et commentaires.
|
|
||||||
* Renvoie -1 si arrivé à la fin du fichier, 0 si tout va bien
|
|
||||||
******************************************************************************/
|
|
||||||
int mangeEspaces()
|
|
||||||
{
|
|
||||||
char c = fgetc(yyin);
|
|
||||||
while( ISSPACE(c) ) {
|
|
||||||
if( c == '\n' ) {
|
|
||||||
nb_ligne++;
|
|
||||||
}
|
|
||||||
c = fgetc(yyin);
|
|
||||||
}
|
|
||||||
if ( feof(yyin) ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
ungetc(c, yyin);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Lit un caractère et le stocke dans le buffer yytext
|
|
||||||
******************************************************************************/
|
|
||||||
char lireCar(void)
|
|
||||||
{
|
|
||||||
yytext[yyleng++] = fgetc(yyin);
|
|
||||||
yytext[yyleng] = '\0';
|
|
||||||
return yytext[yyleng - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Remet le dernier caractère lu au buffer clavier et enlève du buffer yytext
|
|
||||||
******************************************************************************/
|
|
||||||
void delireCar()
|
|
||||||
{
|
|
||||||
char c;
|
|
||||||
c = yytext[yyleng - 1];
|
|
||||||
yytext[--yyleng] = '\0';
|
|
||||||
ungetc(c, yyin);
|
|
||||||
}
|
|
||||||
/*******************************************************************************
|
|
||||||
* Fonction principale de l'analyseur lexical, lit les caractères de yyin et
|
|
||||||
* renvoie les tokens sous forme d'entier. Le code de chaque unité est défini
|
|
||||||
* dans symboles.h sinon (mot clé, idententifiant, etc.). Pour les tokens de
|
|
||||||
* type ID_FCT, ID_VAR et NOMBRE la valeur du token est dans yytext, visible
|
|
||||||
* dans l'analyseur syntaxique.
|
|
||||||
******************************************************************************/
|
|
||||||
int inTag = 0;
|
|
||||||
|
|
||||||
int yylex(void)
|
|
||||||
{
|
|
||||||
char c;
|
|
||||||
yytext[yyleng = 0] = '\0';
|
|
||||||
|
|
||||||
/* Si j'ai trouvé la fin du fichier en lisant des espaces ... */
|
|
||||||
if( !inTag && mangeEspaces() == -1 ) {
|
|
||||||
return FIN; /* Renvoie le marqueur de fin d'entrée */
|
|
||||||
}
|
|
||||||
|
|
||||||
c = lireCar();
|
|
||||||
if(c == '>'){
|
|
||||||
if(DEBUG) { printf("CHEVRON_FERMANT\n"); }
|
|
||||||
//inTag = 0;
|
|
||||||
return CHEVRON_FERMANT;
|
|
||||||
}
|
|
||||||
if(c == '<'){
|
|
||||||
inTag = 1;
|
|
||||||
c = lireCar();
|
|
||||||
if(c == '/'){
|
|
||||||
if(DEBUG) { printf("DEBUT_BF\n"); }
|
|
||||||
return DEBUT_BF;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
delireCar();
|
|
||||||
if(DEBUG) { printf("DEBUT_BO\n"); }
|
|
||||||
return DEBUT_BO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
do{
|
|
||||||
c = lireCar();
|
|
||||||
inTag = 0;
|
|
||||||
}while((c!= '<') && (c!= '>') && !feof(yyin) && !(ISSPACE(c)));
|
|
||||||
delireCar();
|
|
||||||
if(DEBUG) { printf("CHAINE\n"); }
|
|
||||||
|
|
||||||
return CHAINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Fonction auxiliaire appelée par l'analyseur syntaxique tout simplement pour
|
|
||||||
* afficher des messages d'erreur et l'arbre XML
|
|
||||||
******************************************************************************/
|
|
||||||
void nom_token( int token, char *nom, char *valeur ) {
|
|
||||||
//int i;
|
|
||||||
|
|
||||||
strcpy( nom, "symbole" );
|
|
||||||
if(token == CHEVRON_FERMANT) strcpy( valeur, "CHEVRON_FERMANT");
|
|
||||||
else if(token == DEBUT_BF) strcpy( valeur, "DEBUT_BF");
|
|
||||||
else if(token == DEBUT_BO) strcpy( valeur, "DEBUT_BO");
|
|
||||||
else if(token == CHAINE) strcpy( valeur, "CHAINE");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* analyse syntaxique */
|
|
||||||
|
|
||||||
noeud *B(void);
|
|
||||||
void LB(noeud *pere);
|
|
||||||
char *BO(void);
|
|
||||||
char *BF(void);
|
|
||||||
void LCHAINE(void);
|
|
||||||
|
|
||||||
void erreur(char *msg){
|
|
||||||
fprintf(stderr, "Ligne %d : erreur : %s\n", nb_ligne, msg);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* B -> BO LCHAINE LB LCHAINE BF */
|
|
||||||
noeud *B(void){
|
|
||||||
char *nom_bo;
|
|
||||||
char *nom_bf;
|
|
||||||
noeud *n;
|
|
||||||
if(DEBUG) { printf("<B>\n"); }
|
|
||||||
if(cc == DEBUT_BO){
|
|
||||||
nom_bo = BO();
|
|
||||||
n = cree_noeud(nom_bo);
|
|
||||||
LCHAINE();
|
|
||||||
LB(n);
|
|
||||||
LCHAINE();
|
|
||||||
nom_bf = BF();
|
|
||||||
if(strcmp(nom_bo, nom_bf)){
|
|
||||||
fprintf(stderr, "Ligne %d : arbre mal forme: balise ouvrante : \"%s\" balise fermante : \"%s\"\n", nb_ligne, nom_bo, nom_bf);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
free(nom_bf);
|
|
||||||
if(DEBUG) { printf("</B>\n"); }
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
erreur("B");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* LCHAINE -> CHAINE LCHAINE */
|
|
||||||
/* | */
|
|
||||||
|
|
||||||
void LCHAINE(void){
|
|
||||||
if(cc == CHAINE){
|
|
||||||
cc = yylex();
|
|
||||||
LCHAINE();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if((cc == DEBUT_BO) ||(cc == DEBUT_BF)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
erreur("LCHAINE");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* LB -> B LB
|
|
||||||
| */
|
|
||||||
|
|
||||||
void LB(noeud *pere)
|
|
||||||
{
|
|
||||||
noeud *fils = NULL;
|
|
||||||
if(cc == DEBUT_BO){
|
|
||||||
fils = B();
|
|
||||||
ajoute_fils(pere, fils);
|
|
||||||
LB(pere);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(cc == DEBUT_BF){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
erreur("LB");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BO -> DEBUT_BO CHAINE CHEVRON_FERMANT */
|
|
||||||
char *BO(void)
|
|
||||||
{
|
|
||||||
char *nom = NULL;
|
|
||||||
if(DEBUG) { printf("<BO>\n"); }
|
|
||||||
if(cc == DEBUT_BO){
|
|
||||||
cc = yylex();
|
|
||||||
if(cc == CHAINE){
|
|
||||||
nom = strdup(yytext);
|
|
||||||
cc = yylex();
|
|
||||||
if(cc == CHEVRON_FERMANT){
|
|
||||||
cc = yylex();
|
|
||||||
if(DEBUG) { printf("</BO>\n"); }
|
|
||||||
return nom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
erreur("BO");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BF -> DEBUT_BF CHAINE CHEVRON_FERMANT */
|
|
||||||
char *BF(void)
|
|
||||||
{
|
|
||||||
char *nom = NULL;
|
|
||||||
if(cc == DEBUT_BF){
|
|
||||||
cc = yylex();
|
|
||||||
if(cc == CHAINE){
|
|
||||||
nom = strdup(yytext);
|
|
||||||
cc = yylex();
|
|
||||||
if(cc == CHEVRON_FERMANT){
|
|
||||||
cc = yylex();
|
|
||||||
return nom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
erreur("BF");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
noeud *analyseur_xml(void)
|
|
||||||
{
|
|
||||||
nb_ligne = 0;
|
|
||||||
cc = yylex();
|
|
||||||
return B();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#ifndef __ANALYSEUR_XML__
|
|
||||||
#define __ANALYSEUR_XML__
|
|
||||||
|
|
||||||
/* structures de donnees et fonctions pour arbre abstrait */
|
|
||||||
|
|
||||||
typedef struct n noeud;
|
|
||||||
|
|
||||||
struct n{
|
|
||||||
char *nom;
|
|
||||||
struct n *premier_fils;
|
|
||||||
struct n *dernier_fils;
|
|
||||||
struct n *suiv;
|
|
||||||
};
|
|
||||||
|
|
||||||
FILE *yyin;
|
|
||||||
|
|
||||||
|
|
||||||
void affiche_arbre(noeud *racine);
|
|
||||||
int compare_arbres(noeud *racine1, noeud *racine2, int verbose);
|
|
||||||
void libere_arbre(noeud *r);
|
|
||||||
|
|
||||||
/* analyseur */
|
|
||||||
|
|
||||||
noeud *analyseur_xml(void);
|
|
||||||
#endif
|
|
||||||
Binary file not shown.
@@ -1,63 +0,0 @@
|
|||||||
#include<stdio.h>
|
|
||||||
#include<stdlib.h>
|
|
||||||
#include"analyseur_xml.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
noeud *racine1;
|
|
||||||
noeud *racine2;
|
|
||||||
int resultat;
|
|
||||||
int verbose;
|
|
||||||
|
|
||||||
if((argc != 3) && (argc != 4)){
|
|
||||||
fprintf(stderr, "usage: %s fichier_xml fichier_xml [v]\n", argv[0]);
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
}
|
|
||||||
verbose = (argc == 4);
|
|
||||||
|
|
||||||
yyin = fopen(argv[1], "r");
|
|
||||||
if(yyin == NULL){
|
|
||||||
fprintf(stderr, "impossible d'ouvrir le fichier %s\n", argv[1]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "analyse du fichier : %s\n", argv[1]);
|
|
||||||
racine1 = analyseur_xml();
|
|
||||||
|
|
||||||
|
|
||||||
fclose(yyin);
|
|
||||||
|
|
||||||
yyin = fopen(argv[2], "r");
|
|
||||||
if(yyin == NULL){
|
|
||||||
fprintf(stderr, "impossible d'ouvrir le fichier %s\n", argv[2]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "analyse du fichier : %s\n", argv[2]);
|
|
||||||
racine2 = analyseur_xml();
|
|
||||||
|
|
||||||
fclose(yyin);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* affiche_arbre(racine1);
|
|
||||||
printf("\n");
|
|
||||||
affiche_arbre(racine2);*/
|
|
||||||
|
|
||||||
fprintf(stderr, "comparaison des arbres\n");
|
|
||||||
resultat = compare_arbres(racine1, racine2, verbose);
|
|
||||||
libere_arbre(racine1);
|
|
||||||
libere_arbre(racine2);
|
|
||||||
|
|
||||||
|
|
||||||
if(resultat){
|
|
||||||
printf("arbres egaux\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
printf("arbres différents\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
$a = 5;
|
|
||||||
ecrire( $a );
|
|
||||||
}
|
|
||||||
$extra = 0;
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
$a = 1;
|
|
||||||
ecrire($a);
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
entier $i, entier $carre;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
$i = 0;
|
|
||||||
tantque $i < 10 faire
|
|
||||||
{
|
|
||||||
$carre = $i * $i;
|
|
||||||
ecrire( $carre );
|
|
||||||
$i = $i + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
add (entier $a, entier $b)
|
|
||||||
{
|
|
||||||
retour $a + $b;
|
|
||||||
}
|
|
||||||
|
|
||||||
mult (entier $a, entier $b)
|
|
||||||
{
|
|
||||||
retour $a * $b;
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
entier $a, entier $b, entier $op;
|
|
||||||
{
|
|
||||||
$a = lire();
|
|
||||||
$b = lire();
|
|
||||||
$op = lire();
|
|
||||||
si $op = 1 alors {
|
|
||||||
ecrire(add($a, $b));
|
|
||||||
}
|
|
||||||
sinon {
|
|
||||||
si $op = 2 alors {
|
|
||||||
ecrire(mult($a, $b));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
33a
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
fibo( entier $n )
|
|
||||||
{
|
|
||||||
si $n < 2 alors {
|
|
||||||
retour 1;
|
|
||||||
}
|
|
||||||
sinon {
|
|
||||||
retour fibo( $n - 1 ) + fibo( $n - 2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
ecrire( fibo( lire() ) );
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
$a = 5;
|
|
||||||
ecrire( $a );
|
|
||||||
}
|
|
||||||
$extra = 0;
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
entier $i, entier $j, entier $k, entier $somme;
|
|
||||||
main() {
|
|
||||||
$somme = 0;
|
|
||||||
pour $i = 0; $i < 10; $i = $i + 1; faire {
|
|
||||||
pour $j = 0; $j < $i; $j = $j + 1; faire {
|
|
||||||
pour $k = 0; $k < $j; $k = $k + 1; faire {
|
|
||||||
$somme = $somme + $i + $j + $k;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ecrire ( $somme );
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
entier $i;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
entier $carre;
|
|
||||||
$i = 0;
|
|
||||||
tantque $i < 10 faire
|
|
||||||
{
|
|
||||||
$carre = $i * $i;
|
|
||||||
ecrire( $carre );
|
|
||||||
$i = $i + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
si 1 alors
|
|
||||||
{ecrire(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
entier entier entier
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
si 0 alors
|
|
||||||
{ecrire(1);
|
|
||||||
}
|
|
||||||
sinon
|
|
||||||
{ecrire(0);}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
entier ?
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
entier $a[10], entier $b;
|
|
||||||
main() {
|
|
||||||
$a[0] = 10;
|
|
||||||
$b = 5;
|
|
||||||
ecrire( $a ); # erreur de type ou ecrit 10?
|
|
||||||
ecrire( $a + 1 ); # erreur de type ou ecrit 11?
|
|
||||||
ecrire( $b[0] ); # erreur de type ou ecrit 5?
|
|
||||||
ecrire( $a[10] ); # erreur de type ou ecrit 5?
|
|
||||||
retour 0;
|
|
||||||
ecrire( $b ); # ecrit 5 ou pas?
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
$a = 0;
|
|
||||||
tantque $a < 10 faire{
|
|
||||||
ecrire($a);
|
|
||||||
$a = $a + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
ecrire(5 * 2);
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
max( entier $a, entier $b )
|
|
||||||
{
|
|
||||||
si $a < $b alors {
|
|
||||||
retour $b;
|
|
||||||
}
|
|
||||||
retour $a;
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
entier $v_1, entier $v_2;
|
|
||||||
{
|
|
||||||
$v_1 = lire();
|
|
||||||
$v_2 = lire();
|
|
||||||
si max( $v_1, $v_2 ) = $v_1 alors
|
|
||||||
{
|
|
||||||
ecrire( $v_1 );
|
|
||||||
}
|
|
||||||
sinon
|
|
||||||
{
|
|
||||||
ecrire( $v_2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
pour $a=1; $a<10; $a = $a + 1; faire
|
|
||||||
{
|
|
||||||
ecrire( $a );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
entier $i;
|
|
||||||
main() {
|
|
||||||
pour $i = 5; $i < 10; $i faire {
|
|
||||||
ecrire ( $i );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
pour $a=1; $a<10; $a = $a + 1; faire
|
|
||||||
{
|
|
||||||
ecrire( $a );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
pour $a=1; $a<10; $a = $a + 1; faire
|
|
||||||
{
|
|
||||||
ecrire( $a );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
entier $tab[ 10 ];
|
|
||||||
|
|
||||||
initialiser()
|
|
||||||
{
|
|
||||||
$tab[0] = 8; $tab[1] = 6; $tab[2] = 9;
|
|
||||||
$tab[3] = 9; $tab[4] = 4; $tab[5] = 2;
|
|
||||||
$tab[6] = 3; $tab[7] = 1; $tab[8] = 4;
|
|
||||||
$tab[9] = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
afficher( entier $n )
|
|
||||||
entier $i;
|
|
||||||
{
|
|
||||||
$i = 0;
|
|
||||||
tantque $i < $n faire {
|
|
||||||
ecrire( $tab[ $i ] );
|
|
||||||
$i = $i + 1;
|
|
||||||
}
|
|
||||||
ecrire( 0 ); # marqueur fin de tableau
|
|
||||||
}
|
|
||||||
|
|
||||||
echanger( entier $i, entier $j )
|
|
||||||
entier $temp;
|
|
||||||
{
|
|
||||||
$temp = $tab[ $j ];
|
|
||||||
$tab[ $j ] = $tab[ $i ];
|
|
||||||
$tab[ $i ] = $temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
trier( entier $n )
|
|
||||||
entier $echange, entier $j, entier $m;
|
|
||||||
{
|
|
||||||
$m = $n;
|
|
||||||
$echange = 1;
|
|
||||||
tantque $echange = 1 faire
|
|
||||||
{
|
|
||||||
$echange = 0;
|
|
||||||
$j = 0;
|
|
||||||
tantque $j < $m - 1 faire
|
|
||||||
{
|
|
||||||
si $tab[ $j + 1 ] < $tab[ $j ] alors {
|
|
||||||
echanger( $j, $j + 1 );
|
|
||||||
$echange = 1;
|
|
||||||
}
|
|
||||||
$j = $j + 1;
|
|
||||||
}
|
|
||||||
$m = $m - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
initialiser();
|
|
||||||
afficher( 10 );
|
|
||||||
trier( 10 );
|
|
||||||
afficher( 10 );
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<prog>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$a</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
main
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$a</var_simple>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$a</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
</l_dec>
|
|
||||||
</prog>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
entier mot_clef entier
|
|
||||||
$a id_variable $a
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
main id_fonction main
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$a id_variable $a
|
|
||||||
= symbole EGAL
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$a id_variable $a
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
symbole FIN
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
.data
|
|
||||||
$$a: .space 4
|
|
||||||
.text
|
|
||||||
__start:
|
|
||||||
jal main
|
|
||||||
li $v0, 10
|
|
||||||
syscall
|
|
||||||
main :
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, $$a
|
|
||||||
lw $t0, $$a
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
move $a0, $t0
|
|
||||||
li $v0, 1
|
|
||||||
syscall
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall
|
|
||||||
addi $sp, $sp 0 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
<programme>
|
|
||||||
<optDecVariables>
|
|
||||||
<listeDecVariables>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariables>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</optDecVariables>
|
|
||||||
<listeDecFonctions>
|
|
||||||
<declarationFonction>
|
|
||||||
<id_fonction>main</id_fonction>
|
|
||||||
<listeParam>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<optListeDecVariables>
|
|
||||||
</optListeDecVariables>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</listeParam>
|
|
||||||
<optDecVariables>
|
|
||||||
</optDecVariables>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<nombre>1</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionEcriture>
|
|
||||||
<mot_clef>ecrire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionEcriture>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</declarationFonction>
|
|
||||||
<listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</programme>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
------------------------------------------
|
|
||||||
base = 2
|
|
||||||
sommet = 2
|
|
||||||
0 $a GLOBALE ENTIER 0 -1
|
|
||||||
1 main GLOBALE FONCTION 0 0
|
|
||||||
------------------------------------------
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
<prog>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$i</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$carre</varDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
main
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_tantque>
|
|
||||||
<opExp>
|
|
||||||
inf
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>10</intExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$carre</var_simple>
|
|
||||||
<opExp>
|
|
||||||
fois
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$carre</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
<opExp>
|
|
||||||
plus
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</instr_tantque>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
</l_dec>
|
|
||||||
</prog>
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
entier mot_clef entier
|
|
||||||
$i id_variable $i
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$carre id_variable $carre
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
main id_fonction main
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$i id_variable $i
|
|
||||||
= symbole EGAL
|
|
||||||
0 nombre 0
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
tantque mot_clef tantque
|
|
||||||
$i id_variable $i
|
|
||||||
< symbole INFERIEUR
|
|
||||||
10 nombre 10
|
|
||||||
faire mot_clef faire
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$carre id_variable $carre
|
|
||||||
= symbole EGAL
|
|
||||||
$i id_variable $i
|
|
||||||
* symbole FOIS
|
|
||||||
$i id_variable $i
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$carre id_variable $carre
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$i id_variable $i
|
|
||||||
= symbole EGAL
|
|
||||||
$i id_variable $i
|
|
||||||
+ symbole PLUS
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
symbole FIN
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
.data
|
|
||||||
$$i: .space 4
|
|
||||||
$$carre: .space 4
|
|
||||||
.text
|
|
||||||
__start:
|
|
||||||
jal main
|
|
||||||
li $v0, 10
|
|
||||||
syscall
|
|
||||||
main :
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, $$i
|
|
||||||
e0:
|
|
||||||
lw $t0, $$i
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 10
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t0, 1
|
|
||||||
blt $t1, $t2 e2
|
|
||||||
li $t0, 0
|
|
||||||
e2:
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0 $0 e1
|
|
||||||
lw $t0, $$i
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, $$i
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
mult $t1, $t2
|
|
||||||
mflo $t0
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, $$carre
|
|
||||||
lw $t0, $$carre
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
move $a0, $t0
|
|
||||||
li $v0, 1
|
|
||||||
syscall
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall
|
|
||||||
lw $t0, $$i
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t1, $t2
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, $$i
|
|
||||||
j e0
|
|
||||||
e1:
|
|
||||||
addi $sp, $sp 0 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
@@ -1,283 +0,0 @@
|
|||||||
<programme>
|
|
||||||
<optDecVariables>
|
|
||||||
<listeDecVariables>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
<symbole>VIRGULE</symbole>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$carre</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariables>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</optDecVariables>
|
|
||||||
<listeDecFonctions>
|
|
||||||
<declarationFonction>
|
|
||||||
<id_fonction>main</id_fonction>
|
|
||||||
<listeParam>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<optListeDecVariables>
|
|
||||||
</optListeDecVariables>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</listeParam>
|
|
||||||
<optDecVariables>
|
|
||||||
</optDecVariables>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<nombre>0</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionTantque>
|
|
||||||
<mot_clef>tantque</mot_clef>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
<symbole>INFERIEUR</symbole>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<nombre>10</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<mot_clef>faire</mot_clef>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$carre</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
<symbole>FOIS</symbole>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionEcriture>
|
|
||||||
<mot_clef>ecrire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$carre</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionEcriture>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
<symbole>PLUS</symbole>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<nombre>1</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</instructionTantque>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</declarationFonction>
|
|
||||||
<listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</programme>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
------------------------------------------
|
|
||||||
base = 3
|
|
||||||
sommet = 3
|
|
||||||
0 $i GLOBALE ENTIER 0 -1
|
|
||||||
1 $carre GLOBALE ENTIER 4 -1
|
|
||||||
2 main GLOBALE FONCTION 0 0
|
|
||||||
------------------------------------------
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<prog>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$a</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
main
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<opExp>
|
|
||||||
fois
|
|
||||||
<intExp>5</intExp>
|
|
||||||
<intExp>2</intExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
</l_dec>
|
|
||||||
</prog>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
entier mot_clef entier
|
|
||||||
$a id_variable $a
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
main id_fonction main
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
5 nombre 5
|
|
||||||
* symbole FOIS
|
|
||||||
2 nombre 2
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
symbole FIN
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
.data
|
|
||||||
$$a: .space 4
|
|
||||||
.text
|
|
||||||
__start:
|
|
||||||
jal main
|
|
||||||
li $v0, 10
|
|
||||||
syscall
|
|
||||||
main :
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
li $t0, 5
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 2
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
mult $t1, $t2
|
|
||||||
mflo $t0
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
move $a0, $t0
|
|
||||||
li $v0, 1
|
|
||||||
syscall
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall
|
|
||||||
addi $sp, $sp 0 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
<programme>
|
|
||||||
<optDecVariables>
|
|
||||||
<listeDecVariables>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariables>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</optDecVariables>
|
|
||||||
<listeDecFonctions>
|
|
||||||
<declarationFonction>
|
|
||||||
<id_fonction>main</id_fonction>
|
|
||||||
<listeParam>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<optListeDecVariables>
|
|
||||||
</optListeDecVariables>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</listeParam>
|
|
||||||
<optDecVariables>
|
|
||||||
</optDecVariables>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionEcriture>
|
|
||||||
<mot_clef>ecrire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<nombre>5</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
<symbole>FOIS</symbole>
|
|
||||||
<facteur>
|
|
||||||
<nombre>2</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionEcriture>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</declarationFonction>
|
|
||||||
<listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</programme>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
------------------------------------------
|
|
||||||
base = 2
|
|
||||||
sommet = 2
|
|
||||||
0 $a GLOBALE ENTIER 0 -1
|
|
||||||
1 main GLOBALE FONCTION 0 0
|
|
||||||
------------------------------------------
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
<prog>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
max
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$a</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$b</varDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
<l_instr>
|
|
||||||
<instr_si>
|
|
||||||
<opExp>
|
|
||||||
inf
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$a</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$b</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_retour>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$b</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_retour>
|
|
||||||
</l_instr>
|
|
||||||
</instr_si>
|
|
||||||
<l_instr>
|
|
||||||
<instr_retour>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$a</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_retour>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
main
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$v_1</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$v_2</varDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$v_1</var_simple>
|
|
||||||
<lireExp>
|
|
||||||
</lireExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$v_2</var_simple>
|
|
||||||
<lireExp>
|
|
||||||
</lireExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_si>
|
|
||||||
<opExp>
|
|
||||||
egal
|
|
||||||
<appelExp>
|
|
||||||
<appel>
|
|
||||||
max
|
|
||||||
<l_exp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$v_1</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<l_exp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$v_2</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</appelExp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$v_1</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$v_1</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
</l_instr>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$v_2</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
</l_instr>
|
|
||||||
</instr_si>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</prog>
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
max id_fonction max
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$a id_variable $a
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$b id_variable $b
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
si mot_clef si
|
|
||||||
$a id_variable $a
|
|
||||||
< symbole INFERIEUR
|
|
||||||
$b id_variable $b
|
|
||||||
alors mot_clef alors
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
retour mot_clef retour
|
|
||||||
$b id_variable $b
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
retour mot_clef retour
|
|
||||||
$a id_variable $a
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
main id_fonction main
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$v_1 id_variable $v_1
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$v_2 id_variable $v_2
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$v_1 id_variable $v_1
|
|
||||||
= symbole EGAL
|
|
||||||
lire mot_clef lire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$v_2 id_variable $v_2
|
|
||||||
= symbole EGAL
|
|
||||||
lire mot_clef lire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
si mot_clef si
|
|
||||||
max id_fonction max
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$v_1 id_variable $v_1
|
|
||||||
, symbole VIRGULE
|
|
||||||
$v_2 id_variable $v_2
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
= symbole EGAL
|
|
||||||
$v_1 id_variable $v_1
|
|
||||||
alors mot_clef alors
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$v_1 id_variable $v_1
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
sinon mot_clef sinon
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$v_2 id_variable $v_2
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
symbole FIN
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
.data
|
|
||||||
.text
|
|
||||||
__start:
|
|
||||||
jal main
|
|
||||||
li $v0, 10
|
|
||||||
syscall
|
|
||||||
max :
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
lw $t0, 8($fp) #variable argument $a
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 4($fp) #variable argument $b
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t0, 1
|
|
||||||
blt $t1, $t2 e0
|
|
||||||
li $t0, 0
|
|
||||||
e0:
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0 $zero e1
|
|
||||||
lw $t0, 4($fp) #variable argument $b
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0 12($fp) #Adresse de retour
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
j e2
|
|
||||||
e1:
|
|
||||||
e2:
|
|
||||||
lw $t0, 8($fp) #variable argument $a
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0 12($fp) #Adresse de retour
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
addi $sp, $sp 0 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
main :
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
li $v0 5
|
|
||||||
syscall
|
|
||||||
move $t0, $v0
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -8($fp) #variable locale
|
|
||||||
li $v0 5
|
|
||||||
syscall
|
|
||||||
move $t0, $v0
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -12($fp) #variable locale
|
|
||||||
sub $sp, $sp, 4 #Val Retour
|
|
||||||
lw $t0, -8($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, -12($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
jal max
|
|
||||||
addi $sp, $sp, 8
|
|
||||||
lw $t0, -8($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t0, 1
|
|
||||||
beq $t1, $t2 e3
|
|
||||||
li $t0, 0
|
|
||||||
e3:
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0 $zero e4
|
|
||||||
lw $t0, -8($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
move $a0, $t0
|
|
||||||
li $v0, 1
|
|
||||||
syscall
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall
|
|
||||||
j e5
|
|
||||||
e4:
|
|
||||||
lw $t0, -12($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
move $a0, $t0
|
|
||||||
li $v0, 1
|
|
||||||
syscall
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall
|
|
||||||
e5:
|
|
||||||
addi $sp, $sp 8 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
@@ -1,513 +0,0 @@
|
|||||||
<programme>
|
|
||||||
<optDecVariables>
|
|
||||||
</optDecVariables>
|
|
||||||
<listeDecFonctions>
|
|
||||||
<declarationFonction>
|
|
||||||
<id_fonction>max</id_fonction>
|
|
||||||
<listeParam>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<optListeDecVariables>
|
|
||||||
<listeDecVariables>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
<symbole>VIRGULE</symbole>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$b</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariables>
|
|
||||||
</optListeDecVariables>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</listeParam>
|
|
||||||
<optDecVariables>
|
|
||||||
</optDecVariables>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionSi>
|
|
||||||
<mot_clef>si</mot_clef>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
<symbole>INFERIEUR</symbole>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$b</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<mot_clef>alors</mot_clef>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionRetour>
|
|
||||||
<mot_clef>retour</mot_clef>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$b</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionRetour>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
<optSinon>
|
|
||||||
</optSinon>
|
|
||||||
</instructionSi>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionRetour>
|
|
||||||
<mot_clef>retour</mot_clef>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionRetour>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</declarationFonction>
|
|
||||||
<listeDecFonctions>
|
|
||||||
<declarationFonction>
|
|
||||||
<id_fonction>main</id_fonction>
|
|
||||||
<listeParam>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<optListeDecVariables>
|
|
||||||
</optListeDecVariables>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</listeParam>
|
|
||||||
<optDecVariables>
|
|
||||||
<listeDecVariables>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$v_1</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
<symbole>VIRGULE</symbole>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$v_2</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariables>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</optDecVariables>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_1</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<mot_clef>lire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_2</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<mot_clef>lire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionSi>
|
|
||||||
<mot_clef>si</mot_clef>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<appelFct>
|
|
||||||
<id_fonction>max</id_fonction>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<listeExpressions>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_1</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<listeExpressionsBis>
|
|
||||||
<symbole>VIRGULE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_2</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<listeExpressionsBis>
|
|
||||||
</listeExpressionsBis>
|
|
||||||
</listeExpressionsBis>
|
|
||||||
</listeExpressions>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</appelFct>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_1</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<mot_clef>alors</mot_clef>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionEcriture>
|
|
||||||
<mot_clef>ecrire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_1</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionEcriture>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
<optSinon>
|
|
||||||
<mot_clef>sinon</mot_clef>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionEcriture>
|
|
||||||
<mot_clef>ecrire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_2</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionEcriture>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</optSinon>
|
|
||||||
</instructionSi>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</declarationFonction>
|
|
||||||
<listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</programme>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
------------------------------------------
|
|
||||||
base = 1
|
|
||||||
sommet = 3
|
|
||||||
0 max GLOBALE FONCTION 0 2
|
|
||||||
1 $a ARGUMENT ENTIER 0 -1
|
|
||||||
2 $b ARGUMENT ENTIER 4 -1
|
|
||||||
------------------------------------------
|
|
||||||
------------------------------------------
|
|
||||||
base = 2
|
|
||||||
sommet = 4
|
|
||||||
0 max GLOBALE FONCTION 0 2
|
|
||||||
1 main GLOBALE FONCTION 0 0
|
|
||||||
2 $v_1 LOCALE ENTIER 0 -1
|
|
||||||
3 $v_2 LOCALE ENTIER 4 -1
|
|
||||||
------------------------------------------
|
|
||||||
@@ -1,418 +0,0 @@
|
|||||||
<prog>
|
|
||||||
<l_dec>
|
|
||||||
<tabDec>$tab[10]</tabDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
initialiser
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>8</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>6</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>2</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>9</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>3</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>9</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>4</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>4</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>5</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>2</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>6</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>3</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>7</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>8</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>4</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>9</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>5</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
afficher
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$n</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$i</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_tantque>
|
|
||||||
<opExp>
|
|
||||||
inf
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$n</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<varExp>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
</varExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
<opExp>
|
|
||||||
plus
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</instr_tantque>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
echanger
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$i</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$j</varDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$temp</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$temp</var_simple>
|
|
||||||
<varExp>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
</varExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
<varExp>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
</varExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$temp</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
trier
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$n</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$echange</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$j</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$m</varDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$m</var_simple>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$n</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$echange</var_simple>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_tantque>
|
|
||||||
<opExp>
|
|
||||||
egal
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$echange</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$echange</var_simple>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_tantque>
|
|
||||||
<opExp>
|
|
||||||
inf
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<opExp>
|
|
||||||
moins
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$m</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_si>
|
|
||||||
<opExp>
|
|
||||||
inf
|
|
||||||
<varExp>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<opExp>
|
|
||||||
plus
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</var_indicee>
|
|
||||||
</varExp>
|
|
||||||
<varExp>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
</varExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_appel>
|
|
||||||
<appel>
|
|
||||||
echanger
|
|
||||||
<l_exp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<l_exp>
|
|
||||||
<opExp>
|
|
||||||
plus
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</instr_appel>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$echange</var_simple>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</instr_si>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
<opExp>
|
|
||||||
plus
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</instr_tantque>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$m</var_simple>
|
|
||||||
<opExp>
|
|
||||||
moins
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$m</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</instr_tantque>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
main
|
|
||||||
<l_instr>
|
|
||||||
<instr_appel>
|
|
||||||
<appel>
|
|
||||||
initialiser
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</instr_appel>
|
|
||||||
<l_instr>
|
|
||||||
<instr_appel>
|
|
||||||
<appel>
|
|
||||||
afficher
|
|
||||||
<l_exp>
|
|
||||||
<intExp>10</intExp>
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</instr_appel>
|
|
||||||
<l_instr>
|
|
||||||
<instr_appel>
|
|
||||||
<appel>
|
|
||||||
trier
|
|
||||||
<l_exp>
|
|
||||||
<intExp>10</intExp>
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</instr_appel>
|
|
||||||
<l_instr>
|
|
||||||
<instr_appel>
|
|
||||||
<appel>
|
|
||||||
afficher
|
|
||||||
<l_exp>
|
|
||||||
<intExp>10</intExp>
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</instr_appel>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</prog>
|
|
||||||
@@ -1,271 +0,0 @@
|
|||||||
entier mot_clef entier
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
10 nombre 10
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
initialiser id_fonction initialiser
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
0 nombre 0
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
8 nombre 8
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
1 nombre 1
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
6 nombre 6
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
2 nombre 2
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
9 nombre 9
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
3 nombre 3
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
9 nombre 9
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
4 nombre 4
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
4 nombre 4
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
5 nombre 5
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
2 nombre 2
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
6 nombre 6
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
3 nombre 3
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
7 nombre 7
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
8 nombre 8
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
4 nombre 4
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
9 nombre 9
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
5 nombre 5
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
afficher id_fonction afficher
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$n id_variable $n
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$i id_variable $i
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$i id_variable $i
|
|
||||||
= symbole EGAL
|
|
||||||
0 nombre 0
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
tantque mot_clef tantque
|
|
||||||
$i id_variable $i
|
|
||||||
< symbole INFERIEUR
|
|
||||||
$n id_variable $n
|
|
||||||
faire mot_clef faire
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$i id_variable $i
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$i id_variable $i
|
|
||||||
= symbole EGAL
|
|
||||||
$i id_variable $i
|
|
||||||
+ symbole PLUS
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
0 nombre 0
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
echanger id_fonction echanger
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$i id_variable $i
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$j id_variable $j
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$temp id_variable $temp
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$temp id_variable $temp
|
|
||||||
= symbole EGAL
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$j id_variable $j
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$j id_variable $j
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$i id_variable $i
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$i id_variable $i
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
$temp id_variable $temp
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
trier id_fonction trier
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$n id_variable $n
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$echange id_variable $echange
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$j id_variable $j
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$m id_variable $m
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$m id_variable $m
|
|
||||||
= symbole EGAL
|
|
||||||
$n id_variable $n
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$echange id_variable $echange
|
|
||||||
= symbole EGAL
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
tantque mot_clef tantque
|
|
||||||
$echange id_variable $echange
|
|
||||||
= symbole EGAL
|
|
||||||
1 nombre 1
|
|
||||||
faire mot_clef faire
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$echange id_variable $echange
|
|
||||||
= symbole EGAL
|
|
||||||
0 nombre 0
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$j id_variable $j
|
|
||||||
= symbole EGAL
|
|
||||||
0 nombre 0
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
tantque mot_clef tantque
|
|
||||||
$j id_variable $j
|
|
||||||
< symbole INFERIEUR
|
|
||||||
$m id_variable $m
|
|
||||||
- symbole MOINS
|
|
||||||
1 nombre 1
|
|
||||||
faire mot_clef faire
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
si mot_clef si
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$j id_variable $j
|
|
||||||
+ symbole PLUS
|
|
||||||
1 nombre 1
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
< symbole INFERIEUR
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$j id_variable $j
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
alors mot_clef alors
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
echanger id_fonction echanger
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$j id_variable $j
|
|
||||||
, symbole VIRGULE
|
|
||||||
$j id_variable $j
|
|
||||||
+ symbole PLUS
|
|
||||||
1 nombre 1
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$echange id_variable $echange
|
|
||||||
= symbole EGAL
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
$j id_variable $j
|
|
||||||
= symbole EGAL
|
|
||||||
$j id_variable $j
|
|
||||||
+ symbole PLUS
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
$m id_variable $m
|
|
||||||
= symbole EGAL
|
|
||||||
$m id_variable $m
|
|
||||||
- symbole MOINS
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
main id_fonction main
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
initialiser id_fonction initialiser
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
afficher id_fonction afficher
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
10 nombre 10
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
trier id_fonction trier
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
10 nombre 10
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
afficher id_fonction afficher
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
10 nombre 10
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
symbole FIN
|
|
||||||
@@ -1,455 +0,0 @@
|
|||||||
.data
|
|
||||||
$$tab: .space 40
|
|
||||||
.text
|
|
||||||
__start:
|
|
||||||
jal main
|
|
||||||
li $v0, 10
|
|
||||||
syscall
|
|
||||||
initialiser :
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 8
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0,
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 6
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0,
|
|
||||||
li $t0, 2
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 9
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
li $t0, 3
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 9
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, P`ǁ<>
|
|
||||||
li $t0, 4
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 4
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, <01><><EFBFBD>
|
|
||||||
li $t0, 5
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 2
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0,
|
|
||||||
li $t0, 6
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 3
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, @^ǁ<>
|
|
||||||
li $t0, 7
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0,
|
|
||||||
li $t0, 8
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 4
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, sw $t0,
|
|
||||||
li $t0, 9
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 5
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, sw $t0,
|
|
||||||
addi $sp, $sp 0 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
afficher :
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -8($fp) #variable locale
|
|
||||||
e0:
|
|
||||||
lw $t0, -8($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 4($fp) #variable argument $n
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t0, 1
|
|
||||||
blt $t1, $t2 e2
|
|
||||||
li $t0, 0
|
|
||||||
e2:
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0 $0 e1
|
|
||||||
lw $t0, -8($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0,
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
move $a0, $t0
|
|
||||||
li $v0, 1
|
|
||||||
syscall
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall
|
|
||||||
lw $t0, -8($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t1, $t2
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -8($fp) #variable locale
|
|
||||||
j e0
|
|
||||||
e1:
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
move $a0, $t0
|
|
||||||
li $v0, 1
|
|
||||||
syscall
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall
|
|
||||||
addi $sp, $sp 0 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
echanger :
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
lw $t0, 4($fp) #variable argument $j
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, ]ǁ<>
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -8($fp) #variable locale
|
|
||||||
lw $t0, 4($fp) #variable argument $j
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 8($fp) #variable argument $i
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0,
|
|
||||||
lw $t0, 8($fp) #variable argument $i
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, -8($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, $<24>@
|
|
||||||
addi $sp, $sp 0 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
trier :
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
lw $t0, 4($fp) #variable argument $n
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -16($fp) #variable locale
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -8($fp) #variable locale
|
|
||||||
e3:
|
|
||||||
lw $t0, -8($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t0, 1
|
|
||||||
beq $t1, $t2 e5
|
|
||||||
li $t0, 0
|
|
||||||
e5:
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0 $0 e4
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -8($fp) #variable locale
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -12($fp) #variable locale
|
|
||||||
e6:
|
|
||||||
lw $t0, -12($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, -16($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sub $t0, $t1, $t2
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t0, 1
|
|
||||||
blt $t1, $t2 e8
|
|
||||||
li $t0, 0
|
|
||||||
e8:
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0 $0 e7
|
|
||||||
lw $t0, -12($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t1, $t2
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, -12($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t0, 1
|
|
||||||
blt $t1, $t2 e9
|
|
||||||
li $t0, 0
|
|
||||||
e9:
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0 $zero e10
|
|
||||||
sub $sp, $sp, 4 #Val Retour
|
|
||||||
lw $t0, -12($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, -12($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t1, $t2
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
jal echanger
|
|
||||||
addi $sp, $sp, 8
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -8($fp) #variable locale
|
|
||||||
j e11
|
|
||||||
e10:
|
|
||||||
e11:
|
|
||||||
lw $t0, -12($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t1, $t2
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -12($fp) #variable locale
|
|
||||||
j e6
|
|
||||||
e7:
|
|
||||||
lw $t0, -16($fp) #variable locale
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t2, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t1, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sub $t0, $t1, $t2
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, -16($fp) #variable locale
|
|
||||||
j e3
|
|
||||||
e4:
|
|
||||||
addi $sp, $sp 0 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
main :
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
sub $sp, $sp, 4 #Val Retour
|
|
||||||
jal initialiser
|
|
||||||
addi $sp, $sp, 0
|
|
||||||
sub $sp, $sp, 4 #Val Retour
|
|
||||||
li $t0, 10
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
jal afficher
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sub $sp, $sp, 4 #Val Retour
|
|
||||||
li $t0, 10
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
jal trier
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sub $sp, $sp, 4 #Val Retour
|
|
||||||
li $t0, 10
|
|
||||||
subi $sp, $sp, 4
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
jal afficher
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
addi $sp, $sp 12 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp)
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,49 +0,0 @@
|
|||||||
------------------------------------------
|
|
||||||
base = 2
|
|
||||||
sommet = 2
|
|
||||||
0 $tab GLOBALE TABLEAU 0 10
|
|
||||||
1 initialiser GLOBALE FONCTION 0 0
|
|
||||||
------------------------------------------
|
|
||||||
------------------------------------------
|
|
||||||
base = 3
|
|
||||||
sommet = 5
|
|
||||||
0 $tab GLOBALE TABLEAU 0 10
|
|
||||||
1 initialiser GLOBALE FONCTION 0 0
|
|
||||||
2 afficher GLOBALE FONCTION 0 1
|
|
||||||
3 $n ARGUMENT ENTIER 0 -1
|
|
||||||
4 $i LOCALE ENTIER 0 -1
|
|
||||||
------------------------------------------
|
|
||||||
------------------------------------------
|
|
||||||
base = 4
|
|
||||||
sommet = 7
|
|
||||||
0 $tab GLOBALE TABLEAU 0 10
|
|
||||||
1 initialiser GLOBALE FONCTION 0 0
|
|
||||||
2 afficher GLOBALE FONCTION 0 1
|
|
||||||
3 echanger GLOBALE FONCTION 0 2
|
|
||||||
4 $i ARGUMENT ENTIER 0 -1
|
|
||||||
5 $j ARGUMENT ENTIER 4 -1
|
|
||||||
6 $temp LOCALE ENTIER 0 -1
|
|
||||||
------------------------------------------
|
|
||||||
------------------------------------------
|
|
||||||
base = 5
|
|
||||||
sommet = 9
|
|
||||||
0 $tab GLOBALE TABLEAU 0 10
|
|
||||||
1 initialiser GLOBALE FONCTION 0 0
|
|
||||||
2 afficher GLOBALE FONCTION 0 1
|
|
||||||
3 echanger GLOBALE FONCTION 0 2
|
|
||||||
4 trier GLOBALE FONCTION 0 1
|
|
||||||
5 $n ARGUMENT ENTIER 0 -1
|
|
||||||
6 $echange LOCALE ENTIER 0 -1
|
|
||||||
7 $j LOCALE ENTIER 4 -1
|
|
||||||
8 $m LOCALE ENTIER 8 -1
|
|
||||||
------------------------------------------
|
|
||||||
------------------------------------------
|
|
||||||
base = 6
|
|
||||||
sommet = 6
|
|
||||||
0 $tab GLOBALE TABLEAU 0 10
|
|
||||||
1 initialiser GLOBALE FONCTION 0 0
|
|
||||||
2 afficher GLOBALE FONCTION 0 1
|
|
||||||
3 echanger GLOBALE FONCTION 0 2
|
|
||||||
4 trier GLOBALE FONCTION 0 1
|
|
||||||
5 main GLOBALE FONCTION 0 0
|
|
||||||
------------------------------------------
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<prog>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$a</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
main
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$a</var_simple>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$a</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
</l_dec>
|
|
||||||
</prog>
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
<prog>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$i</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$carre</varDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
main
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_tantque>
|
|
||||||
<opExp>
|
|
||||||
inf
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>10</intExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$carre</var_simple>
|
|
||||||
<opExp>
|
|
||||||
fois
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$carre</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
<opExp>
|
|
||||||
plus
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</instr_tantque>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
</l_dec>
|
|
||||||
</prog>
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<prog>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$a</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
main
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<opExp>
|
|
||||||
fois
|
|
||||||
<intExp>5</intExp>
|
|
||||||
<intExp>2</intExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
</l_dec>
|
|
||||||
</prog>
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
<prog>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
max
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$a</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$b</varDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
<l_instr>
|
|
||||||
<instr_si>
|
|
||||||
<opExp>
|
|
||||||
inf
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$a</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$b</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_retour>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$b</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_retour>
|
|
||||||
</l_instr>
|
|
||||||
</instr_si>
|
|
||||||
<l_instr>
|
|
||||||
<instr_retour>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$a</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_retour>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
main
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$v_1</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$v_2</varDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$v_1</var_simple>
|
|
||||||
<lireExp>
|
|
||||||
</lireExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$v_2</var_simple>
|
|
||||||
<lireExp>
|
|
||||||
</lireExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_si>
|
|
||||||
<opExp>
|
|
||||||
egal
|
|
||||||
<appelExp>
|
|
||||||
<appel>
|
|
||||||
max
|
|
||||||
<l_exp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$v_1</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<l_exp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$v_2</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</appelExp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$v_1</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$v_1</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
</l_instr>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$v_2</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
</l_instr>
|
|
||||||
</instr_si>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</prog>
|
|
||||||
@@ -1,418 +0,0 @@
|
|||||||
<prog>
|
|
||||||
<l_dec>
|
|
||||||
<tabDec>$tab[10]</tabDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
initialiser
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>8</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>6</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>2</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>9</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>3</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>9</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>4</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>4</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>5</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>2</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>6</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>3</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>7</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>8</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>4</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<intExp>9</intExp>
|
|
||||||
</var_indicee>
|
|
||||||
<intExp>5</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
afficher
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$n</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$i</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_tantque>
|
|
||||||
<opExp>
|
|
||||||
inf
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$n</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<varExp>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
</varExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
<opExp>
|
|
||||||
plus
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</instr_tantque>
|
|
||||||
<l_instr>
|
|
||||||
<instr_ecrire>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</instr_ecrire>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
echanger
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$i</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$j</varDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$temp</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$temp</var_simple>
|
|
||||||
<varExp>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
</varExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
<varExp>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
</varExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$i</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$temp</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
trier
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$n</varDec>
|
|
||||||
</l_dec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$echange</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$j</varDec>
|
|
||||||
<l_dec>
|
|
||||||
<varDec>$m</varDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$m</var_simple>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$n</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$echange</var_simple>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_tantque>
|
|
||||||
<opExp>
|
|
||||||
egal
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$echange</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$echange</var_simple>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
<intExp>0</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
<l_instr>
|
|
||||||
<instr_tantque>
|
|
||||||
<opExp>
|
|
||||||
inf
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<opExp>
|
|
||||||
moins
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$m</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_si>
|
|
||||||
<opExp>
|
|
||||||
inf
|
|
||||||
<varExp>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<opExp>
|
|
||||||
plus
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</var_indicee>
|
|
||||||
</varExp>
|
|
||||||
<varExp>
|
|
||||||
<var_indicee>
|
|
||||||
<var_base_tableau>$tab</var_base_tableau>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
</var_indicee>
|
|
||||||
</varExp>
|
|
||||||
</opExp>
|
|
||||||
<l_instr>
|
|
||||||
<instr_appel>
|
|
||||||
<appel>
|
|
||||||
echanger
|
|
||||||
<l_exp>
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<l_exp>
|
|
||||||
<opExp>
|
|
||||||
plus
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</instr_appel>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$echange</var_simple>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</instr_si>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
<opExp>
|
|
||||||
plus
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$j</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</instr_tantque>
|
|
||||||
<l_instr>
|
|
||||||
<instr_affect>
|
|
||||||
<var_simple>$m</var_simple>
|
|
||||||
<opExp>
|
|
||||||
moins
|
|
||||||
<varExp>
|
|
||||||
<var_simple>$m</var_simple>
|
|
||||||
</varExp>
|
|
||||||
<intExp>1</intExp>
|
|
||||||
</opExp>
|
|
||||||
</instr_affect>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</instr_tantque>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
<l_dec>
|
|
||||||
<foncDec>
|
|
||||||
main
|
|
||||||
<l_instr>
|
|
||||||
<instr_appel>
|
|
||||||
<appel>
|
|
||||||
initialiser
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</instr_appel>
|
|
||||||
<l_instr>
|
|
||||||
<instr_appel>
|
|
||||||
<appel>
|
|
||||||
afficher
|
|
||||||
<l_exp>
|
|
||||||
<intExp>10</intExp>
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</instr_appel>
|
|
||||||
<l_instr>
|
|
||||||
<instr_appel>
|
|
||||||
<appel>
|
|
||||||
trier
|
|
||||||
<l_exp>
|
|
||||||
<intExp>10</intExp>
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</instr_appel>
|
|
||||||
<l_instr>
|
|
||||||
<instr_appel>
|
|
||||||
<appel>
|
|
||||||
afficher
|
|
||||||
<l_exp>
|
|
||||||
<intExp>10</intExp>
|
|
||||||
<l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</l_exp>
|
|
||||||
</appel>
|
|
||||||
</instr_appel>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</l_instr>
|
|
||||||
</foncDec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</l_dec>
|
|
||||||
</prog>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
entier mot_clef entier
|
|
||||||
$a id_variable $a
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
main id_fonction main
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$a id_variable $a
|
|
||||||
= symbole EGAL
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$a id_variable $a
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
symbole FIN
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
entier mot_clef entier
|
|
||||||
$i id_variable $i
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$carre id_variable $carre
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
main id_fonction main
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$i id_variable $i
|
|
||||||
= symbole EGAL
|
|
||||||
0 nombre 0
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
tantque mot_clef tantque
|
|
||||||
$i id_variable $i
|
|
||||||
< symbole INFERIEUR
|
|
||||||
10 nombre 10
|
|
||||||
faire mot_clef faire
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$carre id_variable $carre
|
|
||||||
= symbole EGAL
|
|
||||||
$i id_variable $i
|
|
||||||
* symbole FOIS
|
|
||||||
$i id_variable $i
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$carre id_variable $carre
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$i id_variable $i
|
|
||||||
= symbole EGAL
|
|
||||||
$i id_variable $i
|
|
||||||
+ symbole PLUS
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
symbole FIN
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
entier mot_clef entier
|
|
||||||
$a id_variable $a
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
main id_fonction main
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
5 nombre 5
|
|
||||||
* symbole FOIS
|
|
||||||
2 nombre 2
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
symbole FIN
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
max id_fonction max
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$a id_variable $a
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$b id_variable $b
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
si mot_clef si
|
|
||||||
$a id_variable $a
|
|
||||||
< symbole INFERIEUR
|
|
||||||
$b id_variable $b
|
|
||||||
alors mot_clef alors
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
retour mot_clef retour
|
|
||||||
$b id_variable $b
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
retour mot_clef retour
|
|
||||||
$a id_variable $a
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
main id_fonction main
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$v_1 id_variable $v_1
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$v_2 id_variable $v_2
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$v_1 id_variable $v_1
|
|
||||||
= symbole EGAL
|
|
||||||
lire mot_clef lire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$v_2 id_variable $v_2
|
|
||||||
= symbole EGAL
|
|
||||||
lire mot_clef lire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
si mot_clef si
|
|
||||||
max id_fonction max
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$v_1 id_variable $v_1
|
|
||||||
, symbole VIRGULE
|
|
||||||
$v_2 id_variable $v_2
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
= symbole EGAL
|
|
||||||
$v_1 id_variable $v_1
|
|
||||||
alors mot_clef alors
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$v_1 id_variable $v_1
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
sinon mot_clef sinon
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$v_2 id_variable $v_2
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
symbole FIN
|
|
||||||
@@ -1,271 +0,0 @@
|
|||||||
entier mot_clef entier
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
10 nombre 10
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
initialiser id_fonction initialiser
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
0 nombre 0
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
8 nombre 8
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
1 nombre 1
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
6 nombre 6
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
2 nombre 2
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
9 nombre 9
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
3 nombre 3
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
9 nombre 9
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
4 nombre 4
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
4 nombre 4
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
5 nombre 5
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
2 nombre 2
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
6 nombre 6
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
3 nombre 3
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
7 nombre 7
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
8 nombre 8
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
4 nombre 4
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
9 nombre 9
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
5 nombre 5
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
afficher id_fonction afficher
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$n id_variable $n
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$i id_variable $i
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$i id_variable $i
|
|
||||||
= symbole EGAL
|
|
||||||
0 nombre 0
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
tantque mot_clef tantque
|
|
||||||
$i id_variable $i
|
|
||||||
< symbole INFERIEUR
|
|
||||||
$n id_variable $n
|
|
||||||
faire mot_clef faire
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$i id_variable $i
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$i id_variable $i
|
|
||||||
= symbole EGAL
|
|
||||||
$i id_variable $i
|
|
||||||
+ symbole PLUS
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
ecrire mot_clef ecrire
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
0 nombre 0
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
echanger id_fonction echanger
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$i id_variable $i
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$j id_variable $j
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$temp id_variable $temp
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$temp id_variable $temp
|
|
||||||
= symbole EGAL
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$j id_variable $j
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$j id_variable $j
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$i id_variable $i
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$i id_variable $i
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
= symbole EGAL
|
|
||||||
$temp id_variable $temp
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
trier id_fonction trier
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$n id_variable $n
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
entier mot_clef entier
|
|
||||||
$echange id_variable $echange
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$j id_variable $j
|
|
||||||
, symbole VIRGULE
|
|
||||||
entier mot_clef entier
|
|
||||||
$m id_variable $m
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$m id_variable $m
|
|
||||||
= symbole EGAL
|
|
||||||
$n id_variable $n
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$echange id_variable $echange
|
|
||||||
= symbole EGAL
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
tantque mot_clef tantque
|
|
||||||
$echange id_variable $echange
|
|
||||||
= symbole EGAL
|
|
||||||
1 nombre 1
|
|
||||||
faire mot_clef faire
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
$echange id_variable $echange
|
|
||||||
= symbole EGAL
|
|
||||||
0 nombre 0
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$j id_variable $j
|
|
||||||
= symbole EGAL
|
|
||||||
0 nombre 0
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
tantque mot_clef tantque
|
|
||||||
$j id_variable $j
|
|
||||||
< symbole INFERIEUR
|
|
||||||
$m id_variable $m
|
|
||||||
- symbole MOINS
|
|
||||||
1 nombre 1
|
|
||||||
faire mot_clef faire
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
si mot_clef si
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$j id_variable $j
|
|
||||||
+ symbole PLUS
|
|
||||||
1 nombre 1
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
< symbole INFERIEUR
|
|
||||||
$tab id_variable $tab
|
|
||||||
[ symbole CROCHET_OUVRANT
|
|
||||||
$j id_variable $j
|
|
||||||
] symbole CROCHET_FERMANT
|
|
||||||
alors mot_clef alors
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
echanger id_fonction echanger
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
$j id_variable $j
|
|
||||||
, symbole VIRGULE
|
|
||||||
$j id_variable $j
|
|
||||||
+ symbole PLUS
|
|
||||||
1 nombre 1
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
$echange id_variable $echange
|
|
||||||
= symbole EGAL
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
$j id_variable $j
|
|
||||||
= symbole EGAL
|
|
||||||
$j id_variable $j
|
|
||||||
+ symbole PLUS
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
$m id_variable $m
|
|
||||||
= symbole EGAL
|
|
||||||
$m id_variable $m
|
|
||||||
- symbole MOINS
|
|
||||||
1 nombre 1
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
main id_fonction main
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
{ symbole ACCOLADE_OUVRANTE
|
|
||||||
initialiser id_fonction initialiser
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
afficher id_fonction afficher
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
10 nombre 10
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
trier id_fonction trier
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
10 nombre 10
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
afficher id_fonction afficher
|
|
||||||
( symbole PARENTHESE_OUVRANTE
|
|
||||||
10 nombre 10
|
|
||||||
) symbole PARENTHESE_FERMANTE
|
|
||||||
; symbole POINT_VIRGULE
|
|
||||||
} symbole ACCOLADE_FERMANTE
|
|
||||||
symbole FIN
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
.data
|
|
||||||
$a: .space 4
|
|
||||||
|
|
||||||
.text
|
|
||||||
__start:
|
|
||||||
jal main
|
|
||||||
li $v0, 10
|
|
||||||
syscall # stoppe l'execution du processus
|
|
||||||
main:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp # nouvelle valeur de $fp
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $a # stocke variable
|
|
||||||
lw $t1, $a # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $a0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $v0, 1
|
|
||||||
syscall # ecriture
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall # ecrire char
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
.data
|
|
||||||
$i: .space 4
|
|
||||||
$carre: .space 4
|
|
||||||
|
|
||||||
.text
|
|
||||||
__start:
|
|
||||||
jal main
|
|
||||||
li $v0, 10
|
|
||||||
syscall # stoppe l'execution du processus
|
|
||||||
main:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp # nouvelle valeur de $fp
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $i # stocke variable
|
|
||||||
e0:
|
|
||||||
lw $t1, $i # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
li $t0, 10
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t2, -1 # inf
|
|
||||||
blt $t0, $t1, e2
|
|
||||||
li $t2, 0
|
|
||||||
e2:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0, $zero, e1
|
|
||||||
lw $t1, $i # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, $i # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
mult $t0, $t1
|
|
||||||
mflo $t2
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $carre # stocke variable
|
|
||||||
lw $t1, $carre # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $a0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $v0, 1
|
|
||||||
syscall # ecriture
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall # ecrire char
|
|
||||||
lw $t1, $i # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t2, $t0, $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $i # stocke variable
|
|
||||||
j e0
|
|
||||||
e1:
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
.data
|
|
||||||
$a: .space 4
|
|
||||||
|
|
||||||
.text
|
|
||||||
__start:
|
|
||||||
jal main
|
|
||||||
li $v0, 10
|
|
||||||
syscall # stoppe l'execution du processus
|
|
||||||
main:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp # nouvelle valeur de $fp
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
li $t0, 5
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 2
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
mult $t0, $t1
|
|
||||||
mflo $t2
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $a0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $v0, 1
|
|
||||||
syscall # ecriture
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall # ecrire char
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
.data
|
|
||||||
|
|
||||||
.text
|
|
||||||
__start:
|
|
||||||
jal main
|
|
||||||
li $v0, 10
|
|
||||||
syscall # stoppe l'execution du processus
|
|
||||||
max:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp # nouvelle valeur de $fp
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
lw $t1, 8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 4($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t2, -1 # inf
|
|
||||||
blt $t0, $t1, e2
|
|
||||||
li $t2, 0
|
|
||||||
e2:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0, $zero, e1
|
|
||||||
lw $t1, 4($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, 12($fp) # ecriture de la valeur de retour
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
e1:
|
|
||||||
lw $t1, 8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t0, 12($fp) # ecriture de la valeur de retour
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
main:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp # nouvelle valeur de $fp
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
subi $sp, $sp, 8 # allocation variables locales
|
|
||||||
li $v0, 5
|
|
||||||
syscall # lecture
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $v0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -8($fp) # stocke variable
|
|
||||||
li $v0, 5
|
|
||||||
syscall # lecture
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $v0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -12($fp) # stocke variable
|
|
||||||
subi $sp, $sp, 4 # allocation valeur de retour
|
|
||||||
# empile arg 0
|
|
||||||
lw $t1, -8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
# empile arg 1
|
|
||||||
lw $t1, -12($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
jal max
|
|
||||||
addi $sp, $sp, 8 # desallocation parametres
|
|
||||||
lw $t1, -8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t2, -1 # egal
|
|
||||||
beq $t0, $t1, e5
|
|
||||||
li $t2, 0
|
|
||||||
e5:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0, $zero, e3
|
|
||||||
lw $t1, -8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $a0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $v0, 1
|
|
||||||
syscall # ecriture
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall # ecrire char
|
|
||||||
j e4
|
|
||||||
e3:
|
|
||||||
lw $t1, -12($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $a0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $v0, 1
|
|
||||||
syscall # ecriture
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall # ecrire char
|
|
||||||
e4:
|
|
||||||
addi $sp, $sp, 8 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
@@ -1,525 +0,0 @@
|
|||||||
.data
|
|
||||||
$tab: .space 40
|
|
||||||
|
|
||||||
.text
|
|
||||||
__start:
|
|
||||||
jal main
|
|
||||||
li $v0, 10
|
|
||||||
syscall # stoppe l'execution du processus
|
|
||||||
initialiser:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp # nouvelle valeur de $fp
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
li $t0, 8
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
li $t0, 6
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
li $t0, 9
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 2
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
li $t0, 9
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 3
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
li $t0, 4
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 4
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
li $t0, 2
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 5
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
li $t0, 3
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 6
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 7
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
li $t0, 4
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 8
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
li $t0, 5
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
li $t0, 9
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
afficher:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp # nouvelle valeur de $fp
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
subi $sp, $sp, 4 # allocation variables locales
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -8($fp) # stocke variable
|
|
||||||
e0:
|
|
||||||
lw $t1, -8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 4($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t2, -1 # inf
|
|
||||||
blt $t0, $t1, e2
|
|
||||||
li $t2, 0
|
|
||||||
e2:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0, $zero, e1
|
|
||||||
lw $t1, -8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, $tab($t0) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $a0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $v0, 1
|
|
||||||
syscall # ecriture
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall # ecrire char
|
|
||||||
lw $t1, -8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t2, $t0, $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -8($fp) # stocke variable
|
|
||||||
j e0
|
|
||||||
e1:
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $a0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $v0, 1
|
|
||||||
syscall # ecriture
|
|
||||||
li $a0, '\n'
|
|
||||||
li $v0, 11
|
|
||||||
syscall # ecrire char
|
|
||||||
addi $sp, $sp, 4 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
echanger:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp # nouvelle valeur de $fp
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
subi $sp, $sp, 4 # allocation variables locales
|
|
||||||
lw $t1, 4($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, $tab($t0) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -8($fp) # stocke variable
|
|
||||||
lw $t1, 8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, $tab($t0) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 4($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
lw $t1, -8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, $tab($t0) # stocke variable
|
|
||||||
addi $sp, $sp, 4 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
trier:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp # nouvelle valeur de $fp
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
subi $sp, $sp, 12 # allocation variables locales
|
|
||||||
lw $t1, 4($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -16($fp) # stocke variable
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -8($fp) # stocke variable
|
|
||||||
e3:
|
|
||||||
lw $t1, -8($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t2, -1 # egal
|
|
||||||
beq $t0, $t1, e5
|
|
||||||
li $t2, 0
|
|
||||||
e5:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0, $zero, e4
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -8($fp) # stocke variable
|
|
||||||
li $t0, 0
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -12($fp) # stocke variable
|
|
||||||
e6:
|
|
||||||
lw $t1, -12($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, -16($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sub $t2, $t0, $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t2, -1 # inf
|
|
||||||
blt $t0, $t1, e8
|
|
||||||
li $t2, 0
|
|
||||||
e8:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0, $zero, e7
|
|
||||||
lw $t1, -12($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t2, $t0, $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, $tab($t0) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, -12($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
add $t0, $t0, $t0
|
|
||||||
lw $t1, $tab($t0) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
li $t2, -1 # inf
|
|
||||||
blt $t0, $t1, e11
|
|
||||||
li $t2, 0
|
|
||||||
e11:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
beq $t0, $zero, e10
|
|
||||||
subi $sp, $sp, 4 # allocation valeur de retour
|
|
||||||
# empile arg 0
|
|
||||||
lw $t1, -12($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
# empile arg 1
|
|
||||||
lw $t1, -12($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t2, $t0, $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
jal echanger
|
|
||||||
addi $sp, $sp, 8 # desallocation parametres
|
|
||||||
addi $sp, $sp, 4 # valeur de retour ignoree
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -8($fp) # stocke variable
|
|
||||||
e10:
|
|
||||||
lw $t1, -12($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
add $t2, $t0, $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -12($fp) # stocke variable
|
|
||||||
j e6
|
|
||||||
e7:
|
|
||||||
lw $t1, -16($fp) # lit variable dans $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t1, 0($sp)
|
|
||||||
li $t0, 1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $t0, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sub $t2, $t0, $t1
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t2, 0($sp)
|
|
||||||
lw $t1, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
sw $t1, -16($fp) # stocke variable
|
|
||||||
j e3
|
|
||||||
e4:
|
|
||||||
addi $sp, $sp, 12 # desallocation variables locales
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
main:
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $fp, 0($sp)
|
|
||||||
move $fp, $sp # nouvelle valeur de $fp
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $ra, 0($sp)
|
|
||||||
subi $sp, $sp, 4 # allocation valeur de retour
|
|
||||||
jal initialiser
|
|
||||||
addi $sp, $sp, 4 # valeur de retour ignoree
|
|
||||||
subi $sp, $sp, 4 # allocation valeur de retour
|
|
||||||
# empile arg 0
|
|
||||||
li $t0, 10
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
jal afficher
|
|
||||||
addi $sp, $sp, 4 # desallocation parametres
|
|
||||||
addi $sp, $sp, 4 # valeur de retour ignoree
|
|
||||||
subi $sp, $sp, 4 # allocation valeur de retour
|
|
||||||
# empile arg 0
|
|
||||||
li $t0, 10
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
jal trier
|
|
||||||
addi $sp, $sp, 4 # desallocation parametres
|
|
||||||
addi $sp, $sp, 4 # valeur de retour ignoree
|
|
||||||
subi $sp, $sp, 4 # allocation valeur de retour
|
|
||||||
# empile arg 0
|
|
||||||
li $t0, 10
|
|
||||||
subi $sp, $sp, 4 # empile registre
|
|
||||||
sw $t0, 0($sp)
|
|
||||||
jal afficher
|
|
||||||
addi $sp, $sp, 4 # desallocation parametres
|
|
||||||
addi $sp, $sp, 4 # valeur de retour ignoree
|
|
||||||
lw $ra, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
lw $fp, 0($sp) # depile vers registre
|
|
||||||
addi $sp, $sp, 4
|
|
||||||
jr $ra
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
<programme>
|
|
||||||
<optDecVariables>
|
|
||||||
<listeDecVariables>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariables>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</optDecVariables>
|
|
||||||
<listeDecFonctions>
|
|
||||||
<declarationFonction>
|
|
||||||
<id_fonction>main</id_fonction>
|
|
||||||
<listeParam>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<optListeDecVariables>
|
|
||||||
</optListeDecVariables>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</listeParam>
|
|
||||||
<optDecVariables>
|
|
||||||
</optDecVariables>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<nombre>1</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionEcriture>
|
|
||||||
<mot_clef>ecrire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionEcriture>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</declarationFonction>
|
|
||||||
<listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</programme>
|
|
||||||
@@ -1,283 +0,0 @@
|
|||||||
<programme>
|
|
||||||
<optDecVariables>
|
|
||||||
<listeDecVariables>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
<symbole>VIRGULE</symbole>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$carre</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariables>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</optDecVariables>
|
|
||||||
<listeDecFonctions>
|
|
||||||
<declarationFonction>
|
|
||||||
<id_fonction>main</id_fonction>
|
|
||||||
<listeParam>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<optListeDecVariables>
|
|
||||||
</optListeDecVariables>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</listeParam>
|
|
||||||
<optDecVariables>
|
|
||||||
</optDecVariables>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<nombre>0</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionTantque>
|
|
||||||
<mot_clef>tantque</mot_clef>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
<symbole>INFERIEUR</symbole>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<nombre>10</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<mot_clef>faire</mot_clef>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$carre</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
<symbole>FOIS</symbole>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionEcriture>
|
|
||||||
<mot_clef>ecrire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$carre</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionEcriture>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$i</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
<symbole>PLUS</symbole>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<nombre>1</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</instructionTantque>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</declarationFonction>
|
|
||||||
<listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</programme>
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
<programme>
|
|
||||||
<optDecVariables>
|
|
||||||
<listeDecVariables>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariables>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</optDecVariables>
|
|
||||||
<listeDecFonctions>
|
|
||||||
<declarationFonction>
|
|
||||||
<id_fonction>main</id_fonction>
|
|
||||||
<listeParam>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<optListeDecVariables>
|
|
||||||
</optListeDecVariables>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</listeParam>
|
|
||||||
<optDecVariables>
|
|
||||||
</optDecVariables>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionEcriture>
|
|
||||||
<mot_clef>ecrire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<nombre>5</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
<symbole>FOIS</symbole>
|
|
||||||
<facteur>
|
|
||||||
<nombre>2</nombre>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionEcriture>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</declarationFonction>
|
|
||||||
<listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</programme>
|
|
||||||
@@ -1,513 +0,0 @@
|
|||||||
<programme>
|
|
||||||
<optDecVariables>
|
|
||||||
</optDecVariables>
|
|
||||||
<listeDecFonctions>
|
|
||||||
<declarationFonction>
|
|
||||||
<id_fonction>max</id_fonction>
|
|
||||||
<listeParam>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<optListeDecVariables>
|
|
||||||
<listeDecVariables>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
<symbole>VIRGULE</symbole>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$b</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariables>
|
|
||||||
</optListeDecVariables>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</listeParam>
|
|
||||||
<optDecVariables>
|
|
||||||
</optDecVariables>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionSi>
|
|
||||||
<mot_clef>si</mot_clef>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
<symbole>INFERIEUR</symbole>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$b</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<mot_clef>alors</mot_clef>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionRetour>
|
|
||||||
<mot_clef>retour</mot_clef>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$b</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionRetour>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
<optSinon>
|
|
||||||
</optSinon>
|
|
||||||
</instructionSi>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionRetour>
|
|
||||||
<mot_clef>retour</mot_clef>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$a</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionRetour>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</declarationFonction>
|
|
||||||
<listeDecFonctions>
|
|
||||||
<declarationFonction>
|
|
||||||
<id_fonction>main</id_fonction>
|
|
||||||
<listeParam>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<optListeDecVariables>
|
|
||||||
</optListeDecVariables>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</listeParam>
|
|
||||||
<optDecVariables>
|
|
||||||
<listeDecVariables>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$v_1</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
<symbole>VIRGULE</symbole>
|
|
||||||
<declarationVariable>
|
|
||||||
<mot_clef>entier</mot_clef>
|
|
||||||
<id_variable>$v_2</id_variable>
|
|
||||||
<optTailleTableau>
|
|
||||||
</optTailleTableau>
|
|
||||||
</declarationVariable>
|
|
||||||
<listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariablesBis>
|
|
||||||
</listeDecVariables>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</optDecVariables>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_1</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<mot_clef>lire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionAffect>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_2</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<mot_clef>lire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionAffect>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionSi>
|
|
||||||
<mot_clef>si</mot_clef>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<appelFct>
|
|
||||||
<id_fonction>max</id_fonction>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<listeExpressions>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_1</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<listeExpressionsBis>
|
|
||||||
<symbole>VIRGULE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_2</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<listeExpressionsBis>
|
|
||||||
</listeExpressionsBis>
|
|
||||||
</listeExpressionsBis>
|
|
||||||
</listeExpressions>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
</appelFct>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
<symbole>EGAL</symbole>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_1</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<mot_clef>alors</mot_clef>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionEcriture>
|
|
||||||
<mot_clef>ecrire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_1</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionEcriture>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
<optSinon>
|
|
||||||
<mot_clef>sinon</mot_clef>
|
|
||||||
<instructionBloc>
|
|
||||||
<symbole>ACCOLADE_OUVRANTE</symbole>
|
|
||||||
<listeInstructions>
|
|
||||||
<instruction>
|
|
||||||
<instructionEcriture>
|
|
||||||
<mot_clef>ecrire</mot_clef>
|
|
||||||
<symbole>PARENTHESE_OUVRANTE</symbole>
|
|
||||||
<expression>
|
|
||||||
<conjonction>
|
|
||||||
<negation>
|
|
||||||
<comparaison>
|
|
||||||
<expArith>
|
|
||||||
<terme>
|
|
||||||
<facteur>
|
|
||||||
<var>
|
|
||||||
<id_variable>$v_2</id_variable>
|
|
||||||
<optIndice>
|
|
||||||
</optIndice>
|
|
||||||
</var>
|
|
||||||
</facteur>
|
|
||||||
<termeBis>
|
|
||||||
</termeBis>
|
|
||||||
</terme>
|
|
||||||
<expArithBis>
|
|
||||||
</expArithBis>
|
|
||||||
</expArith>
|
|
||||||
<comparaisonBis>
|
|
||||||
</comparaisonBis>
|
|
||||||
</comparaison>
|
|
||||||
</negation>
|
|
||||||
<conjonctionBis>
|
|
||||||
</conjonctionBis>
|
|
||||||
</conjonction>
|
|
||||||
<expressionBis>
|
|
||||||
</expressionBis>
|
|
||||||
</expression>
|
|
||||||
<symbole>PARENTHESE_FERMANTE</symbole>
|
|
||||||
<symbole>POINT_VIRGULE</symbole>
|
|
||||||
</instructionEcriture>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</optSinon>
|
|
||||||
</instructionSi>
|
|
||||||
</instruction>
|
|
||||||
<listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
</listeInstructions>
|
|
||||||
<symbole>ACCOLADE_FERMANTE</symbole>
|
|
||||||
</instructionBloc>
|
|
||||||
</declarationFonction>
|
|
||||||
<listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</listeDecFonctions>
|
|
||||||
</programme>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +0,0 @@
|
|||||||
------------------------------------------
|
|
||||||
base = 2
|
|
||||||
sommet = 2
|
|
||||||
0 $a GLOBALE ENTIER 0 -1
|
|
||||||
1 main GLOBALE FONCTION 0 0
|
|
||||||
------------------------------------------
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
------------------------------------------
|
|
||||||
base = 3
|
|
||||||
sommet = 3
|
|
||||||
0 $i GLOBALE ENTIER 0 -1
|
|
||||||
1 $carre GLOBALE ENTIER 4 -1
|
|
||||||
2 main GLOBALE FONCTION 0 0
|
|
||||||
------------------------------------------
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
------------------------------------------
|
|
||||||
base = 2
|
|
||||||
sommet = 2
|
|
||||||
0 $a GLOBALE ENTIER 0 -1
|
|
||||||
1 main GLOBALE FONCTION 0 0
|
|
||||||
------------------------------------------
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
------------------------------------------
|
|
||||||
base = 1
|
|
||||||
sommet = 3
|
|
||||||
0 max GLOBALE FONCTION 0 2
|
|
||||||
1 $a ARGUMENT ENTIER 0 -1
|
|
||||||
2 $b ARGUMENT ENTIER 4 -1
|
|
||||||
------------------------------------------
|
|
||||||
------------------------------------------
|
|
||||||
base = 2
|
|
||||||
sommet = 4
|
|
||||||
0 max GLOBALE FONCTION 0 2
|
|
||||||
1 main GLOBALE FONCTION 0 0
|
|
||||||
2 $v_1 LOCALE ENTIER 0 -1
|
|
||||||
3 $v_2 LOCALE ENTIER 4 -1
|
|
||||||
------------------------------------------
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
------------------------------------------
|
|
||||||
base = 2
|
|
||||||
sommet = 2
|
|
||||||
0 $tab GLOBALE TABLEAU 0 10
|
|
||||||
1 initialiser GLOBALE FONCTION 0 0
|
|
||||||
------------------------------------------
|
|
||||||
------------------------------------------
|
|
||||||
base = 3
|
|
||||||
sommet = 5
|
|
||||||
0 $tab GLOBALE TABLEAU 0 10
|
|
||||||
1 initialiser GLOBALE FONCTION 0 0
|
|
||||||
2 afficher GLOBALE FONCTION 0 1
|
|
||||||
3 $n ARGUMENT ENTIER 0 -1
|
|
||||||
4 $i LOCALE ENTIER 0 -1
|
|
||||||
------------------------------------------
|
|
||||||
------------------------------------------
|
|
||||||
base = 4
|
|
||||||
sommet = 7
|
|
||||||
0 $tab GLOBALE TABLEAU 0 10
|
|
||||||
1 initialiser GLOBALE FONCTION 0 0
|
|
||||||
2 afficher GLOBALE FONCTION 0 1
|
|
||||||
3 echanger GLOBALE FONCTION 0 2
|
|
||||||
4 $i ARGUMENT ENTIER 0 -1
|
|
||||||
5 $j ARGUMENT ENTIER 4 -1
|
|
||||||
6 $temp LOCALE ENTIER 0 -1
|
|
||||||
------------------------------------------
|
|
||||||
------------------------------------------
|
|
||||||
base = 5
|
|
||||||
sommet = 9
|
|
||||||
0 $tab GLOBALE TABLEAU 0 10
|
|
||||||
1 initialiser GLOBALE FONCTION 0 0
|
|
||||||
2 afficher GLOBALE FONCTION 0 1
|
|
||||||
3 echanger GLOBALE FONCTION 0 2
|
|
||||||
4 trier GLOBALE FONCTION 0 1
|
|
||||||
5 $n ARGUMENT ENTIER 0 -1
|
|
||||||
6 $echange LOCALE ENTIER 0 -1
|
|
||||||
7 $j LOCALE ENTIER 4 -1
|
|
||||||
8 $m LOCALE ENTIER 8 -1
|
|
||||||
------------------------------------------
|
|
||||||
------------------------------------------
|
|
||||||
base = 6
|
|
||||||
sommet = 6
|
|
||||||
0 $tab GLOBALE TABLEAU 0 10
|
|
||||||
1 initialiser GLOBALE FONCTION 0 0
|
|
||||||
2 afficher GLOBALE FONCTION 0 1
|
|
||||||
3 echanger GLOBALE FONCTION 0 2
|
|
||||||
4 trier GLOBALE FONCTION 0 1
|
|
||||||
5 main GLOBALE FONCTION 0 0
|
|
||||||
------------------------------------------
|
|
||||||
@@ -1,251 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# Script d'évaluation automatique du compilateur.
|
|
||||||
# Compile le programme source et compare la sortie avec la référence.
|
|
||||||
# Pour le code MIPS, compare la SORTIE de l'exécution sur Mars
|
|
||||||
# Comprend
|
|
||||||
# * analyse lexicale,
|
|
||||||
# * analyse syntaxique,
|
|
||||||
# * arbre abstrait,
|
|
||||||
# * table des symboles et
|
|
||||||
# * code MIPS.
|
|
||||||
#
|
|
||||||
# ATTENTION : pour que le script marche, votre compilateur doit returner 0 em
|
|
||||||
# cas de succès, autre valeur en cas d'erreur (entrée ne compile pas
|
|
||||||
# correctement) et doit permettre d'afficher les sorties sur stdout, sauf
|
|
||||||
# éventuels messages d'erreur, sur stderr. On doit pouvoir, à tout moment,
|
|
||||||
# changer le type de sortie (lex, synt, asynt, tab, mips) avec des options.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
### LLL IIIIIII RRRRRRR EEEEEEEEE ||||
|
|
||||||
### LLL III RRR RRR EEEEEEEEE ||||
|
|
||||||
### LLL III RRR RR EEE ||||
|
|
||||||
### LLL III RRR RRR EEEEEEEE ||||
|
|
||||||
### LLL III RRRRRRR EEEEEEEE \\\\////
|
|
||||||
### LLL III RRR RRR EEE \\\///
|
|
||||||
### LLLLLLLL III RRR RRR EEEEEEEE \\//
|
|
||||||
### LLLLLLLL IIIIIII RRR RRR EEEEEEEEE \/
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# 1) MODIFIEZ LA VARIABLE CI-DESSOUS AVEC LE CHEMIN VERS VOTRE COMPILATEUR
|
|
||||||
|
|
||||||
MYCOMPILO="../compilateur-l"
|
|
||||||
|
|
||||||
# 2) DÉCOMMENTEZ + MODIFIEZ LES COMMANDES POUR GÉNÉRER LES DIFFÉRENTES SORTIES
|
|
||||||
|
|
||||||
MYCOMPILODEFAULT="${MYCOMPILO}" # utilisé pour test reconnaissance et erreur
|
|
||||||
MYCOMPILOLEX="${MYCOMPILO} -l" # exécuter l'analyseur lexical
|
|
||||||
MYCOMPILOSYNT="${MYCOMPILO} -s" # exécuter l'analyseur syntaxique
|
|
||||||
MYCOMPILOASYNT="${MYCOMPILO} -a" # afficher l'arbre abstrait
|
|
||||||
MYCOMPILOTAB="${MYCOMPILO} -t" # afficher les tables des symboles
|
|
||||||
MYCOMPILOMIPS="${MYCOMPILO} -m" # générer code MIPS
|
|
||||||
EXITONFAIL=1 # mettre à zéro pour continuer après erreurs
|
|
||||||
MARS="./Mars4_5.jar" # utilisez autre version de Mars si besoin
|
|
||||||
##############################################################################
|
|
||||||
# NE PLUS LIRE À PARTIR D'ICI ;-)
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
declare -A testname
|
|
||||||
testname["lex"]="Analyse lexicale"
|
|
||||||
testname["synt"]="Analyse syntaxique"
|
|
||||||
testname["asynt"]="Arbre abstrait"
|
|
||||||
testname["tab"]="Table des symboles"
|
|
||||||
testname["mips"]="Code machine MIPS"
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Fonction pour faire le diff textuel régulier (lex et tab).
|
|
||||||
# Cette fonction peut être passée en paramètre à la fonction diff_prog.
|
|
||||||
# @param $1 Fichier 1
|
|
||||||
# @param $2 Fichier 2
|
|
||||||
# @return 0 si pas de différence, autre sinon
|
|
||||||
|
|
||||||
function REGDIFF() {
|
|
||||||
diff -q -w $1 $2
|
|
||||||
}
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Fonction pour faire le diff entre deux fichiers XML (syn et asyn).
|
|
||||||
# Cette fonction peut être passée en paramètre à la fonction diff_prog.
|
|
||||||
# @param $1 Fichier XML 1
|
|
||||||
# @param $2 Fichier XML 2
|
|
||||||
# @return 0 si pas de différence, autre sinon
|
|
||||||
|
|
||||||
function XMLDIFF() {
|
|
||||||
./compare_arbres_xml $1 $2
|
|
||||||
}
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Fonction pour faire le diff entre deux sorties d'exécution Mars (mips).
|
|
||||||
# Cette fonction peut être passée en paramètre à la fonction diff_prog.
|
|
||||||
# @param $1 Fichier mips 1
|
|
||||||
# @param $2 Fichier mips 2
|
|
||||||
# @param $3 Entrée à donner à l'exécution du programme (optionnel)
|
|
||||||
# @return 0 si pas de différence, autre sinon
|
|
||||||
|
|
||||||
function MARSOUTDIFF() {
|
|
||||||
diff <(echo -e "$3" | java -jar $MARS $1 | tail -n +2 | sed ':a;N;$!ba;s/[ \n]//g') <(echo -e "$3" | java -jar $MARS $2 | tail -n +2 | sed ':a;N;$!ba;s/[ \n]//g')
|
|
||||||
}
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Fonction pour faire le diff entre deux fichiers, vérifier et afficher le
|
|
||||||
# résultat avec de belles couleurs.
|
|
||||||
# @param $1 Nom de la fonction utilisée pour faire le diff (parmi 3 ci-dessus)
|
|
||||||
# @param $2 Nom du fichier d'entrée à tester sans extension (p. ex. affect)
|
|
||||||
# @param $3 Extension du fichier à tester (p. ex. synt)
|
|
||||||
# @param $4 Entrée à donner à l'exécution du programme (optionnel)
|
|
||||||
|
|
||||||
function diff_prog() {
|
|
||||||
diffprog=$1
|
|
||||||
input=$2
|
|
||||||
suffix=$3
|
|
||||||
values=$4
|
|
||||||
refoutput="ref-${suffix}/${input}.${suffix}"
|
|
||||||
sysoutput="output/${input}.${suffix}"
|
|
||||||
echo -e "\033[35m > ${testname[${suffix}]} (.${suffix})\033[0m"
|
|
||||||
echo -e "`wc -l output/${input}.${suffix} | awk '{print $1}'` lignes"
|
|
||||||
if [ -f ref-${suffix}/$input.${suffix} ]; then
|
|
||||||
${diffprog} output/${input}.${suffix} ref-${suffix}/${input}.${suffix} ${values} 2>&1 2> /dev/null
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo -e "\033[31mTEST ${testname[${suffix}]} ÉCHOUÉ\033[0m"
|
|
||||||
echo -e "Différences entre output/${input}.${suffix} ref-${suffix}/${input}.${suffix} en utilisant $diffprog:"
|
|
||||||
${diffprog} output/${input}.${suffix} ref-${suffix}/${input}.${suffix} ${values}
|
|
||||||
if [ $EXITONFAIL = 1 ]; then exit 1; fi
|
|
||||||
else
|
|
||||||
echo -e "\033[32mTEST ${testname[${suffix}]} OK\033[0m"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "\033[34mRéférence ref-${suffix}/${input}.${suffix} absente\033[0m"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Exécute tous les tests (reco, lex, synt, asynt, tab, mips) pour un exemple
|
|
||||||
# donné qui doit être correctement compilé à tous les niveaux.
|
|
||||||
# @param $1 Nom du fichier d'entrée à tester sans extension (p. ex. affect)
|
|
||||||
# @param $2 Entrée à donner à l'exécution du programme (optionnel)
|
|
||||||
|
|
||||||
function test_fichier_ok() {
|
|
||||||
input=$1
|
|
||||||
echo -e "\n\033[4m ---- Test input/$input.l ----\033[0m"
|
|
||||||
if [ -n "$2" ]; then
|
|
||||||
echo "Input : $2"
|
|
||||||
fi
|
|
||||||
if [ -f input/$input.l ]; then
|
|
||||||
# Reconnaissance : programme correct doit être accepté
|
|
||||||
if [ -n "${MYCOMPILODEFAULT}" ]; then
|
|
||||||
echo -e "\033[35m > Reconnaissance (accepte l'entrée)\033[0m"
|
|
||||||
${MYCOMPILODEFAULT} input/$input.l > output/$input.synt
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo -e "\033[31mTEST Reconnaissance ÉCHOUÉ\033[0m"
|
|
||||||
echo -e "Le programme $input.l n'a pas été compilé correctement"
|
|
||||||
if [ $EXITONFAIL = 1 ]; then exit 1; fi
|
|
||||||
else
|
|
||||||
echo -e "\033[32mTEST Reconnaissance OK\033[0m"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Teste analyseur lexical
|
|
||||||
if [ -n "${MYCOMPILOLEX}" ]; then
|
|
||||||
${MYCOMPILOLEX} input/$input.l > output/$input.lex
|
|
||||||
diff_prog REGDIFF $input lex
|
|
||||||
fi
|
|
||||||
# Teste analyseur syntaxique
|
|
||||||
if [ -n "${MYCOMPILOSYNT}" ]; then
|
|
||||||
${MYCOMPILOSYNT} input/$input.l > output/$input.synt
|
|
||||||
diff_prog XMLDIFF $input synt
|
|
||||||
fi
|
|
||||||
# Teste création de l'arbre abstrait
|
|
||||||
if [ -n "${MYCOMPILOASYNT}" ]; then
|
|
||||||
${MYCOMPILOASYNT} input/$input.l > output/$input.asynt
|
|
||||||
diff_prog XMLDIFF $input asynt
|
|
||||||
fi
|
|
||||||
# Teste replissage de la table des symboles
|
|
||||||
if [ -n "${MYCOMPILOTAB}" ]; then
|
|
||||||
${MYCOMPILOTAB} input/$input.l > output/$input.tab
|
|
||||||
diff_prog REGDIFF $input tab
|
|
||||||
fi
|
|
||||||
# Teste génération de code MIPS
|
|
||||||
if [ -n "${MYCOMPILOMIPS}" ]; then
|
|
||||||
${MYCOMPILOMIPS} input/$input.l > output/$input.mips
|
|
||||||
diff_prog MARSOUTDIFF $input mips "$2"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "\033[31minput/$input.l non trouvé\033[0m"
|
|
||||||
echo -e "\033[31mTest impossible\033[0m"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# Vérifie qu'un programme contenant des erreurs n'est pas reconnu/compilé.
|
|
||||||
# @param $1 Nom du fichier d'entrée à tester sans extension (p. ex. affect)
|
|
||||||
|
|
||||||
function test_fichier_fail() {
|
|
||||||
input=$1
|
|
||||||
echo -e "\n\033[4m ---- Test input/$input.l ----\033[0m"
|
|
||||||
${MYCOMPILODEFAULT} input/$input.l > output/$input.synt.xml
|
|
||||||
if [ $? = 0 ]; then
|
|
||||||
echo -e "\033[31mTEST REJET ÉCHOUÉ\033[0m"
|
|
||||||
echo -e "Le programme $input.l est accepté mais il devrait être rejeté"
|
|
||||||
if [ $EXITONFAIL = 1 ]; then exit 1; fi
|
|
||||||
else
|
|
||||||
echo -e "\033[32mTEST REJET OK\033[0m"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
####### ##### ###### ###### ### ##### ###############################
|
|
||||||
####### ### ##### # ###### #### ### ###############################
|
|
||||||
####### # #### ### ##### #### ## # ###############################
|
|
||||||
####### # # ### #### #### ### ###############################
|
|
||||||
####### ## ## ## ####### ## ### #### ###############################
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
make clean
|
|
||||||
make
|
|
||||||
mkdir -p output
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Vérifications initiales : MYCOMPILO et MARS bien configurés?
|
|
||||||
|
|
||||||
echo -e "Votre compilateur : ${MYCOMPILO}"
|
|
||||||
if [ ! -f ${MYCOMPILO} ]; then
|
|
||||||
echo -e "\033[31mCompilateur introuvable"
|
|
||||||
echo -e "Modifiez la variable MYCOMPILO avant de lancer l'éval\033[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ -n "${MYCOMPILOMIPS}" -a ! -f ${MARS} ]; then
|
|
||||||
echo -e "\033[31mMARS introuvable"
|
|
||||||
echo -e "Modifiez la variable MARS avant de lancer l'éval\033[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
echo -e "\033[1m\n>> 1) Tests connus OK\033[0m"
|
|
||||||
|
|
||||||
test_fichier_ok affect
|
|
||||||
test_fichier_ok boucle
|
|
||||||
test_fichier_ok expression
|
|
||||||
# 3 cas de figure selon les entrées tapées
|
|
||||||
test_fichier_ok max "3\n10\n"
|
|
||||||
test_fichier_ok max "10\n10\n"
|
|
||||||
test_fichier_ok max "-3\n-10\n"
|
|
||||||
test_fichier_ok tri
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
echo -e "\033[1m\n>> 2) Tests connus FAIL\033[0m"
|
|
||||||
|
|
||||||
test_fichier_fail affect-err
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
echo -e "\033[1m\n>> 3) Tests nouveaux OK\033[0m"
|
|
||||||
|
|
||||||
# Coming soon ;-)
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
echo -e "\033[1m\n>> 4) Tests nouveaux FAIL\033[0m"
|
|
||||||
|
|
||||||
# Coming soon ;-)
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
CC = gcc
|
|
||||||
|
|
||||||
LIBS = -lm
|
|
||||||
CCFLAGS = -Wall -ggdb
|
|
||||||
|
|
||||||
all: compare_arbres_xml
|
|
||||||
|
|
||||||
compare_arbres_xml: compare_arbres_xml.c analyseur_xml.o
|
|
||||||
$(CC) $(CCFLAGS) -o compare_arbres_xml compare_arbres_xml.c analyseur_xml.o
|
|
||||||
|
|
||||||
analyseur_xml.o: analyseur_xml.c
|
|
||||||
$(CC) $(CCFLAGS) -c analyseur_xml.c
|
|
||||||
|
|
||||||
.PHONY : clean
|
|
||||||
|
|
||||||
clean:
|
|
||||||
- rm -f *.o compare_arbres_xml
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
||||||
<head>
|
|
||||||
<title>Carlos Ramisch - personal page</title>
|
|
||||||
<link rel="stylesheet" href="main.css" type="text/css" media="screen"/>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page_body">
|
|
||||||
<H1 >Evaluation de l'analyseur syntaxique 2015/2016</H1>
|
|
||||||
|
|
||||||
<H2>1 - Compilation du compilateur</H2>
|
|
||||||
|
|
||||||
Compilez votre analyseur à l'aide d'un Makefile.
|
|
||||||
|
|
||||||
<H2>2 - Exécution sur des exemples existants</H2>
|
|
||||||
|
|
||||||
|
|
||||||
<p>Vous pouvez modifier le script <tt>runEval.sh</tt> en modifiant le chemin vers l'exécutable de votre compilateur. Ensuite, exécutez-le pour effectuer les tests ci-dessous 100% automatiquement</p>
|
|
||||||
|
|
||||||
<p>Analysez les programmes suivants :</p>
|
|
||||||
|
|
||||||
<table border="1pt">
|
|
||||||
<tr><td>affect.l</td></tr>
|
|
||||||
<tr><td>boucle.l</td></tr>
|
|
||||||
<tr><td>expression.l</td></tr>
|
|
||||||
<tr><td>max.l</td></tr>
|
|
||||||
<tr><td>tri.l</td></tr>
|
|
||||||
<tr><td>affect-err.l</td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<H2>3 - Exécution sur de nouveaux exemples</H2>
|
|
||||||
|
|
||||||
<h3>3.1 Exemples compilés OK</h3>
|
|
||||||
|
|
||||||
<p>Compilez à l'aide de votre compilateur, les programmes suivants :</p>
|
|
||||||
|
|
||||||
<table border="1pt">
|
|
||||||
<tr><td>eval1.l</td></tr>
|
|
||||||
<tr><td>eval2.l</td></tr>
|
|
||||||
<tr><td>eval3.l</td></tr>
|
|
||||||
<tr><td>eval4.l</td></tr>
|
|
||||||
<tr><td>eval5.l</td></tr>
|
|
||||||
<tr><td>eval6.l</td></tr>
|
|
||||||
<tr><td>eval7.l</td></tr>
|
|
||||||
<tr><td>eval8.l</td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h3>3.1 Exemples pas compilés</h3>
|
|
||||||
|
|
||||||
<p>Vérifiez que les programmes suivants ne compilent pas :</p>
|
|
||||||
|
|
||||||
<table border="1pt">
|
|
||||||
<tr><td>eval1err.l</td></tr>
|
|
||||||
<tr><td>eval2err.l</td></tr>
|
|
||||||
<tr><td>eval3err.l</td></tr>
|
|
||||||
<tr><td>eval4err.l</td></tr>
|
|
||||||
<tr><td>eval5err.l</td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<!--<H2>4 - Ajout de la boucle <tt>faire - tantque</tt></H2>
|
|
||||||
|
|
||||||
On désire ajouter à notre langage un nouveau type de boucle, dont voici la syntaxe:<br><br>
|
|
||||||
|
|
||||||
<tt>faire IB tantque E;</tt><br><br>
|
|
||||||
|
|
||||||
une telle instruction exécute le bloc d'instructions dans <tt>IB</tt> tant que la valeur de l'expression <tt>E</tt> est vraie, c'est-à-dire, ne vaut pas zéro. L'évaluation de l'expression est effectuée à la fin de la boucle, comme le <tt>do-while</tt> en C.-->
|
|
||||||
|
|
||||||
|
|
||||||
<H2>4 - Ajout de la boucle <tt>pour</tt></H2>
|
|
||||||
|
|
||||||
<p>On désire ajouter à notre langage une boucle de type <tt>pour</tt>, dont voici la syntaxe:</p>
|
|
||||||
|
|
||||||
<p><tt>pour IAFF<sub>init</sub> E; IAFF<sub>incr</sub> faire IB</tt><br><br></p>
|
|
||||||
|
|
||||||
<p>Une telle instruction exécute d'abord la première affectation, contenue dans <tt>IAFF<sub>init</sub></tt>, pour l'initialisation. Ensuite, tant que la valeur de l'expression <tt>E</tt> est vraie, c'est-à-dire, ne vaut pas zéro, elle exécute le bloc d'instructions dans <tt>IB</tt> suivi de l'instruction d'incrément <tt>IAFF<sub>incr</sub></tt>. Cette boucle est similaire à la boucle <tt>for</tt> en C. Cependant, il n'est pas possible de mettre autre chose qu'une affectation dans les parties d'initialisation et d'incrément (en C, elles peuvent être vides ou contenir n'importe quelle instruction-expression).</p>
|
|
||||||
|
|
||||||
<!--<p>Modifiez l'analyseur lexical, l'analyseur syntaxique, la structure de
|
|
||||||
l'arbre abstrait, et la génération de code afin de prendre en compte cette nouvelle instruction.</p>-->
|
|
||||||
|
|
||||||
<p>Modifiez l'analyseur lexical et l'analyseur syntaxique afin de prendre en compte cette nouvelle instruction.</p>
|
|
||||||
|
|
||||||
<H2>5 - Tests</H2>
|
|
||||||
<p>Vous testerez votre nouvel analyseur sur les programmes suivants:</p>
|
|
||||||
|
|
||||||
<table border="1pt">
|
|
||||||
<tr><td>test1.l</td></tr>
|
|
||||||
<tr><td>test2.l</td></tr>
|
|
||||||
<tr><td>test3.l</td></tr>
|
|
||||||
<tr><td>test1err.l - ne doit pas compiler</td></tr>
|
|
||||||
</table>
|
|
||||||
<br/>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
@@ -1,323 +0,0 @@
|
|||||||
#include<stdio.h>
|
|
||||||
#include<stdlib.h>
|
|
||||||
#include<string.h>
|
|
||||||
#include"analyseur_xml.h"
|
|
||||||
|
|
||||||
/* symboles terminaux */
|
|
||||||
|
|
||||||
#define CHEVRON_FERMANT 1
|
|
||||||
#define DEBUT_BF 2
|
|
||||||
#define DEBUT_BO 3
|
|
||||||
#define CHAINE 4
|
|
||||||
#define FIN 5
|
|
||||||
|
|
||||||
#define ISSPACE(a) (a == ' ') || (a == '\n') || (a == '\t')
|
|
||||||
|
|
||||||
#define YYTEXT_MAX 100
|
|
||||||
|
|
||||||
/* fonctions pour arbre abstrait */
|
|
||||||
|
|
||||||
noeud *cree_noeud(char *nom)
|
|
||||||
{
|
|
||||||
noeud *n = malloc(sizeof(noeud));
|
|
||||||
if(n == NULL){
|
|
||||||
fprintf(stderr, "erreur d'allocation\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
n->nom = nom;
|
|
||||||
n->premier_fils = NULL;
|
|
||||||
n->dernier_fils = NULL;
|
|
||||||
n->suiv = NULL;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
noeud *ajoute_fils(noeud *pere, noeud *fils)
|
|
||||||
{
|
|
||||||
if(pere->premier_fils == NULL){
|
|
||||||
pere->premier_fils = pere->dernier_fils = fils;
|
|
||||||
return pere;
|
|
||||||
}
|
|
||||||
pere->dernier_fils->suiv = fils;
|
|
||||||
pere->dernier_fils = fils;
|
|
||||||
return pere;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void affiche_arbre(noeud *racine){
|
|
||||||
noeud *n;
|
|
||||||
printf("<%s> ", racine->nom);
|
|
||||||
for(n=racine->premier_fils; n!=NULL; n = n->suiv){
|
|
||||||
affiche_arbre(n);
|
|
||||||
}
|
|
||||||
printf("</%s> ", racine->nom);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int compare_arbres_rec(noeud *racine1, noeud *racine2, int verbose, int profondeur)
|
|
||||||
{
|
|
||||||
noeud *f1, *f2;
|
|
||||||
int resultat = 1;
|
|
||||||
int i;
|
|
||||||
if(verbose){
|
|
||||||
for(i=0; i<profondeur; i++) printf(" ");
|
|
||||||
printf("%s <------------> %s\n", racine1->nom, racine2->nom);
|
|
||||||
}
|
|
||||||
if(strcmp(racine1->nom, racine2->nom))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for(f1 = racine1->premier_fils, f2 = racine2->premier_fils;
|
|
||||||
f1 && f2 && resultat;
|
|
||||||
f1 = f1->suiv, f2 = f2->suiv){
|
|
||||||
resultat = compare_arbres_rec(f1, f2, verbose, profondeur+1);
|
|
||||||
}
|
|
||||||
return ((f1 == NULL) && (f2 == NULL) && resultat);
|
|
||||||
}
|
|
||||||
|
|
||||||
int compare_arbres(noeud *racine1, noeud *racine2, int verbose)
|
|
||||||
{
|
|
||||||
return compare_arbres_rec(racine1, racine2, verbose, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void libere_arbre(noeud *racine)
|
|
||||||
{
|
|
||||||
noeud *n;
|
|
||||||
for(n=racine->premier_fils; n!=NULL; n = n->suiv){
|
|
||||||
libere_arbre(n);
|
|
||||||
}
|
|
||||||
free(racine);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* analyseur lexical */
|
|
||||||
|
|
||||||
int DEBUG = 0;
|
|
||||||
char yytext[YYTEXT_MAX];
|
|
||||||
int yyleng;
|
|
||||||
int yylval;
|
|
||||||
/* Compter les lignes pour afficher les messages d'erreur avec numero ligne */
|
|
||||||
int nb_ligne;
|
|
||||||
int cc;
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Fonction qui ignore les espaces et commentaires.
|
|
||||||
* Renvoie -1 si arrivé à la fin du fichier, 0 si tout va bien
|
|
||||||
******************************************************************************/
|
|
||||||
int mangeEspaces()
|
|
||||||
{
|
|
||||||
char c = fgetc(yyin);
|
|
||||||
while( ISSPACE(c) ) {
|
|
||||||
if( c == '\n' ) {
|
|
||||||
nb_ligne++;
|
|
||||||
}
|
|
||||||
c = fgetc(yyin);
|
|
||||||
}
|
|
||||||
if ( feof(yyin) ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
ungetc(c, yyin);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Lit un caractère et le stocke dans le buffer yytext
|
|
||||||
******************************************************************************/
|
|
||||||
char lireCar(void)
|
|
||||||
{
|
|
||||||
yytext[yyleng++] = fgetc(yyin);
|
|
||||||
yytext[yyleng] = '\0';
|
|
||||||
return yytext[yyleng - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Remet le dernier caractère lu au buffer clavier et enlève du buffer yytext
|
|
||||||
******************************************************************************/
|
|
||||||
void delireCar()
|
|
||||||
{
|
|
||||||
char c;
|
|
||||||
c = yytext[yyleng - 1];
|
|
||||||
yytext[--yyleng] = '\0';
|
|
||||||
ungetc(c, yyin);
|
|
||||||
}
|
|
||||||
/*******************************************************************************
|
|
||||||
* Fonction principale de l'analyseur lexical, lit les caractères de yyin et
|
|
||||||
* renvoie les tokens sous forme d'entier. Le code de chaque unité est défini
|
|
||||||
* dans symboles.h sinon (mot clé, idententifiant, etc.). Pour les tokens de
|
|
||||||
* type ID_FCT, ID_VAR et NOMBRE la valeur du token est dans yytext, visible
|
|
||||||
* dans l'analyseur syntaxique.
|
|
||||||
******************************************************************************/
|
|
||||||
int inTag = 0;
|
|
||||||
|
|
||||||
int yylex(void)
|
|
||||||
{
|
|
||||||
char c;
|
|
||||||
yytext[yyleng = 0] = '\0';
|
|
||||||
|
|
||||||
/* Si j'ai trouvé la fin du fichier en lisant des espaces ... */
|
|
||||||
if( !inTag && mangeEspaces() == -1 ) {
|
|
||||||
return FIN; /* Renvoie le marqueur de fin d'entrée */
|
|
||||||
}
|
|
||||||
|
|
||||||
c = lireCar();
|
|
||||||
if(c == '>'){
|
|
||||||
if(DEBUG) { printf("CHEVRON_FERMANT\n"); }
|
|
||||||
//inTag = 0;
|
|
||||||
return CHEVRON_FERMANT;
|
|
||||||
}
|
|
||||||
if(c == '<'){
|
|
||||||
inTag = 1;
|
|
||||||
c = lireCar();
|
|
||||||
if(c == '/'){
|
|
||||||
if(DEBUG) { printf("DEBUT_BF\n"); }
|
|
||||||
return DEBUT_BF;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
delireCar();
|
|
||||||
if(DEBUG) { printf("DEBUT_BO\n"); }
|
|
||||||
return DEBUT_BO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
do{
|
|
||||||
c = lireCar();
|
|
||||||
inTag = 0;
|
|
||||||
}while((c!= '<') && (c!= '>') && !feof(yyin) && !(ISSPACE(c)));
|
|
||||||
delireCar();
|
|
||||||
if(DEBUG) { printf("CHAINE\n"); }
|
|
||||||
|
|
||||||
return CHAINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Fonction auxiliaire appelée par l'analyseur syntaxique tout simplement pour
|
|
||||||
* afficher des messages d'erreur et l'arbre XML
|
|
||||||
******************************************************************************/
|
|
||||||
void nom_token( int token, char *nom, char *valeur ) {
|
|
||||||
//int i;
|
|
||||||
|
|
||||||
strcpy( nom, "symbole" );
|
|
||||||
if(token == CHEVRON_FERMANT) strcpy( valeur, "CHEVRON_FERMANT");
|
|
||||||
else if(token == DEBUT_BF) strcpy( valeur, "DEBUT_BF");
|
|
||||||
else if(token == DEBUT_BO) strcpy( valeur, "DEBUT_BO");
|
|
||||||
else if(token == CHAINE) strcpy( valeur, "CHAINE");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* analyse syntaxique */
|
|
||||||
|
|
||||||
noeud *B(void);
|
|
||||||
void LB(noeud *pere);
|
|
||||||
char *BO(void);
|
|
||||||
char *BF(void);
|
|
||||||
void LCHAINE(void);
|
|
||||||
|
|
||||||
void erreur(char *msg){
|
|
||||||
fprintf(stderr, "Ligne %d : erreur : %s\n", nb_ligne, msg);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* B -> BO LCHAINE LB LCHAINE BF */
|
|
||||||
noeud *B(void){
|
|
||||||
char *nom_bo;
|
|
||||||
char *nom_bf;
|
|
||||||
noeud *n;
|
|
||||||
if(DEBUG) { printf("<B>\n"); }
|
|
||||||
if(cc == DEBUT_BO){
|
|
||||||
nom_bo = BO();
|
|
||||||
n = cree_noeud(nom_bo);
|
|
||||||
LCHAINE();
|
|
||||||
LB(n);
|
|
||||||
LCHAINE();
|
|
||||||
nom_bf = BF();
|
|
||||||
if(strcmp(nom_bo, nom_bf)){
|
|
||||||
fprintf(stderr, "Ligne %d : arbre mal forme: balise ouvrante : \"%s\" balise fermante : \"%s\"\n", nb_ligne, nom_bo, nom_bf);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
free(nom_bf);
|
|
||||||
if(DEBUG) { printf("</B>\n"); }
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
erreur("B");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* LCHAINE -> CHAINE LCHAINE */
|
|
||||||
/* | */
|
|
||||||
|
|
||||||
void LCHAINE(void){
|
|
||||||
if(cc == CHAINE){
|
|
||||||
cc = yylex();
|
|
||||||
LCHAINE();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if((cc == DEBUT_BO) ||(cc == DEBUT_BF)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
erreur("LCHAINE");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* LB -> B LB
|
|
||||||
| */
|
|
||||||
|
|
||||||
void LB(noeud *pere)
|
|
||||||
{
|
|
||||||
noeud *fils = NULL;
|
|
||||||
if(cc == DEBUT_BO){
|
|
||||||
fils = B();
|
|
||||||
ajoute_fils(pere, fils);
|
|
||||||
LB(pere);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(cc == DEBUT_BF){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
erreur("LB");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BO -> DEBUT_BO CHAINE CHEVRON_FERMANT */
|
|
||||||
char *BO(void)
|
|
||||||
{
|
|
||||||
char *nom = NULL;
|
|
||||||
if(DEBUG) { printf("<BO>\n"); }
|
|
||||||
if(cc == DEBUT_BO){
|
|
||||||
cc = yylex();
|
|
||||||
if(cc == CHAINE){
|
|
||||||
nom = strdup(yytext);
|
|
||||||
cc = yylex();
|
|
||||||
if(cc == CHEVRON_FERMANT){
|
|
||||||
cc = yylex();
|
|
||||||
if(DEBUG) { printf("</BO>\n"); }
|
|
||||||
return nom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
erreur("BO");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BF -> DEBUT_BF CHAINE CHEVRON_FERMANT */
|
|
||||||
char *BF(void)
|
|
||||||
{
|
|
||||||
char *nom = NULL;
|
|
||||||
if(cc == DEBUT_BF){
|
|
||||||
cc = yylex();
|
|
||||||
if(cc == CHAINE){
|
|
||||||
nom = strdup(yytext);
|
|
||||||
cc = yylex();
|
|
||||||
if(cc == CHEVRON_FERMANT){
|
|
||||||
cc = yylex();
|
|
||||||
return nom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
erreur("BF");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
noeud *analyseur_xml(void)
|
|
||||||
{
|
|
||||||
nb_ligne = 0;
|
|
||||||
cc = yylex();
|
|
||||||
return B();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#ifndef __ANALYSEUR_XML__
|
|
||||||
#define __ANALYSEUR_XML__
|
|
||||||
|
|
||||||
/* structures de donnees et fonctions pour arbre abstrait */
|
|
||||||
|
|
||||||
typedef struct n noeud;
|
|
||||||
|
|
||||||
struct n{
|
|
||||||
char *nom;
|
|
||||||
struct n *premier_fils;
|
|
||||||
struct n *dernier_fils;
|
|
||||||
struct n *suiv;
|
|
||||||
};
|
|
||||||
|
|
||||||
FILE *yyin;
|
|
||||||
|
|
||||||
|
|
||||||
void affiche_arbre(noeud *racine);
|
|
||||||
int compare_arbres(noeud *racine1, noeud *racine2, int verbose);
|
|
||||||
void libere_arbre(noeud *r);
|
|
||||||
|
|
||||||
/* analyseur */
|
|
||||||
|
|
||||||
noeud *analyseur_xml(void);
|
|
||||||
#endif
|
|
||||||
Binary file not shown.
@@ -1,63 +0,0 @@
|
|||||||
#include<stdio.h>
|
|
||||||
#include<stdlib.h>
|
|
||||||
#include"analyseur_xml.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
noeud *racine1;
|
|
||||||
noeud *racine2;
|
|
||||||
int resultat;
|
|
||||||
int verbose;
|
|
||||||
|
|
||||||
if((argc != 3) && (argc != 4)){
|
|
||||||
fprintf(stderr, "usage: %s fichier_xml fichier_xml [v]\n", argv[0]);
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
}
|
|
||||||
verbose = (argc == 4);
|
|
||||||
|
|
||||||
yyin = fopen(argv[1], "r");
|
|
||||||
if(yyin == NULL){
|
|
||||||
fprintf(stderr, "impossible d'ouvrir le fichier %s\n", argv[1]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "analyse du fichier : %s\n", argv[1]);
|
|
||||||
racine1 = analyseur_xml();
|
|
||||||
|
|
||||||
|
|
||||||
fclose(yyin);
|
|
||||||
|
|
||||||
yyin = fopen(argv[2], "r");
|
|
||||||
if(yyin == NULL){
|
|
||||||
fprintf(stderr, "impossible d'ouvrir le fichier %s\n", argv[2]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "analyse du fichier : %s\n", argv[2]);
|
|
||||||
racine2 = analyseur_xml();
|
|
||||||
|
|
||||||
fclose(yyin);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* affiche_arbre(racine1);
|
|
||||||
printf("\n");
|
|
||||||
affiche_arbre(racine2);*/
|
|
||||||
|
|
||||||
fprintf(stderr, "comparaison des arbres\n");
|
|
||||||
resultat = compare_arbres(racine1, racine2, verbose);
|
|
||||||
libere_arbre(racine1);
|
|
||||||
libere_arbre(racine2);
|
|
||||||
|
|
||||||
|
|
||||||
if(resultat){
|
|
||||||
printf("arbres egaux\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
printf("arbres différents\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
$a = 5;
|
|
||||||
ecrire( $a );
|
|
||||||
}
|
|
||||||
$extra = 0;
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
$a = 1;
|
|
||||||
ecrire($a);
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
entier $i, entier $carre;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
$i = 0;
|
|
||||||
tantque $i < 10 faire
|
|
||||||
{
|
|
||||||
$carre = $i * $i;
|
|
||||||
ecrire( $carre );
|
|
||||||
$i = $i + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
add (entier $a, entier $b)
|
|
||||||
{
|
|
||||||
retour $a + $b;
|
|
||||||
}
|
|
||||||
|
|
||||||
mult (entier $a, entier $b)
|
|
||||||
{
|
|
||||||
retour $a * $b;
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
entier $a, entier $b, entier $op;
|
|
||||||
{
|
|
||||||
$a = lire();
|
|
||||||
$b = lire();
|
|
||||||
$op = lire();
|
|
||||||
si $op = 1 alors {
|
|
||||||
ecrire(add($a, $b));
|
|
||||||
}
|
|
||||||
sinon {
|
|
||||||
si $op = 2 alors {
|
|
||||||
ecrire(mult($a, $b));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
33a
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
fibo( entier $n )
|
|
||||||
{
|
|
||||||
si $n < 2 alors {
|
|
||||||
retour 1;
|
|
||||||
}
|
|
||||||
sinon {
|
|
||||||
retour fibo( $n - 1 ) + fibo( $n - 2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
ecrire( fibo( lire() ) );
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
$a = 5;
|
|
||||||
ecrire( $a );
|
|
||||||
}
|
|
||||||
$extra = 0;
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
entier $i, entier $j, entier $k, entier $somme;
|
|
||||||
main() {
|
|
||||||
$somme = 0;
|
|
||||||
pour $i = 0; $i < 10; $i = $i + 1; faire {
|
|
||||||
pour $j = 0; $j < $i; $j = $j + 1; faire {
|
|
||||||
pour $k = 0; $k < $j; $k = $k + 1; faire {
|
|
||||||
$somme = $somme + $i + $j + $k;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ecrire ( $somme );
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
entier $i;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
entier $carre;
|
|
||||||
$i = 0;
|
|
||||||
tantque $i < 10 faire
|
|
||||||
{
|
|
||||||
$carre = $i * $i;
|
|
||||||
ecrire( $carre );
|
|
||||||
$i = $i + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
si 1 alors
|
|
||||||
{ecrire(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
entier entier entier
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
entier $a;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
si 0 alors
|
|
||||||
{ecrire(1);
|
|
||||||
}
|
|
||||||
sinon
|
|
||||||
{ecrire(0);}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
entier ?
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user