Information Technology Reference
In-Depth Information
C hapitre 6
Exercices corrigés 6
PRODUCTION DE PROGRAMMES
6.1 Compilation
Soit le langage défini par les règles de Backus-Naur suivantes :
<programme> :: = PROGRAM <identificateur> <corps de programme>
<corps de programme> :: = <suite de declarations> DEBUT <suite
d'instructions> FIN
<suite de declarations> :: = <declaration> | <declaration> <suite
de declarations>
<declaration> :: = INT <identificateur>; | BOOLEAN <identificateur>;
<suite d'instructions> :: = <instruction> | <instruction> <suite
d'instructions>
<instruction> :: = <affectation> | <conditionnelle> | <iteration>
<affectation> :: = <identificateur> = <terme>; | <identificateur> = <terme>
<operateur> <terme>; | <identificateur> = VRAI; |
<identificateur> = FAUX;
<conditionnelle> :: = SI <expression> ALORS <suite d'instructions> FSI
<iteration> :: = LOOP <expression> FAIRE <suite d'instructions> FAIT
<expression> :: = (<terme> <operexpr> <terme>) | (<identificateur> == VRAI) |
(<identificateur> == FAUX)
<operexpr> :: = == | <|> | ?
<terme> :: = <entier>| <identificateur>
<operateur> :: = + | - | * | /
<identificateur> :: = <lettre> | <lettre> <chiffre>
 
Search WWH ::




Custom Search