B::Concise
B::Concise(e)Perl Programmers Reference GuidB::Concise(e)



NAME
       B::Concise - Walk Perl syntax tree, printing concise info
       about ops

SYNOPSIS
           perl -MO=Concise[,OPTIONS] foo.pl


DESCRIPTION
       This compiler backend prints the internal OPs of a Perl
       program's syntax tree in one of several space-efficient
       text formats suitable for debugging the inner workings of
       perl or other compiler backends. It can print OPs in the
       order they appear in the OP tree, in the order they will
       execute, or in a text approximation to their tree struc-
       ture, and the format of the information displyed is cus-
       tomizable. Its function is similar to that of perl's -Dx
       debugging flag or the B::Terse module, but it is more
       sophisticated and flexible.

OPTIONS
       Arguments that don't start with a hyphen are taken to be
       the names of subroutines to print the OPs of; if no such
       functions are specified, the main body of the program
       (outside any subroutines, and not including use'd or
       require'd files) is printed.

       -basic
           Print OPs in the order they appear in the OP tree (a
           preorder traversal, starting at the root). The inden-
           tation of each OP shows its level in the tree.  This
           mode is the default, so the flag is included simply
           for completeness.

       -exec
           Print OPs in the order they would normally execute
           (for the majority of constructs this is a postorder
           traversal of the tree, ending at the root). In most
           cases the OP that usually follows a given OP will
           appear directly below it; alternate paths are shown by
           indentation. In cases like loops when control jumps
           out of a linear path, a 'goto' line is generated.

       -tree
           Print OPs in a text approximation of a tree, with the
           root of the tree at the left and 'left-to-right' order
           of children transformed into 'top-to-bottom'. Because
           this mode grows both to the right and down, it isn't
           suitable for large programs (unless you have a very
           wide terminal).

       -compact
           Use a tree format in which the minimum amount of space
           is used for the lines connecting nodes (one character
           in most cases). This squeezes out a few precious
           columns of screen real estate.

       -loose
           Use a tree format that uses longer edges to separate
           OP nodes. This format tends to look better than the
           compact one, especially in ASCII, and is the default.

       -vt Use tree connecting characters drawn from the VT100
           line-drawing set.  This looks better if your terminal
           supports it.

       -ascii
           Draw the tree with standard ASCII characters like "+"
           and "|". These don't look as clean as the VT100 char-
           acters, but they'll work with almost any terminal (or
           the horizontal scrolling mode of less(s)) and are
           suitable for text documentation or email. This is the
           default.

       -main
           Include the main program in the output, even if sub-
           routines were also specified.

       -basen
           Print OP sequence numbers in base n. If n is greater
           than 10, the digit for 11 will be 'a', and so on. If n
           is greater than 36, the digit for 37 will be 'A', and
           so on until 62. Values greater than 62 are not cur-
           rently supported. The default is 36.

       -bigendian
           Print sequence numbers with the most significant digit
           first. This is the usual convention for Arabic numer-
           als, and the default.

       -littleendian
           Print seqence numbers with the least significant digit
           first.

       -concise
           Use the author's favorite set of formatting conven-
           tions. This is the default, of course.

       -terse
           Use formatting conventions that emulate the ouput of
           B::Terse. The basic mode is almost indistinguishable
           from the real B::Terse, and the exec mode looks very
           similar, but is in a more logical order and lacks
           curly brackets. B::Terse doesn't have a tree mode, so
           the tree mode is only vaguely reminiscient of
           B::Terse.

       -linenoise
           Use formatting conventions in which the name of each
           OP, rather than being written out in full, is repre-
           sented by a one- or two-character abbreviation.  This
           is mainly a joke.

       -debug
           Use formatting conventions reminiscient of B::Debug;
           these aren't very concise at all.

       -env
           Use formatting conventions read from the environment
           variables "B_CONCISE_FORMAT", "B_CONCISE_GOTO_FORMAT",
           and "B_CONCISE_TREE_FORMAT".

FORMATTING SPECIFICATIONS
       For each general style ('concise', 'terse', 'linenoise',
       etc.) there are three specifications: one of how OPs
       should appear in the basic or exec modes, one of how
       'goto' lines should appear (these occur in the exec mode
       only), and one of how nodes should appear in tree mode.
       Each has the same format, described below. Any text that
       doesn't match a special pattern is copied verbatim.

       (x(exec_text;basic_text)x)
           Generates exec_text in exec mode, or basic_text in
           basic mode.

       (*(text)*)
           Generates one copy of text for each indentation level.

       (*(text1;text2)*)
           Generates one fewer copies of text1 than the indenta-
           tion level, followed by one copy of text2 if the
           indentation level is more than 0.

       (?(text1#varText2)?)
           If the value of var is true (not empty or zero), gen-
           erates the value of var surrounded by text1 and Text2,
           otherwise nothing.

       #var
           Generates the value of the variable var.

       #varN
           Generates the value of var, left jutified to fill N
           spaces.

       ~   Any number of tildes and surrounding whitespace will
           be collapsed to a single space.

       The following variables are recognized:

       #addr
           The address of the OP, in hexidecimal.

       #arg
           The OP-specific information of the OP (such as the SV
           for an SVOP, the non-local exit pointers for a LOOP,
           etc.) enclosed in paretheses.

       #class
           The B-determined class of the OP, in all caps.

       #classym
           A single symbol abbreviating the class of the OP.

       #coplabel
           The label of the statement or block the OP is the
           start of, if any.

       #exname
           The name of the OP, or 'ex-foo' if the OP is a null
           that used to be a foo.

       #extarg
           The target of the OP, or nothing for a nulled OP.

       #firstaddr
           The address of the OP's first child, in hexidecimal.

       #flags
           The OP's flags, abbreviated as a series of symbols.

       #flagval
           The numeric value of the OP's flags.

       #hyphenseq
           The sequence number of the OP, or a hyphen if it
           doesn't have one.

       #label
           'NEXT', 'LAST', or 'REDO' if the OP is a target of one
           of those in exec mode, or empty otherwise.

       #lastaddr
           The address of the OP's last child, in hexidecimal.

       #name
           The OP's name.

       #NAME
           The OP's name, in all caps.

       #next
           The sequence number of the OP's next OP.

       #nextaddr
           The address of the OP's next OP, in hexidecimal.

       #noise
           The two-character abbreviation for the OP's name.

       #private
           The OP's private flags, rendered with abbreviated
           names if possible.

       #privval
           The numeric value of the OP's private flags.

       #seq
           The sequence number of the OP.

       #seqnum
           The real sequence number of the OP, as a regular num-
           ber and not adjusted to be relative to the start of
           the real program. (This will generally be a fairly
           large number because all of B::Concise is compiled
           before your program is).

       #sibaddr
           The address of the OP's next youngest sibling, in hex-
           idecimal.

       #svaddr
           The address of the OP's SV, if it has an SV, in hex-
           idecimal.

       #svclass
           The class of the OP's SV, if it has one, in all caps
           (e.g., 'IV').

       #svval
           The value of the OP's SV, if it has one, in a short
           human-readable format.

       #targ
           The numeric value of the OP's targ.

       #targarg
           The name of the variable the OP's targ refers to, if
           any, otherwise the letter t followed by the OP's targ
           in decimal.

       #targarglife
           Same as #targarg, but followed by the COP sequence
           numbers that delimit the variable's lifetime (or 'end'
           for a variable in an open scope) for a variable.

       #typenum
           The numeric value of the OP's type, in decimal.

ABBREVIATIONS
       OP flags abbreviations

           v      OPf_WANT_VOID    Want nothing (void context)
           s      OPf_WANT_SCALAR  Want single value (scalar context)
           l      OPf_WANT_LIST    Want list of any length (list context)
           K      OPf_KIDS         There is a firstborn child.
           P      OPf_PARENS       This operator was parenthesized.
                                    (Or block needs explicit scope entry.)
           R      OPf_REF          Certified reference.
                                    (Return container, not containee).
           M      OPf_MOD          Will modify (lvalue).
           S      OPf_STACKED      Some arg is arriving on the stack.
           *      OPf_SPECIAL      Do something weird for this op (see op.h)


       OP class abbreviations

           0      OP (aka BASEOP)  An OP with no children
           1      UNOP             An OP with one child
           2      BINOP            An OP with two children
           |      LOGOP            A control branch OP
           @      LISTOP           An OP that could have lots of children
           /      PMOP             An OP with a regular expression
           $      SVOP             An OP with an SV
           "      PVOP             An OP with a string
           {      LOOP             An OP that holds pointers for a loop
           ;      COP              An OP that marks the start of a statement


AUTHOR
       Stephen McCamant, "smcc@CSUA.Berkeley.EDU"



perl v5.6.1                 2001-02-23          B::Concise(e)