<commit_before># Copyright (C) 2008, The Perl Foundation.
# $Id$

=head1 NAME

PAST Building Blocks - A catalogue of PAST nodes and how to use them.

=head1 DESCRIPTION

This document describes the PIR output for each type of Parrot Abstract Syntax
Tree (PAST) node, and all available attributes.

=head1 PAST::Node

PAST::Node is the base class of all other PAST classes.

=head2 Attributes

=head3 C<:node>

{{XXX why do all nodes need this?}}

=head2 Methods

See L<docs/pdd26_ast.pod>.

=head1 PAST::Block

=head2 Synopsis

 PAST::Block.new()

Without any attributes, a PAST::Block translates to the following:

 .namespace []
 .sub "_block10"
     .return ()
 .end

=head2 Typical use

A block represents a lexical C<scope>. The most common use for a block
is subroutines (or functions or procedures or whatever name Your Language
gives to invokable objects). Usually, C<nested> blocks define a new scope
as well, which can also be represented by a block. A typical example is
the common C<if> statement (the example here uses Lua syntax):

 if <expr> then
   <block1>
 else<commit_msg>[docs] document why all PAST Nodes need the :node attribute<commit_after># Copyright (C) 2008, The Perl Foundation.
# $Id$

=head1 NAME

PAST Building Blocks - A catalogue of PAST nodes and how to use them.

=head1 DESCRIPTION

This document describes the PIR output for each type of Parrot Abstract Syntax
Tree (PAST) node, and all available attributes.

=head1 PAST::Node

PAST::Node is the base class of all other PAST classes.

=head2 Attributes

=head3 C<:node>

Sets this node's C<source> and C<pos> attributes.  These indicate which part of
the source code generated this node.  The C<node> attribute can be set using
another node or a Match object.

All nodes must have this attribute set.

=head2 Methods

See L<docs/pdd26_ast.pod>.

=head1 PAST::Block

=head2 Synopsis

 PAST::Block.new()

Without any attributes, a PAST::Block translates to the following:

 .namespace []
 .sub "_block10"
     .return ()
 .end

=head2 Typical use

A block represents a lexical C<scope>. The most common use for a block
is subroutines (or functions or procedures or whatever name Your Language
gives to invokable objects). Usually, C<nested> blocks define a new scope
as well, which can also be represented by a block. A typical example is
the common C<if> statement (the example here uses Lua syntax):

 if <expr> then
   <block1>
 else
{'fraction_non_alphanumeric': 0.07390586292320396, 'fraction_numerical': 0.01486374896779521, 'mean_word_length': 4.177350427350428, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '501725', 'n_tokens_mistral': 768, 'n_tokens_neox': 725, 'n_words': 355}