parse+generate casts