B::Concise

B::Concise is a Perl syntax tree, printing concise info about ops.
Download

B::Concise Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Stephen McCamant
  • Publisher web site:
  • http://search.cpan.org/~smccam/X11-Protocol-0.56/Protocol.pm

B::Concise Tags


B::Concise Description

B::Concise is a Perl syntax tree, printing concise info about ops. B::Concise is a Perl syntax tree, printing concise info about ops.SYNOPSIS perl -MO=Concise foo.pl use B::Concise qw(set_style add_callback);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 structure, and the format of the information displayed is customizable. Its function is similar to that of perl's -Dx debugging flag or the B::Terse module, but it is more sophisticated and flexible.EXAMPLEHere's an example of 2 outputs (aka 'renderings'), using the -exec and -basic (i.e. default) formatting conventions on the same code snippet. % perl -MO=Concise,-exec -e '$a = $b + 42' 1 enter 2 nextstate(main 1 -e:1) v 3 gvsv s 4 const s * 5 add sK/2 6 gvsv s 7 sassign vKS/2 8 leave vKP/REFCEach line corresponds to an opcode. The opcode marked with '*' is used in a few examples below.The 1st column is the op's sequence number, starting at 1, and is displayed in base 36 by default. This rendering is in -exec (i.e. execution) order.The symbol between angle brackets indicates the op's type, for example; < 2 > is a BINOP, < @ > a LISTOP, and < # > is a PADOP, which is used in threaded perls. (see "OP class abbreviations").The opname, as in 'add', which may be followed by op-specific information in parentheses or brackets (ex '').The op-flags (ex 'sK/2') follow, and are described in ("OP flags abbreviations"). % perl -MO=Concise -e '$a = $b + 42' 8 leave vKP/REFC ->(end) 1 enter ->2 2 nextstate(main 1 -e:1) v ->3 7 sassign vKS/2 ->8 * 5 add sK/2 ->6 - ex-rv2sv sK/1 ->4 3 gvsv(*b) s ->4 4 const(IV 42) s ->5 - ex-rv2sv sKRM*/1 ->7 6 gvsv(*a) s ->7The default rendering is top-down, so they're not in execution order. This form reflects the way the stack is used to parse and evaluate expressions; the add operates on the two terms below it in the tree.Nullops appear as ex-opname, where opname is an op that has been optimized away by perl. They're displayed with a sequence-number of '-', because they are not executed (they don't appear in previous example), they're printed here because they reflect the parse.The arrow points to the sequence number of the next op; they're not displayed in -exec mode, for obvious reasons.Note that because this rendering was done on a non-threaded perl, the PADOPs in the previous examples are now SVOPs, and some (but not all) of the square brackets have been replaced by round ones. This is a subtle feature to provide some visual distinction between renderings on threaded and un-threaded perls.Requirements:· Perl Requirements: · Perl


B::Concise Related Software