fuck that shit
This commit is contained in:
@@ -21,45 +21,45 @@ void syntaxError (void);
|
|||||||
void syntaxErrorMsg( const char * msg );
|
void syntaxErrorMsg( const char * msg );
|
||||||
|
|
||||||
n_prog *programme (void);
|
n_prog *programme (void);
|
||||||
void optDecVariables (void);
|
n_l_dec *optDecVariables (void);
|
||||||
void listeDecVariables (void);
|
n_l_dec *listeDecVariables (void);
|
||||||
void listeDecVariablesBis (void);
|
n_l_dec *listeDecVariablesBis (void);
|
||||||
void declarationVariable (void);
|
n_dec *declarationVariable (void);
|
||||||
void optTailleTableau (void);
|
int optTailleTableau (void);
|
||||||
void listeDecFonctions (void);
|
n_l_dec *listeDecFonctions (void);
|
||||||
void declarationFonction (void);
|
n_dec *declarationFonction (void);
|
||||||
void listeParam (void);
|
n_l_dec *listeParam (void);
|
||||||
void optListeDecVariables (void);
|
n_l_dec *optListeDecVariables (void);
|
||||||
void instruction (void);
|
n_instr *instruction (void);
|
||||||
void instructionAffect (void);
|
n_instr *instructionAffect (void);
|
||||||
void instructionBloc (void);
|
n_instr *instructionBloc (void);
|
||||||
void listeInstructions (void);
|
n_l_instr *listeInstructions (void);
|
||||||
void instructionSi (void);
|
n_instr *instructionSi (void);
|
||||||
void optSinon (void);
|
n_instr *optSinon (void);
|
||||||
void instructionTantque (void);
|
n_instr *instructionTantque (void);
|
||||||
void instructionAppel (void);
|
n_instr *instructionAppel (void);
|
||||||
void instructionRetour (void);
|
n_instr *instructionRetour (void);
|
||||||
void instructionEcriture (void);
|
n_instr *instructionEcriture (void);
|
||||||
void instructionPour (void);
|
n_instr *instructionPour (void);
|
||||||
void instructionVide (void);
|
n_instr *instructionVide (void);
|
||||||
void expression (void);
|
n_exp *expression (void);
|
||||||
void expressionBis (void);
|
n_exp *expressionBis (n_exp *herite);
|
||||||
void conjonction (void);
|
n_exp *conjonction (void);
|
||||||
void conjonctionBis (void);
|
n_exp *conjonctionBis(n_exp *herite);
|
||||||
void negation (void);
|
n_exp *negation (void);
|
||||||
void comparaison (void);
|
n_exp *comparaison (void);
|
||||||
void comparaisonBis (void);
|
n_exp *comparaisonBis (n_exp *herite);
|
||||||
void expression (void);
|
n_exp *expression (void);
|
||||||
n_exp *expArith (void);
|
n_exp *expArith (void);
|
||||||
n_exp *expArithBis(n_exp *herite);
|
n_exp *expArithBis(n_exp *herite);
|
||||||
n_exp *terme (void);
|
n_exp *terme (void);
|
||||||
n_exp *termeBis(n_exp *herite);
|
n_exp *termeBis(n_exp *herite);
|
||||||
n_exp *facteur (void);
|
n_exp *facteur (void);
|
||||||
void var (void);
|
n_var *var (void);
|
||||||
void optIndice (void);
|
n_exp *optIndice (void);
|
||||||
n_exp *appelFct (void);
|
n_appel *appelFct (void);
|
||||||
void listeExpressions (void);
|
n_l_exp *listeExpressions (void);
|
||||||
void listeExpressionsBis (void);
|
n_l_exp *listeExpressionsBis ();
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -44,28 +44,32 @@ void syntaxErrorMsg( const char * msg )
|
|||||||
n_prog *programme() {
|
n_prog *programme() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
n_l_dec *herite_var;
|
n_l_dec *herite_var = NULL;
|
||||||
n_l_dec *herite_func;
|
n_l_dec *herite_func = NULL;
|
||||||
n_prog *sreturn;
|
n_prog *sreturn;
|
||||||
|
|
||||||
if( !est_premier( _optDecVariables_, uniteCourante ) && !est_premier( _listeDecFonctions_, uniteCourante ) && !est_suivant( _listeDecFonctions_, uniteCourante )) {
|
if( !est_premier( _optDecVariables_, uniteCourante )
|
||||||
|
&& !est_premier( _listeDecFonctions_, uniteCourante )
|
||||||
|
&& !est_suivant( _listeDecFonctions_, uniteCourante )) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
} else {
|
} else {
|
||||||
herite_var = optDecVariables();
|
herite_var = optDecVariables();
|
||||||
herite_func = listeDecFonctions();
|
herite_func = listeDecFonctions();
|
||||||
sreturn = cree_n_prog(herite_var, herite_func);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
sreturn = cree_n_prog(herite_var, herite_func);
|
||||||
return sreturn;
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void optDecVariables() {
|
n_l_dec *optDecVariables() {
|
||||||
|
n_l_dec *sreturn = NULL;
|
||||||
|
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
if( est_premier( _listeDecVariables_, uniteCourante ) )
|
if( est_premier( _listeDecVariables_, uniteCourante ) )
|
||||||
{
|
{
|
||||||
listeDecVariables();
|
sreturn = listeDecVariables();
|
||||||
|
|
||||||
if( uniteCourante == POINT_VIRGULE ) {
|
if( uniteCourante == POINT_VIRGULE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -76,51 +80,70 @@ void optDecVariables() {
|
|||||||
} else if ( !est_suivant( _optDecVariables_, uniteCourante ) ) {
|
} else if ( !est_suivant( _optDecVariables_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void listeDecVariables() {
|
n_l_dec *listeDecVariables() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_dec *herite_var = NULL;
|
||||||
|
n_l_dec *herite_Liste_var = NULL;
|
||||||
|
n_l_dec *sreturn = NULL;
|
||||||
if( est_premier( _declarationVariable_, uniteCourante ) ) {
|
if( est_premier( _declarationVariable_, uniteCourante ) ) {
|
||||||
declarationVariable();
|
herite_var = declarationVariable();
|
||||||
listeDecVariablesBis();
|
herite_Liste_var = listeDecVariablesBis();
|
||||||
} else {
|
} else {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
sreturn = cree_n_l_dec(herite_var, herite_Liste_var);
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void listeDecVariablesBis() {
|
n_l_dec *listeDecVariablesBis() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_dec *herite_dec_var = NULL;
|
||||||
|
n_l_dec *herite_liste_var = NULL;
|
||||||
|
n_l_dec *sreturn = NULL;
|
||||||
if( uniteCourante == VIRGULE ) {
|
if( uniteCourante == VIRGULE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
declarationVariable();
|
herite_dec_var = declarationVariable();
|
||||||
listeDecVariablesBis();
|
herite_liste_var = listeDecVariablesBis();
|
||||||
|
sreturn = cree_n_l_dec(herite_dec_var, herite_liste_var);
|
||||||
} else if( !est_suivant( _listeDecVariablesBis_, uniteCourante ) ) {
|
} else if( !est_suivant( _listeDecVariablesBis_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void declarationVariable() {
|
n_dec *declarationVariable() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
|
char *name = NULL;
|
||||||
|
n_dec *sreturn = NULL;
|
||||||
|
int taille = 0;
|
||||||
|
|
||||||
if( uniteCourante == ENTIER ) {
|
if( uniteCourante == ENTIER ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
if( uniteCourante == ID_VAR ) {
|
if( uniteCourante == ID_VAR ) {
|
||||||
|
name = duplique_chaine(yytext);
|
||||||
|
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
taille = optTailleTableau();
|
||||||
|
if (taille == 0){
|
||||||
|
|
||||||
|
sreturn = cree_n_dec_var(name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sreturn = cree_n_dec_tab(name, taille);
|
||||||
|
|
||||||
optTailleTableau();
|
|
||||||
} else {
|
} else {
|
||||||
syntaxErrorMsg( "Un identificateur de variable été attendu" );
|
syntaxErrorMsg( "Un identificateur de variable été attendu" );
|
||||||
}
|
}
|
||||||
@@ -129,17 +152,19 @@ void declarationVariable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void optTailleTableau() {
|
int optTailleTableau() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
int taille = 0;
|
||||||
if( uniteCourante == CROCHET_OUVRANT ) {
|
if( uniteCourante == CROCHET_OUVRANT ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
if( uniteCourante == NOMBRE ) {
|
if( uniteCourante == NOMBRE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
|
taille = atoi(yytext);
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
if( uniteCourante == CROCHET_FERMANT ) {
|
if( uniteCourante == CROCHET_FERMANT ) {
|
||||||
@@ -157,46 +182,59 @@ void optTailleTableau() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return taille;
|
||||||
}
|
}
|
||||||
|
|
||||||
void listeDecFonctions() {
|
n_l_dec *listeDecFonctions() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_dec *herite_dec = NULL;
|
||||||
|
n_l_dec *herite_Liste_dec = NULL;
|
||||||
|
n_l_dec *sreturn = NULL;
|
||||||
if( est_premier( _declarationFonction_, uniteCourante ) || est_premier( _listeDecFonctions_, uniteCourante ) ) {
|
if( est_premier( _declarationFonction_, uniteCourante ) || est_premier( _listeDecFonctions_, uniteCourante ) ) {
|
||||||
declarationFonction();
|
herite_dec = declarationFonction();
|
||||||
listeDecFonctions();
|
herite_Liste_dec =listeDecFonctions();
|
||||||
|
sreturn = cree_n_l_dec (herite_dec, herite_Liste_dec);
|
||||||
} else if( !est_suivant( _listeDecFonctions_, uniteCourante ) ) {
|
} else if( !est_suivant( _listeDecFonctions_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void declarationFonction() {
|
n_dec * declarationFonction() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
char *name;
|
||||||
|
n_l_dec *param = NULL;
|
||||||
|
n_l_dec *variables = NULL;
|
||||||
|
n_instr *corps = NULL;
|
||||||
|
n_dec *sreturn;
|
||||||
if( uniteCourante == ID_FCT ) {
|
if( uniteCourante == ID_FCT ) {
|
||||||
|
name = duplique_chaine(yytext);
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
listeParam();
|
param = listeParam();
|
||||||
optDecVariables();
|
variables = optDecVariables();
|
||||||
instructionBloc();
|
corps = instructionBloc();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
syntaxErrorMsg( "Un identificateur de fonction été attendu" );
|
syntaxErrorMsg( "Un identificateur de fonction été attendu" );
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
|
||||||
|
sreturn = cree_n_dec_fonc(name,param,variables,corps);
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void listeParam() {
|
n_l_dec *listeParam() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_l_dec *sreturn = NULL;
|
||||||
if( uniteCourante == PARENTHESE_OUVRANTE ) {
|
if( uniteCourante == PARENTHESE_OUVRANTE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
optListeDecVariables();
|
sreturn = optListeDecVariables();
|
||||||
|
|
||||||
if( uniteCourante == PARENTHESE_FERMANTE ) {
|
if( uniteCourante == PARENTHESE_FERMANTE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -209,59 +247,65 @@ void listeParam() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void optListeDecVariables() {
|
n_l_dec *optListeDecVariables() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_l_dec *sreturn = NULL;
|
||||||
if( est_premier( _listeDecVariables_, uniteCourante ) ) {
|
if( est_premier( _listeDecVariables_, uniteCourante ) ) {
|
||||||
listeDecVariables();
|
sreturn = listeDecVariables();
|
||||||
} else if( !est_suivant( _optListeDecVariables_, uniteCourante ) ) {
|
} else if( !est_suivant( _optListeDecVariables_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void instruction() {
|
n_instr *instruction() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *sreturn = NULL;
|
||||||
|
|
||||||
if( est_premier( _instructionAffect_, uniteCourante ) ) {
|
if( est_premier( _instructionAffect_, uniteCourante ) ) {
|
||||||
instructionAffect();
|
sreturn = instructionAffect();
|
||||||
} else if( est_premier( _instructionBloc_, uniteCourante ) ) {
|
} else if( est_premier( _instructionBloc_, uniteCourante ) ) {
|
||||||
instructionBloc();
|
sreturn = instructionBloc();
|
||||||
} else if( est_premier( _instructionSi_, uniteCourante ) ) {
|
} else if( est_premier( _instructionSi_, uniteCourante ) ) {
|
||||||
instructionSi();
|
sreturn = instructionSi();
|
||||||
} else if( est_premier( _instructionTantque_, uniteCourante ) ) {
|
} else if( est_premier( _instructionTantque_, uniteCourante ) ) {
|
||||||
instructionTantque();
|
sreturn = instructionTantque();
|
||||||
} else if( est_premier( _instructionAppel_, uniteCourante ) ) {
|
} else if( est_premier( _instructionAppel_, uniteCourante ) ) {
|
||||||
instructionAppel();
|
sreturn = instructionAppel();
|
||||||
} else if( est_premier( _instructionRetour_, uniteCourante ) ) {
|
} else if( est_premier( _instructionRetour_, uniteCourante ) ) {
|
||||||
instructionRetour();
|
sreturn = instructionRetour();
|
||||||
} else if( est_premier( _instructionEcriture_, uniteCourante ) ) {
|
} else if( est_premier( _instructionEcriture_, uniteCourante ) ) {
|
||||||
instructionEcriture();
|
sreturn = instructionEcriture();
|
||||||
} else if( est_premier( _instructionPour_, uniteCourante ) ) {
|
} else if( est_premier( _instructionPour_, uniteCourante ) ) {
|
||||||
instructionPour();
|
sreturn = instructionPour();
|
||||||
} else if( est_premier( _instructionVide_, uniteCourante ) ) {
|
} else if( est_premier( _instructionVide_, uniteCourante ) ) {
|
||||||
instructionVide();
|
sreturn = instructionVide();
|
||||||
} else {
|
} else {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void instructionAffect() {
|
n_instr *instructionAffect() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *sreturn = NULL;
|
||||||
|
n_var *herite_var = NULL;
|
||||||
|
n_exp *herite_exp = NULL;
|
||||||
if( est_premier( _var_, uniteCourante ) ) {
|
if( est_premier( _var_, uniteCourante ) ) {
|
||||||
var();
|
|
||||||
|
herite_var = var();
|
||||||
|
|
||||||
if( uniteCourante == EGAL ) {
|
if( uniteCourante == EGAL ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
expression();
|
herite_exp = expression();
|
||||||
|
|
||||||
if( uniteCourante == POINT_VIRGULE ) {
|
if( uniteCourante == POINT_VIRGULE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -277,16 +321,21 @@ void instructionAffect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
sreturn = cree_n_instr_affect(herite_var, herite_exp);
|
||||||
|
return sreturn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void instructionBloc() {
|
n_instr *instructionBloc() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *sreturn = NULL;
|
||||||
|
n_l_instr *herite_list_inst = NULL;
|
||||||
|
|
||||||
if( uniteCourante == ACCOLADE_OUVRANTE ) {
|
if( uniteCourante == ACCOLADE_OUVRANTE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
listeInstructions();
|
herite_list_inst = listeInstructions();
|
||||||
|
|
||||||
if( uniteCourante == ACCOLADE_FERMANTE ) {
|
if( uniteCourante == ACCOLADE_FERMANTE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -299,36 +348,45 @@ void instructionBloc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
sreturn = cree_n_instr_bloc(herite_list_inst);
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void listeInstructions() {
|
n_l_instr *listeInstructions() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *instru = NULL;
|
||||||
|
n_l_instr *listeInstru = NULL;
|
||||||
|
n_l_instr *sreturn = NULL;
|
||||||
if( est_premier( _instruction_, uniteCourante ) || est_premier( _listeInstructions_, uniteCourante ) ) {
|
if( est_premier( _instruction_, uniteCourante ) || est_premier( _listeInstructions_, uniteCourante ) ) {
|
||||||
instruction();
|
instru = instruction();
|
||||||
listeInstructions();
|
listeInstru = listeInstructions();
|
||||||
|
sreturn = cree_n_l_instr(instru, listeInstru);
|
||||||
} else if( !est_suivant( _listeInstructions_, uniteCourante ) ) {
|
} else if( !est_suivant( _listeInstructions_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void instructionSi() {
|
n_instr *instructionSi() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *sreturn;
|
||||||
|
n_exp *test = NULL;
|
||||||
|
n_instr *alors = NULL;
|
||||||
|
n_instr *sinon = NULL;
|
||||||
if( uniteCourante == SI ) {
|
if( uniteCourante == SI ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
expression();
|
test = expression();
|
||||||
|
|
||||||
if( uniteCourante == ALORS ) {
|
if( uniteCourante == ALORS ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
instructionBloc();
|
alors = instructionBloc();
|
||||||
optSinon();
|
sinon = optSinon();
|
||||||
} else {
|
} else {
|
||||||
syntaxErrorMsg( "'alors' été attendu" );
|
syntaxErrorMsg( "'alors' été attendu" );
|
||||||
}
|
}
|
||||||
@@ -337,37 +395,43 @@ void instructionSi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
sreturn = cree_n_instr_si(test, alors, sinon);
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void optSinon() {
|
n_instr *optSinon() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *sreturn;
|
||||||
if( uniteCourante == SINON ) {
|
if( uniteCourante == SINON ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
instructionBloc();
|
sreturn = instructionBloc();
|
||||||
} else if( !est_suivant( _optSinon_, uniteCourante ) ) {
|
} else if( !est_suivant( _optSinon_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void instructionTantque() {
|
n_instr *instructionTantque() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *sreturn;
|
||||||
|
n_exp *test;
|
||||||
|
n_instr *faire;
|
||||||
|
|
||||||
if( uniteCourante == TANTQUE ) {
|
if( uniteCourante == TANTQUE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
expression();
|
test = expression();
|
||||||
|
|
||||||
if( uniteCourante == FAIRE ) {
|
if( uniteCourante == FAIRE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
instructionBloc();
|
faire =instructionBloc();
|
||||||
} else {
|
} else {
|
||||||
syntaxErrorMsg( "'faire' été attendu" );
|
syntaxErrorMsg( "'faire' été attendu" );
|
||||||
}
|
}
|
||||||
@@ -375,14 +439,17 @@ void instructionTantque() {
|
|||||||
syntaxErrorMsg( "'tantque' été attendu" );
|
syntaxErrorMsg( "'tantque' été attendu" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sreturn = cree_n_instr_tantque(test, faire);
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void instructionAppel() {
|
n_instr *instructionAppel() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *sreturn;
|
||||||
|
n_appel *app;
|
||||||
if( est_premier( _instructionAppel_, uniteCourante ) ) {
|
if( est_premier( _instructionAppel_, uniteCourante ) ) {
|
||||||
appelFct();
|
app = appelFct();
|
||||||
|
|
||||||
if( uniteCourante == POINT_VIRGULE ) {
|
if( uniteCourante == POINT_VIRGULE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -394,17 +461,21 @@ void instructionAppel() {
|
|||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sreturn = cree_n_instr_appel(app);
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void instructionRetour() {
|
n_instr *instructionRetour() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *sreturn;
|
||||||
|
n_exp *expr;
|
||||||
|
|
||||||
if( uniteCourante == RETOUR ) {
|
if( uniteCourante == RETOUR ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
expression();
|
expr = expression();
|
||||||
|
|
||||||
if( uniteCourante == POINT_VIRGULE ) {
|
if( uniteCourante == POINT_VIRGULE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -415,13 +486,16 @@ void instructionRetour() {
|
|||||||
} else {
|
} else {
|
||||||
syntaxErrorMsg( "'retour' été attendu" );
|
syntaxErrorMsg( "'retour' été attendu" );
|
||||||
}
|
}
|
||||||
|
sreturn = cree_n_instr_retour(expr);
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void instructionEcriture() {
|
n_instr *instructionEcriture() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *sreturn = NULL;
|
||||||
|
n_exp *expr = NULL;
|
||||||
if( uniteCourante == ECRIRE ) {
|
if( uniteCourante == ECRIRE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
@@ -430,7 +504,7 @@ void instructionEcriture() {
|
|||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
expression();
|
expr = expression();
|
||||||
|
|
||||||
if( uniteCourante == PARENTHESE_FERMANTE ) {
|
if( uniteCourante == PARENTHESE_FERMANTE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -451,31 +525,37 @@ void instructionEcriture() {
|
|||||||
} else {
|
} else {
|
||||||
syntaxErrorMsg( "'ecrire' été attendu" );
|
syntaxErrorMsg( "'ecrire' été attendu" );
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
sreturn = cree_n_instr_ecrire(expr);
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void instructionPour() {
|
n_instr *instructionPour() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_instr *init = NULL;
|
||||||
|
n_exp *test = NULL;
|
||||||
|
n_instr *incr = NULL;
|
||||||
|
n_instr *faire = NULL;
|
||||||
|
n_instr *sreturn = NULL;
|
||||||
|
|
||||||
if( uniteCourante == POUR ) {
|
if( uniteCourante == POUR ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
instructionAffect();
|
init = instructionAffect();
|
||||||
expression();
|
test = expression();
|
||||||
|
|
||||||
if( uniteCourante == POINT_VIRGULE ) {
|
if( uniteCourante == POINT_VIRGULE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
instructionAffect();
|
incr = instructionAffect();
|
||||||
|
|
||||||
if( uniteCourante == FAIRE ) {
|
if( uniteCourante == FAIRE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
instructionBloc();
|
faire = instructionBloc();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
syntaxErrorMsg( "'faire' été attendu" );
|
syntaxErrorMsg( "'faire' été attendu" );
|
||||||
@@ -488,138 +568,162 @@ void instructionPour() {
|
|||||||
syntaxErrorMsg( "'pour' été attendu" );
|
syntaxErrorMsg( "'pour' été attendu" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sreturn = cree_n_instr_pour(init,test,incr,faire);
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void instructionVide() {
|
n_instr *instructionVide() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
|
n_instr * sreturn = NULL;
|
||||||
if( uniteCourante == POINT_VIRGULE ) {
|
if( uniteCourante == POINT_VIRGULE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
} else {
|
} else {
|
||||||
syntaxErrorMsg( "';' été attendu" );
|
syntaxErrorMsg( "';' été attendu" );
|
||||||
}
|
}
|
||||||
|
sreturn = cree_n_instr_vide();
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void expression() {
|
n_exp *expression() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_exp *herite_conj = NULL;
|
||||||
|
n_exp *sreturn = NULL;
|
||||||
if( est_premier( _conjonction_, uniteCourante ) ) {
|
if( est_premier( _conjonction_, uniteCourante ) ) {
|
||||||
conjonction();
|
herite_conj = conjonction();
|
||||||
expressionBis();
|
sreturn = expressionBis(herite_conj);
|
||||||
} else {
|
} else {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void expressionBis() {
|
n_exp *expressionBis(n_exp *herite) {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_exp *conj = NULL;
|
||||||
|
n_exp *sreturn = herite;
|
||||||
|
|
||||||
if( uniteCourante == OU ) {
|
if( uniteCourante == OU ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
conjonction();
|
conj = conjonction();
|
||||||
expressionBis();
|
herite = cree_n_exp_op(ou, herite,conj);
|
||||||
|
sreturn = expressionBis(herite);
|
||||||
} else if( !est_suivant( _expressionBis_, uniteCourante ) ) {
|
} else if( !est_suivant( _expressionBis_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void conjonction() {
|
n_exp *conjonction() {
|
||||||
|
n_exp *sreturn;
|
||||||
|
n_exp *herite_neg = NULL;
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
if( est_premier( _negation_, uniteCourante ) ) {
|
if( est_premier( _negation_, uniteCourante ) ) {
|
||||||
negation();
|
herite_neg = negation();
|
||||||
conjonctionBis();
|
sreturn = conjonctionBis(herite_neg);
|
||||||
} else {
|
} else {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void conjonctionBis() {
|
n_exp *conjonctionBis(n_exp *herite) {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_exp *sreturn = herite;
|
||||||
|
n_exp *herite_neg = NULL;
|
||||||
if( uniteCourante == ET ) {
|
if( uniteCourante == ET ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
herite_neg = negation();
|
||||||
negation();
|
herite_neg = cree_n_exp_op(et, herite, herite_neg);
|
||||||
conjonctionBis();
|
sreturn = conjonctionBis(herite_neg);
|
||||||
} else if( !est_suivant( _conjonctionBis_, uniteCourante ) ) {
|
} else if( !est_suivant( _conjonctionBis_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void negation() {
|
n_exp *negation() {
|
||||||
|
n_exp *sreturn = NULL;
|
||||||
|
n_exp *expression = NULL;
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
if( uniteCourante == NON ) {
|
if( uniteCourante == NON ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
comparaison();
|
expression = comparaison();
|
||||||
|
sreturn = cree_n_exp_op(non,expression,NULL);
|
||||||
} else if (est_premier( _comparaison_, uniteCourante )) {
|
} else if (est_premier( _comparaison_, uniteCourante )) {
|
||||||
comparaison();
|
sreturn = comparaison();
|
||||||
} else {
|
} else {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void comparaison() {
|
n_exp *comparaison() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_exp *sreturn = NULL;
|
||||||
|
n_exp *herite_exp = NULL;
|
||||||
if( est_premier( _expression_, uniteCourante ) ) {
|
if( est_premier( _expression_, uniteCourante ) ) {
|
||||||
expArith();
|
herite_exp = expArith();
|
||||||
comparaisonBis();
|
sreturn = comparaisonBis(herite_exp);
|
||||||
} else {
|
} else {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void comparaisonBis() {
|
n_exp *comparaisonBis(n_exp *herite) {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_exp *sreturn = herite;
|
||||||
|
n_exp *herite_exp = NULL;
|
||||||
if( uniteCourante == EGAL) {
|
if( uniteCourante == EGAL) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
expArith();
|
herite_exp = expArith();
|
||||||
comparaisonBis();
|
herite_exp = cree_n_exp_op(egal,herite,herite_exp);
|
||||||
|
sreturn = comparaisonBis(herite_exp);
|
||||||
} else if( uniteCourante == INFERIEUR) {
|
} else if( uniteCourante == INFERIEUR) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
expArith();
|
herite_exp = expArith();
|
||||||
comparaisonBis();
|
herite_exp = cree_n_exp_op(inf,herite,herite_exp);
|
||||||
|
sreturn = comparaisonBis(herite_exp);
|
||||||
|
|
||||||
} else if( !est_suivant( _comparaisonBis_, uniteCourante ) ) {
|
} else if( !est_suivant( _comparaisonBis_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
n_exp *expArith()
|
n_exp *expArith()
|
||||||
{
|
{
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
n_exp *sreturn;
|
n_exp *sreturn = NULL;
|
||||||
n_exp *herite_fils;
|
n_exp *herite_fils = NULL;
|
||||||
|
|
||||||
if( est_premier( _terme_, uniteCourante ) ) {
|
if( est_premier( _terme_, uniteCourante ) ) {
|
||||||
herite_fils = terme();
|
herite_fils = terme();
|
||||||
@@ -635,9 +739,9 @@ n_exp *expArith()
|
|||||||
n_exp *expArithBis(n_exp *herite) {
|
n_exp *expArithBis(n_exp *herite) {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
n_exp *s;
|
n_exp *s = NULL;
|
||||||
n_exp *sreturn;
|
n_exp *sreturn = NULL;
|
||||||
n_exp *herite_fils;
|
n_exp *herite_fils = NULL;
|
||||||
|
|
||||||
if( uniteCourante == PLUS ) {
|
if( uniteCourante == PLUS ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -666,8 +770,8 @@ n_exp *expArithBis(n_exp *herite) {
|
|||||||
n_exp *terme() {
|
n_exp *terme() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
n_exp *sreturn;
|
n_exp *sreturn = NULL;
|
||||||
n_exp *herite_fils;
|
n_exp *herite_fils = NULL;
|
||||||
|
|
||||||
if( est_premier( _facteur_, uniteCourante ) ) {
|
if( est_premier( _facteur_, uniteCourante ) ) {
|
||||||
herite_fils = facteur();
|
herite_fils = facteur();
|
||||||
@@ -683,9 +787,9 @@ n_exp *terme() {
|
|||||||
n_exp *termeBis(n_exp *herite) {
|
n_exp *termeBis(n_exp *herite) {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
n_exp *s;
|
n_exp *s = NULL;
|
||||||
n_exp *sreturn;
|
n_exp *sreturn = NULL;
|
||||||
n_exp *herite_fils;
|
n_exp *herite_fils = NULL;
|
||||||
|
|
||||||
if( uniteCourante == FOIS ) {
|
if( uniteCourante == FOIS ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -714,7 +818,7 @@ n_exp *termeBis(n_exp *herite) {
|
|||||||
n_exp *facteur() {
|
n_exp *facteur() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
n_exp *sreturn;
|
n_exp *sreturn = NULL;
|
||||||
|
|
||||||
if( uniteCourante == PARENTHESE_OUVRANTE ) {
|
if( uniteCourante == PARENTHESE_OUVRANTE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -733,13 +837,13 @@ n_exp *facteur() {
|
|||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
} else if( est_premier( _appelFct_, uniteCourante ) ) {
|
} else if( est_premier( _appelFct_, uniteCourante ) ) {
|
||||||
sreturn = appelFct();
|
sreturn = cree_n_exp_appel(appelFct());
|
||||||
} else if( est_premier( _var_, uniteCourante ) ) {
|
} else if( est_premier( _var_, uniteCourante ) ) {
|
||||||
sreturn = var();
|
sreturn = cree_n_exp_var(var());
|
||||||
} else if( uniteCourante == LIRE ) {
|
} else if( uniteCourante == LIRE ) {
|
||||||
sreturn = cree_n_exp_lire();
|
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
sreturn = cree_n_exp_lire();
|
||||||
|
|
||||||
if( uniteCourante == PARENTHESE_OUVRANTE ) {
|
if( uniteCourante == PARENTHESE_OUVRANTE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -762,29 +866,37 @@ n_exp *facteur() {
|
|||||||
return sreturn;
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void var() {
|
n_var *var() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_var *sreturn = NULL;
|
||||||
|
n_exp *indice = NULL;
|
||||||
if( uniteCourante == ID_VAR ) {
|
if( uniteCourante == ID_VAR ) {
|
||||||
|
char *appelName;
|
||||||
|
appelName = duplique_chaine(yytext);
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
indice = optIndice();
|
||||||
optIndice();
|
if (indice == NULL)
|
||||||
|
sreturn = cree_n_var_simple(appelName);
|
||||||
|
else
|
||||||
|
sreturn = cree_n_var_indicee(appelName,indice);
|
||||||
} else {
|
} else {
|
||||||
syntaxErrorMsg( "Indice de variable été attendu" );
|
syntaxErrorMsg( "Indice de variable été attendu" );
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void optIndice() {
|
n_exp *optIndice() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_exp *sreturn = NULL;
|
||||||
|
|
||||||
if( uniteCourante == CROCHET_OUVRANT ) {
|
if( uniteCourante == CROCHET_OUVRANT ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
expression();
|
sreturn = expression();
|
||||||
|
|
||||||
if( uniteCourante == CROCHET_FERMANT ) {
|
if( uniteCourante == CROCHET_FERMANT ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
@@ -797,17 +909,18 @@ void optIndice() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
n_exp *appelFct() {
|
n_appel *appelFct() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
n_l_exp *herite_fils;
|
n_l_exp *herite_fils = NULL;
|
||||||
n_appel *sreturn;
|
n_appel *sreturn = NULL;
|
||||||
|
|
||||||
if( uniteCourante == ID_FCT ) {
|
if( uniteCourante == ID_FCT ) {
|
||||||
char appelName[100];
|
char *appelName;
|
||||||
strcpy(appelName, yytext);
|
appelName = duplique_chaine(yytext);
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
@@ -833,34 +946,42 @@ n_exp *appelFct() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
return cree_n_exp_appel(sreturn);
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void listeExpressions() {
|
n_l_exp *listeExpressions() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
|
||||||
|
n_l_exp *sreturn = NULL;
|
||||||
|
n_exp *herite_exp = NULL;
|
||||||
|
n_l_exp *expression_liste = NULL;
|
||||||
|
|
||||||
if( est_premier( _expression_, uniteCourante ) || est_premier( _listeExpressionsBis_, uniteCourante ) ) {
|
if( est_premier( _expression_, uniteCourante ) || est_premier( _listeExpressionsBis_, uniteCourante ) ) {
|
||||||
expression();
|
herite_exp = expression();
|
||||||
listeExpressionsBis();
|
expression_liste = listeExpressionsBis();
|
||||||
|
sreturn = cree_n_l_exp(herite_exp,expression_liste);
|
||||||
} else if( !est_suivant( _listeExpressions_, uniteCourante ) ) {
|
} else if( !est_suivant( _listeExpressions_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
|
return sreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void listeExpressionsBis() {
|
n_l_exp *listeExpressionsBis() {
|
||||||
openSection( __func__ );
|
openSection( __func__ );
|
||||||
|
n_l_exp *sreturn = NULL;
|
||||||
|
n_exp *herite_exp = NULL;
|
||||||
|
n_l_exp *herite_l_exp = NULL;
|
||||||
if( uniteCourante == VIRGULE ) {
|
if( uniteCourante == VIRGULE ) {
|
||||||
elementConsome();
|
elementConsome();
|
||||||
uniteCourante = yylex();
|
uniteCourante = yylex();
|
||||||
|
|
||||||
expression();
|
herite_exp = expression();
|
||||||
listeExpressionsBis();
|
herite_l_exp = listeExpressionsBis();
|
||||||
|
sreturn = cree_n_l_exp(herite_exp,herite_l_exp);
|
||||||
} else if( !est_suivant( _listeExpressionsBis_, uniteCourante ) ) {
|
} else if( !est_suivant( _listeExpressionsBis_, uniteCourante ) ) {
|
||||||
syntaxError();
|
syntaxError();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSection( __func__ );
|
closeSection( __func__ );
|
||||||
}
|
return sreturn;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user