This shows you the differences between two versions of the page.
alf:res:subiecte [2017/05/18 02:36] alexandru.radovici |
alf:res:subiecte [2017/05/18 02:59] (current) alexandru.radovici |
||
---|---|---|---|
Line 12: | Line 12: | ||
[object methodParameterName1:parameter1 parameterName2:parameter2 parameterName3:parameter3 ...] | [object methodParameterName1:parameter1 parameterName2:parameter2 parameterName3:parameter3 ...] | ||
</code> | </code> | ||
- | - Ecrire un analyseur LL pour la grammaire suivante | + | - Ecrire un analyseur LL pour la grammaire suivante (FIRST, FOLLOW) <code> |
- | <code> | + | |
S -> select F from id | S -> select F from id | ||
S -> select F from id where E | S -> select F from id where E | ||
F -> id, F | F -> id, F | ||
F -> id | F -> id | ||
+ | F -> epsilon | ||
T -> id | T -> id | ||
E -> id op E | E -> id op E | ||
E -> id | E -> id | ||
E -> number | E -> number | ||
- | <code> | + | </code> |
+ | - Ecrire un analyseur LR pour la grammaire suivante (FIRST, FOLLOW) <code> | ||
+ | S -> select F from id | ||
+ | S -> select F from id where E | ||
+ | F -> id, F | ||
+ | F -> id | ||
+ | F -> epsilon | ||
+ | T -> id | ||
+ | E -> id op E | ||
+ | E -> id | ||
+ | E -> number | ||
+ | </code> | ||
+ | - Prouvez que la grammaire suivante n'est pas LL (0) / LR (0) <code>\ | ||
+ | E -> E + E | ||
+ | E -> id | ||
+ | E -> number | ||
+ | </code> | ||
+ | - Ecrivez l'arborescence pour la grammaire et la chaîne suivantes <code>\ | ||
+ | E -> E + E | ||
+ | E -> id | ||
+ | E -> number | ||
+ | (2-4+((5*6)+6))*67*7 | ||
+ | </code> | ||
+ | - Ecrivez l'AST pour le code source suivant<code> | ||
+ | var s = readNumber () | ||
+ | for (i=0; i<s; i++) | ||
+ | { | ||
+ | write (i*i); | ||
+ | } | ||
+ | </code> | ||
+ | - Ecrivez le Three Address Code pour le code source suivant<code> | ||
+ | var s = readNumber () | ||
+ | for (i=0; i<s; i++) | ||
+ | { | ||
+ | write (i*i); | ||
+ | } | ||
+ | </code> | ||
+ | - Ayant le langage d'assemblage suivant, écrivez le code source suivant<code> | ||
+ | mov alu, value ; alu = value | ||
+ | mov alu, reg ; alu = reg | ||
+ | mov reg, alu ; reg = alu | ||
+ | add reg ; alu = alu + reg | ||
+ | sub reg ; alu = alu - reg | ||
+ | mul reg ; alu = alu * reg | ||
+ | div reg ; alu = alu / reg | ||
+ | |||
+ | 2+3*(6+7) | ||
+ | </code> | ||
+ | - Allouert les variables suivantes<code> | ||
+ | struct | ||
+ | { | ||
+ | int n1; | ||
+ | int n2; | ||
+ | int n3; | ||
+ | int f[70] | ||
+ | } s; | ||
+ | |||
+ | s *s1, s2, s3[75], s4; | ||
+ | </code> | ||
+ | - Ecrivez le diagramme de flux de contrôle pour le code source suivant<code> | ||
+ | var s = 0; | ||
+ | while (s<1000) | ||
+ | { | ||
+ | s = s + 1; | ||
+ | if (s%6 == 0) s = s + 4; | ||
+ | else s = s * 3; | ||
+ | } | ||
+ | </code> |