NAME
Compiler::Parser::AST
DESCRIPTION
METHODS
- my $ast = Compiler::Parser->new->parse($tokens);
-
Get blessed object of Compiler::Parser::AST. This method requires $tokens from Compiler::Lexer::tokenize.
- my $root_node = $ast->root;
-
Get root node from AST. $ast is created by Compiler::Parser::parse.
- my $find_nodes = $ast->find(type => 'Int');
-
Find node from 'node' or 'kind' or 'type' or 'data' parameter.
- $ast->walk(sub { my $node = shift; });
-
Walk AST. This method requires anonymous subroutine as argument. Subroutine's first argument is instance inherited Compiler::Parser::Node.
- walk { my $node = $_; } $ast;
-
Walk AST. This method must be exported by 'use Compiler::Parser::AST qw/walk/;' $_ is instance inherited Compiler::Parser::Node.
- $ast->remove(node => 'Function');
-
Remove nodes from 'node' or 'kind' or 'type' or 'data' parameter.
AUTHOR
Masaaki Goshima (goccy) <goccy54@gmail.com>
COPYRIGHT AND LICENSE
Copyright (C) Masaaki Goshima (goccy).
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.