Content deleted Content added
m clean up, typos fixed: internaly → internally using AWB |
→Opcodes: spelling |
||
Line 4:
==Implementation==
===Opcodes===
The Perl compiler outputs a compiled program into memory as an internal structure which can be represented as a tree graph in which each node represents an opcode. Opcodes are represented internally by [[typedef]]s. Each opcode has a ''next'' node and ''sibling'' node, so the opcode tree can be
Perl's opcodes interpreter is implemented as a tree walker which travels by opcode tree in execute order from start node. Each opcode is assigned with internal pp_''opname'' function, i.e. say opcode calls pp_say function of internal Perl API.
The phase of compiling the Perl program is hidden for the end user, but it can be exposed with B Perl module<ref name="B">{{cite web | url=http://search.cpan.org/perldoc?B | title=B - The Perl Compiler Backend}}</ref> or other specialized modules which provides an access to internal API of compilator and opcode walker like B::Concise Perl module<ref>{{cite web | url=http://perldoc.perl.org/B/Concise.html | title=B::Concise - Walk Perl syntax tree, printing concise info about ops}}</ref>.
An example of compiled simple [[Hello world]] program with a help of B::Concise Perl module, dumped in execute order:
Line 22:
</source>
Some opcodes (entereval, dofile, require) call Perl compiler functions which generate
===Variables===
|