PyQuil has no constructs yet for representing gate instructions within a DEFCIRCUIT (ie. gates where the qubits
        are inputs to the call to the circuit). Therefore we parse them as a raw instructions.

def exitCircuitGate(self, ctx: QuilParser.CircuitGateContext):
        """
        PyQuil has no constructs yet for representing gate instructions within a DEFCIRCUIT (ie. gates where the qubits
        are inputs to the call to the circuit). Therefore we parse them as a raw instructions.
        """
        gate_name = ctx.name().getText()
        params = [param.getText() for param in ctx.param()]
        qubits = [qubit.getText() for qubit in ctx.circuitQubit()]
        if params:
            self.result.append(RawInstr('{}({}) {}'.format(gate_name, ', '.join(params), ' '.join(qubits))))
        else:
            self.result.append(RawInstr('{} {}'.format(gate_name, ' '.join(qubits))))