<commit_before>=head1 NAME

PAST - Parrot abstract syntax tree

=head1 DESCRIPTION

This file implements the various abstract syntax tree nodes
for compiling programs in Parrot.

=cut

.namespace [ 'PAST::Node' ]

.sub 'onload' :anon :load :init
    ##   create the PAST::Node base class
    .local pmc protomaker, base
    protomaker = get_hll_global 'Protomaker'
    base = protomaker.'new_subclass'('PCT::Node', 'PAST::Node')

    $P0 = protomaker.'new_subclass'(base, 'PAST::Op')
    $P0 = protomaker.'new_subclass'(base, 'PAST::Stmts')
    $P0 = protomaker.'new_subclass'(base, 'PAST::Val')
    $P0 = protomaker.'new_subclass'(base, 'PAST::Var')
    $P0 = protomaker.'new_subclass'(base, 'PAST::Block')
    $P0 = protomaker.'new_subclass'(base, 'PAST::VarList')

    .return ()
.end

=head1 PAST Node types

=head2 PAST::Node

C<PAST::Node> is the base class for all PAST nodes, and is
derived from PCT::Node.  A node has an array component to
hold its children, and a hash component for its attributes.
However, we tend to use accessor methods for accessing the node's
attributes instead of accessing the hash directly.

Every PAST node inherits C<name>, C<source>, and C<pos> attributes
from C<PCT::Node>.  The C<name> attribute is the node's name, if
any, while C<source> and C<pos> are used to identify the location
in the original source code for the node.  The C<source> and C<pos>
values are generally set by the C<node> method inherited from
C<PCT::Node>.

Other node attributes are generally defined by subclasses of C<PAST::Node>.

=over 4

=item returns([value])

Accessor method -- sets/returns the return type for the invocant.

=cut

.sub 'returns' :method
    .param pmc value           :optional
    .param int has_value       :opt_flag
    .return self.'attr'('returns', value, has_value)
.end<commit_msg>[pct]: * Add an 'arity' attribute to PAST nodes, to indicate the expected   number of arguments.<commit_after>=head1 NAME

PAST - Parrot abstract syntax tree

=head1 DESCRIPTION

This file implements the various abstract syntax tree nodes
for compiling programs in Parrot.

=cut

.namespace [ 'PAST::Node' ]

.sub 'onload' :anon :load :init
    ##   create the PAST::Node base class
    .local pmc protomaker, base
    protomaker = get_hll_global 'Protomaker'
    base = protomaker.'new_subclass'('PCT::Node', 'PAST::Node')

    $P0 = protomaker.'new_subclass'(base, 'PAST::Op')
    $P0 = protomaker.'new_subclass'(base, 'PAST::Stmts')
    $P0 = protomaker.'new_subclass'(base, 'PAST::Val')
    $P0 = protomaker.'new_subclass'(base, 'PAST::Var')
    $P0 = protomaker.'new_subclass'(base, 'PAST::Block')
    $P0 = protomaker.'new_subclass'(base, 'PAST::VarList')

    .return ()
.end

=head1 PAST Node types

=head2 PAST::Node

C<PAST::Node> is the base class for all PAST nodes, and is
derived from PCT::Node.  A node has an array component to
hold its children, and a hash component for its attributes.
However, we tend to use accessor methods for accessing the node's
attributes instead of accessing the hash directly.

Every PAST node inherits C<name>, C<source>, and C<pos> attributes
from C<PCT::Node>.  The C<name> attribute is the node's name, if
any, while C<source> and C<pos> are used to identify the location
in the original source code for the node.  The C<source> and C<pos>
values are generally set by the C<node> method inherited from
C<PCT::Node>.

Other node attributes are generally defined by subclasses of C<PAST::Node>.

=over 4

=item returns([value])

Accessor method -- sets/returns the return type for the invocant.

=cut

.sub 'returns' :method
    .param pmc value           :optional
    .param int has_value       :opt_flag
    .return self.'attr'('returns', value, has_value)
.end


=item arity([value])

Accessor method -- sets/returns the arity (number of expected arguments)
for the node.

=cut

.sub 'arity' :method
    .param pmc value           :optional
    .param int has_value       :opt_flag
    .return self.'attr'('arity', value, has_value)
.end
{'fraction_non_alphanumeric': 0.11285500747384156, 'fraction_numerical': 0.005480817140009965, 'mean_word_length': 4.01875, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '4602491', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1297, 'n_words': 472}