4. Invalid Value Calculations

Invalid values occur when the information used to calculate a value that isn't available yet. Usually this starts with an unresolved label value, which is defined later in the source code. Normally you would stop assembling the current directive once you reach an invalid value, but that might leave out some side effects you did intend to happen, so instead of stopping, the assembler now carries on operating on the invalid values. So an unresolved label is just an unresolved Number value. If you add two number values and one of them is invalid then the result will be another invalid number value. If you compare two invalid numbers then you get an invalid boolean and so forth. This helps to track down which values to invalidate. If for example you use an invalid number as index in a set function on a list, you must invalidate the whole list since you don't know which element is overwritten. Some examples of invalid value calculations:

4+InvalidNumber -> InvalidNumber
InvalidNumber != 5 ->  InvalidBoolean
myList.set(3, InvalidNumber) -> [?,?,InvalidNumber]
myList.set(InvalidNumber, “Hello”) -> InvalidList
myList.set(4+4*InvalidNumber, “Hello”) -> InvalidList