Instruction
using System.Runtime.CompilerServices;
namespace CLanguage.Interpreter
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class Instruction
{
public OpCode Op;
public Value X;
[System.Runtime.CompilerServices.Nullable(2)]
public Label Label;
public Instruction(OpCode op, Value x)
{
Op = op;
X = x;
}
public Instruction(OpCode op, Label label)
{
Op = op;
Label = label;
}
public override string ToString()
{
if (Label != null)
return $"{Op}""{Label}";
return $"{Op}""{X}";
}
}
}