on peut récupérer entier ou float

This commit is contained in:
Olougouna Axel 2022-12-07 11:12:11 +01:00
parent d6ce6585f1
commit cdc968af29
2 changed files with 17 additions and 9 deletions

14
main.c
View file

@ -6,22 +6,22 @@
int main(int argc, char * argv[]) int main(int argc, char * argv[])
{ {
/*struct Pile P; struct Pile P;
Init_Pile(&P); Init_Pile(&P);
Empiler(&P, '4'); Empiler(&P, "4");
Empiler(&P, '5'); Empiler(&P, "1.0");
struct Cell * res = Depiler(&P); //struct Cell * res = Depiler(&P);
//Supprimer(&P); //Supprimer(&P);
Affichage(P.Pil); Affichage(P.Pil);
Affiche_Nombre(res->Ent);*/ //Affiche_Nombre(res->Ent);
Programme * P; /*Programme * P;
P = lexer(argv[1]); P = lexer(argv[1]);
for(int i=0; i<P->taille; i++) for(int i=0; i<P->taille; i++)
{ {
printf("TOKEN : %s \n", P->tokens[i]); printf("TOKEN : %s \n", P->tokens[i]);
} }*/
/*for(int i=0; i<E->Prog->taille; i++) /*for(int i=0; i<E->Prog->taille; i++)
{ {

12
pile.c
View file

@ -45,9 +45,17 @@ void Empiler(struct Pile * P, char * nb)
struct Nombre i = Typenum(nb); struct Nombre i = Typenum(nb);
if (i.typ == Entier) if (i.typ == Entier)
cel->Ent.nombr.ValEntier = i.nombr.ValEntier; {
//cel->Ent.nombr.ValEntier = i.nombr.ValEntier;
//cel->Ent.typ = Entier;
cel->Ent = i;
}
else if (i.typ == Reel) else if (i.typ == Reel)
cel->Ent.nombr.ValReel = i.nombr.ValReel; {
//cel->Ent.nombr.ValReel = i.nombr.ValReel;
//cel->Ent.typ = Reel;
cel->Ent = i;
}
cel->Suiv = P->Pil; cel->Suiv = P->Pil;
P->Pil = cel; P->Pil = cel;
P->nbElements +=1; P->nbElements +=1;