

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
is very competitive and very good
Typology: Exercises
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Solution: On a une seule règle récursive gauche (directe) et aucune indirecte. À la place du couple règle récursive gauche L → L, S plus règle de terminaison de la récursion L → S, on commence par dériver la terminaison par S avec la nouvelle règle L → SL′^ puis c’est L′^ qui capte la récursion L′^ →, SL′^ ou bien termine L′^ → ε.
Solution:
(b) Appliquer l’algorithme à la grammaire donnée ci-dessus.
Solution: S′^ → S | ε S → aSbS | bSaS | ab | ba | aSb | abS | bSa | baS
S → AB | A ; A → aB | bA | aSb ; B → S | b
Solution: S → AB | aB | bA | aSb ; A → aB | bA | aSb ; B → AB | aB | bA | aSb | b
E → Ea | b
Solution: E → bE′ E′^ → aE′^ | ε
S → AB | aS | a A → Ab | ε B → AS
S′^ → S | ε S → AB | (ε)B | aS | a A → Ab | (ε)b B → AS | (ε)S
S′^ → S | ε S → AB | B | aS | a A → Ab | b B → AS | S Il faut ensuite débarrasser la grammaire des productions singulières, qui sont exclues dans une grammaire quadratique. L’algorithme général est le suivant :
Page 2