6.3. The opcode table and opcodes.pl

The header files for the opcode tables are generated from a Perl program called opcode.pl. Here is a sample entry for an op:

index             index                      ck_index isT@     S S S?  
The entry is in five columns.

The first column is the internal name of the operator. When opcode.pl is run, it will create an enum including the symbol OP_INDEX.

The second column is the English description of the operator which will be printed during error messages.

The third column is the name of the "check" function which will be used to optimize this tree; see Section 6.5.

Then come additional flags plus a character which specifies the "flavour" of the op: in this case, index is a list op, since it can take more than two parameters, so it has the symbol @.

Finally, the "prototype" for the function is given: S S S? translates to the Perl prototype $$;$, which is indeed the prototype for CORE::index.

While most people will never need to edit the op table, it is as well to understand how Perl "knows" what the ops look like. There is a full description of the format of the table, including details of the meanings of the flags, in opcodes.pl.