Template compiler