藤 吾郎 > Acme-Perl-VM > Acme::Perl::VM

Download:
Acme-Perl-VM-0.006.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.006   Source  

NAME ^

Acme::Perl::VM - A Perl5 Virtual Machine in Pure Perl (APVM)

VERSION ^

This document describes Acme::Perl::VM version 0.006.

SYNOPSIS ^

    use Acme::Perl::VM;

    run_block{
        print "Hello, APVM world!\n",
    };

DESCRIPTION ^

Acme::Perl::VM is an implementation of Perl5 virtual machine in pure Perl.

Perl provides a feature to access compiled syntax trees (opcodes) by B module. B::* modules walk into opcodes and do various things; B::Deparse retrieves Perl source code from subroutine references, B::Concise reports formatted syntax trees, and so on.

This module also walks into the opcodes, and executes them with its own ppcodes.

You can run any Perl code:

    use Acme::Perl::VM;

    run_block {
        print "Hello, APVM world!\n";
    };

This code says Hello, APVM world to stdout as you expect.

Here is a more interesting example:

    BEGIN{ $ENV{APVM} = 'trace' }
    use Acme::Perl::VM;

    run_block {
        print "Hello, APVM world!\n";
    };

And you'll get a list of opcodes as the code runs:

    .entersub(&__ANON__) VOID
    .nextstate(main -:4) VOID
    .pushmark SCALAR
    .const("Hello, APVM world!\n") SCALAR
    .print SCALAR KIDS
    Hello, APVM world!
    .leavesub KIDS

The first entersub is the start of the block. The next nextstate indicates the statement that says hello. pushmark, const, and print are opcodes which runs on the statement. The last leavesub is the end of the block. This is a future of the module.

In short, the module has no purpose :)

DEPENDENCIES ^

Perl 5.8.1 or later.

BUGS ^

No bugs have been reported.

Please report any bugs or feature requests to the author.

AUTHOR ^

Goro Fuji (gfx) <gfuji(at)cpan.org>.

SEE ALSO ^

perlapi.

perlhack.

pp.h for PUSH/POP macros.

pp.c, pp_ctl.c, and pp_hot.c for ppcodes.

op.h for opcodes.

cop.h for COP and context blocks.

scope.h and scope.c for scope stacks.

pad.h and pad.c for pad variables.

run.c for runops.

B.

B::Concise.

Devel::Optrace.

LICENSE AND COPYRIGHT ^

Copyright (c) 2009, Goro Fuji (gfx). Some rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: