private string GetInstructionStatement(AbstractInstruction inst)
{
string statement = "program.Add(iset.CreateInstruction(";
if (inst.Name() == "procedure")
{
ProcedureInstruction pi = (ProcedureInstruction)inst;
statement += "\"procedure\", \"" + pi.ProcedureName + "\", \"" + pi.Arity + "\"";
}
else
{
if (inst._arguments == null || inst._arguments.Length == 0)
{
statement += "\"" + inst.Name() + "\"";
}
else
{
statement += "\"" + inst.Name() + "\", ";
for (int i = 0; i < inst._arguments.Length; i++)
{
statement += "\"" + inst._arguments[i] + "\"";
if (i != (inst._arguments.Length - 1))
{
statement += ", ";
}
}
}
}
statement += "));";
return statement;
}