As I have mentioned elsewhere, I have developed a program that converts MAXQ executor code into IRP notation. This brought to light two requirements that standard IRP notation does not handle. One is the If .. Then .. Else construction that Rob has raised, the other is the use of arrays, where one or two bits of a variable byte form an index into the array formed by the fixed bytes. I handled these in an informal way that is intended to be reasonably self-explanatory to a human reader. Here, as a simple example, is the output for the Sony Combo protocol:
Code: Select all
Sony Combo (12/15/20): PID=0027.new
4 fixed bytes: bit-reversed A B C D
2 variable bytes: bit-reversed X Y
If X:1:7=0
Preamble:
N1=A[Y:-2:5]
{40.0k,600}<1,-1|2,-1>(4,-1,X:7,Y:5,^45000u)3+ // when Y=0xxxxxxx
{40.0k,600}<1,-1|2,-1>(4,-1,X:7,Y:5,N1:8,^45000u)3+ // when Y=1xxxxxxx
If X:1:7=1
{40.0k,600}<1,-1|2,-1>(4,-1,X:7,Y:8,^45000u)3+
The preamble is a pre-processor that in the general case may itself contain conditional statements. This gives three levels of conditionals, an outer one before any required preamble, conditionals within any preambles, and finally an inner one after the preamble. There may be executors that even this structure does not cover, as my program handles most, but not all, known MAXQ executors.
I would be interested in seeing an extension of IRP notation that could cover these requirements in a way that is machine-processable while retaining reasonable readability for human readers. Over to you, Barf?