generate stack instructions