It consists of the reaction of a primary amine with a 3-ketoester forming an imine, which later tautomerizes to enamnin, attacking an a-haloketone. In a subsequent cyclization stage, pyrrole is obtained.
Mechanism:
Step 1. Formation of the enamine
Step 2. Attack of the enamine on the a -haloketone
Step 3. Cycling
Stage 4. Dehydration