Préparation pour test intermediaire

- Analyseur lexical OK
- Analyseur syntaxyque OK
This commit is contained in:
2016-02-09 15:45:20 +01:00
parent 3b5b693f67
commit 755d2b6140
63 changed files with 8847 additions and 49 deletions

7
test/input/affect-err.l Normal file
View File

@@ -0,0 +1,7 @@
entier $a;
main()
{
$a = 5;
ecrire( $a );
}
$extra = 0;

6
test/input/affect.l Normal file
View File

@@ -0,0 +1,6 @@
entier $a;
main()
{
$a = 1;
ecrire($a);
}

11
test/input/boucle.l Normal file
View File

@@ -0,0 +1,11 @@
entier $i, entier $carre;
main()
{
$i = 0;
tantque $i < 10 faire
{
$carre = $i * $i;
ecrire( $carre );
$i = $i + 1;
}
}

5
test/input/expression.l Normal file
View File

@@ -0,0 +1,5 @@
entier $a;
main()
{
ecrire(5 * 2);
}

23
test/input/max.l Normal file
View File

@@ -0,0 +1,23 @@
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 );
}
}

57
test/input/tri.l Normal file
View File

@@ -0,0 +1,57 @@
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 );
}