Perl source code is compiled into things called optrees. This is a linked list of things to execute and you can see some parts of this if you use the B::Concise module. Here's an example: C:\Documents and Settings\Josh>perl -MO=Concise -e "print @ARGV"
7 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v ->3
6 <@> print vK ->7
3 <0> pushmark s ->4
5 <1> rv2av[t2] lK/1 ->6
4 <#> gv[*ARGV] s ->5
-e syntax OK
This is actually just a bunch of C structs and perl is just walking them in order using this ultra simple runloop: int
Perl_runops_standard(pTHX)
{
dVAR;
while ((PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX))) {
PERL_ASYNC_CHECK();
}
TAINT_NOT;
return 0;
}
Since perl code is compiled into a kind of data, it's actually pretty lispy by this point. You can inspect and modify this data directly.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|