/// <summary> /// In write mode, writes the value of a variable to the current structure. In read mode, /// unifies the value in the current structure with the value of a variable. /// </summary> private bool UnifyValue(int variable) { if (!_writeMode) { if (!_registers[variable].Unify(_structurePtr, _trail)) { return(false); } } else { _lastArgument.SetTo(_registers[variable]); _lastArgument = _lastArgument.NextArgument; } _structurePtr = _structurePtr.NextArgument; return(true); }
/// <summary> /// Binds one value to anoteher /// </summary> private void Bind(IReferenceLiteral target, IReferenceLiteral value) { _trail.Record(target); target.SetTo(value); }
/// <summary> /// Binds a value to the heap /// </summary> private void Bind(IReferenceLiteral target, IReferenceLiteral value) { target.SetTo(value); _trails.Peek().Record(target); }