NAME

FP::AST::Perl -- abstract syntax tree for representing Perl code

SYNOPSIS

    use FP::AST::Perl ":all";
    use FP::List;

    is Get(LexVar('foo'))->string, '$foo';
    is Get(PackVarScalar "foo")->string, '$foo';
    is Get(PackVarArray "foo")->string, '@foo';
    is Get(PackVarHash "foo::bar")->string, '%foo::bar';

    my $foo= PackVarCode("foo");
    my $arrayfoo= PackVarArray("foo");
    my $lexfoo= LexVar("foo");
    is App(Get($foo), list())->string,
       '&foo()';
    is AppProto(Get($foo), list())->string,
       'foo()';
    is AppProto(Get($lexfoo), list(Ref($foo)))->string,
       '$foo->(\&foo)';
    is AppProto(Get($lexfoo), list(Get($lexfoo), Get($arrayfoo), Ref($arrayfoo)))->string,
       '$foo->($foo, @foo, \@foo)';
    is AppProto(Get($foo), list(Get(LexVar 'foo'), Literal(Number 123)))->string,
       'foo($foo, 123)';
    is AppProto(Get($foo), list(Get($lexfoo), Literal(String 123)))->string,
       'foo($foo, \'123\')';

DESCRIPTION

This is not a parser, and hence should be outside the scope of the "can only parse Perl at runtime" issue.

The longer term aim is to support all of Perl, and to support conversion to and maybe from an op tree.

SEE ALSO

Implements: FP::Abstract::Pure, FP::Abstract::Show, FP::Abstract::Equal.

NOTE

This is alpha software! Read the status section in the package README or on the website.