B::Generate 1.06
Sponsored Links
B::Generate 1.06 Ranking & Summary
File size:
0.012 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
1210
Date added:
2006-07-04
Publisher:
Simon Cozens
B::Generate 1.06 description
B::Generate is a Perl module which you can create your own op trees.
SYNOPSIS
use B::Generate;
# Do nothing, slowly.
CHECK {
my $null = new B::OP("null",0);
my $enter = new B::OP("enter",0);
my $cop = new B::COP(0, "hiya", 0);
my $leave = new B::LISTOP("leave", 0, $enter, $null);
$leave->children(3);
$enter->sibling($cop);
$enter->next($cop);
$cop->sibling($null);
$null->next($leave);
$cop->next($leave);
# Tell Perl where to find our tree.
B::main_root($leave);
B::main_start($enter);
}
WARNING
This module will create segmentation faults if you dont know how to use it properly. Further warning: sometimes I dont know how to use it properly.
There are lots of other methods and utility functions, but they are not documented here. This is deliberate, rather than just through laziness. You are expected to have read the Perl and XS sources to this module before attempting to do anything with it.
Patches welcome.
Malcolm Beatties B module allows you to examine the Perl op tree at runtime, in Perl space; its the basis of the Perl compiler. But what it doesnt let you do is manipulate that op tree: it wont let you create new ops, or modify old ones. Now you can.
Well, if youre intimately familiar with Perls internals, you can.
B::Generate turns Bs accessor methods into get-set methods. Hence, instead of merely saying
$op2 = $op->next;
you can now say
$op->next($op2);
to set the next op in the chain. It also adds constructor methods to create new ops. This is where it gets really hairy.
new B::OP ( type, flags )
new B::UNOP ( type, flags, first )
new B::BINOP ( type, flags, first, last )
new B::LOGOP ( type, flags, first, other )
new B::LISTOP ( type, flags, first, last )
new B::COP ( flags, name, first )
In all of the above constructors, type is either a numeric value representing the op type (62 is the addition operator, for instance) or the name of the op. ("add")
(Incidentally, if you know about custom ops and have registed them properly with the interpreter, you can create custom ops by name: new B::OP("mycustomop",0), or whatever.)
first, last and other are ops to be attached to the current op; these should be B::OP objects. If you havent created the ops yet, dont worry; give a false value, and fill them in later:
$x = new B::UNOP("negate", 0, undef);
# ... create some more ops ...
$x->first($y);
In addition, one may create a new nextstate operator with
newstate B::op ( flags, label, op)
in the same manner as B::COP::new - this will also, however, add the lineseq op.
Finally, you can set the main root and the starting op by passing ops to the B::main_root and B::main_start functions.
This module can obviously be used for all sorts of fun purposes. The best one will be in conjuction with source filters; have your source filter parse an input file in a foreign language, create an op tree for it and get Perl to execute it. Then email me and tell me how you did it. And why.
SYNOPSIS
use B::Generate;
# Do nothing, slowly.
CHECK {
my $null = new B::OP("null",0);
my $enter = new B::OP("enter",0);
my $cop = new B::COP(0, "hiya", 0);
my $leave = new B::LISTOP("leave", 0, $enter, $null);
$leave->children(3);
$enter->sibling($cop);
$enter->next($cop);
$cop->sibling($null);
$null->next($leave);
$cop->next($leave);
# Tell Perl where to find our tree.
B::main_root($leave);
B::main_start($enter);
}
WARNING
This module will create segmentation faults if you dont know how to use it properly. Further warning: sometimes I dont know how to use it properly.
There are lots of other methods and utility functions, but they are not documented here. This is deliberate, rather than just through laziness. You are expected to have read the Perl and XS sources to this module before attempting to do anything with it.
Patches welcome.
Malcolm Beatties B module allows you to examine the Perl op tree at runtime, in Perl space; its the basis of the Perl compiler. But what it doesnt let you do is manipulate that op tree: it wont let you create new ops, or modify old ones. Now you can.
Well, if youre intimately familiar with Perls internals, you can.
B::Generate turns Bs accessor methods into get-set methods. Hence, instead of merely saying
$op2 = $op->next;
you can now say
$op->next($op2);
to set the next op in the chain. It also adds constructor methods to create new ops. This is where it gets really hairy.
new B::OP ( type, flags )
new B::UNOP ( type, flags, first )
new B::BINOP ( type, flags, first, last )
new B::LOGOP ( type, flags, first, other )
new B::LISTOP ( type, flags, first, last )
new B::COP ( flags, name, first )
In all of the above constructors, type is either a numeric value representing the op type (62 is the addition operator, for instance) or the name of the op. ("add")
(Incidentally, if you know about custom ops and have registed them properly with the interpreter, you can create custom ops by name: new B::OP("mycustomop",0), or whatever.)
first, last and other are ops to be attached to the current op; these should be B::OP objects. If you havent created the ops yet, dont worry; give a false value, and fill them in later:
$x = new B::UNOP("negate", 0, undef);
# ... create some more ops ...
$x->first($y);
In addition, one may create a new nextstate operator with
newstate B::op ( flags, label, op)
in the same manner as B::COP::new - this will also, however, add the lineseq op.
Finally, you can set the main root and the starting op by passing ops to the B::main_root and B::main_start functions.
This module can obviously be used for all sorts of fun purposes. The best one will be in conjuction with source filters; have your source filter parse an input file in a foreign language, create an op tree for it and get Perl to execute it. Then email me and tell me how you did it. And why.
B::Generate 1.06 Screenshot
B::Generate 1.06 Keywords
OP
Generate 1.06
COP
Can Create Your Own
Create Your Own
Can Create
Your Own
Perl module
new
create
Perl
ops
module
first
B::Generate
BGenerate
Bookmark B::Generate 1.06
B::Generate 1.06 Copyright
WareSeeker periodically updates pricing and software information of B::Generate 1.06 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of B::Generate 1.06 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
create your own myspace layout
create your own card
create your own website
create your own south park character
create your own car
create your own buddy icon
create your own graffiti
create your own pokemon
create your own web page
module master
create hotmail account
create your own ringtones
create your own shoes
create your own finisher
create your own layout
games where you can create your own character
create your own crossword puzzle
lunar module
Related Software
Apache::Storage is Perl module containing simple functions to store and retrieve information from within the Apache process. Free Download
Gimp::Net is a communication module for the gimp-perl server. Free Download
Basset::Container::Hash Perl module implements a layered hash. Free Download
MyCMS perl module provides the MN::CMS Perl module used by the MyCMS. Free Download
Zonestats create an RRD database with the values of CPU and memory (RSS) usage per Solaris 10 zone. Free Download
B::Graph is a Perl compiler backend to produce graphs of OP trees. Free Download
Games::Sudoku::General is a Perl module that can solve sudoku-like puzzles. Free Download
XHTML Family Tree Generator is a CGI Perl script that will create views of a family tree from a supplied data file. Free Download
Latest Software
Popular Software
Favourite Software