sig writes:
Yet again, issue was in using registers with same name but for different instances. Confused me second time, since intermediate of registers with same name looks perfectly same.
Maybe its better to change #intermediateForm/#printOn: of MedMachineRegister to put name with following object's hash? Just to avoid misinterpretation in future..
I'd probably write a validate method that validates the intermediate and checks that there's only one register object for each register name.
Having multiple registers for the same name is not a problem I've personally had. However a similar problem is forgetting to convert a sub-expression and just using the one in the input intermediate.
There are verify methods scattered around the unit testing framework designed to catch these hard to spot errors. Unit testing is a good place to put them as they'll identify the stage where the error is introduced.
It's common for Exupery's unit test suites to end with a call to "self verify" which will then call the verification methods required.
Bryce