NAME ^

tools/build/ops2c.pl - Parser for .ops files

SYNOPSIS ^

    % perl tools/build/ops2c.pl trans [--help] [--no-lines] [--dynamic]
                                      [--core | input.ops [input2.ops ...]]
       trans := C | CGoto | CGP | CSwitch | CPrederef

For example:

    % perl tools/build/ops2c.pl C --core

    % perl tools/build/ops2c.pl C --dynamic myops.ops

DESCRIPTION ^

This script uses a supplied transform to create a pair of C header and implementation files from the operation definitions found in one or more *.ops files.

Transforms ^

The first command-line argument is the last package name component of a subclass of Parrot::OpTrans. These subclasses all have full names of the form Parrot::OpTrans::*. An instance of the class is created and later consulted for various bits of information needed to generate the C code. Each creates a different type of run loop.

C
Create the function-based (slow or fast core) run loop.
CGoto
Create the goto run loop.
CGP
Create the goto and predereferenced run loop.
CSwitch
Create the switched and predereferenced run loop.
CPrederef
Create the predereferenced run loop.

Options ^

--help
Print synopsis.
--dynamic
Indicate that the opcode library is dynamic.
--core
Build the Parrot core opcode library.
--no-lines
Do not generate #line directives in the generated C code.

NOTE ^

Most of the functionality in tools/build/ops2c.pl has been extracted into methods and subroutines found in Parrot::Ops2c::Utils and Parrot::Ops2c::Auxiliary. This refactoring facilitates unit testing and coverage analysis of that functionality. A test suite has been provided in t/tools/ops2cutils/. It is recommended that future refactoring of this functionality proceed in a test-driven manner, i.e., tests should be written reflecting any changes to interface or functionality; the code should be written which implements the revisions; the code should be tested; and coverage analysis should be performed with Devel::Cover to measure the extent to which the tests exercise the code.

AUTHORS ^

Based on the commit logs, the following members of the Parrot project have contributed to this program:

    ambs bernhard boemmels brentdax chip
    coke dan gregor grunblatt jgoff
    jkeenan jonathan josh jrieks leo
    mikescott mrjoltcola nicholas particle paultcochrane
    petdance rgrjr robert simon

SEE ALSO ^

tools/build/ops2pm.pl
Parrot::OpsFile
Parrot::Op
Parrot::OpTrans
Parrot::OpTrans::C
Parrot::OpTrans::CGoto
Parrot::OpTrans::Compiled
Parrot::OpTrans::CGP
Parrot::OpTrans::CSwitch
Parrot::OpTrans::CPrederef
Parrot::Ops2c::Utils
Parrot::Ops2c::Auxiliary


parrot