How to write the code of calvo pricing?

I developed a standard calvo pricing equation including marginal cost, output and price of intermediate goods, which requires totaling infinite period variables ,so I don’t know how to put it into dynare.I guess anybody could help me here.THANKS.

See New Area-Wide Model (NAWM) wage setting and https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Gali_2015/Derivation_Recursive_Pricing_Equation.pdf