Nodes

This file declares the different node-types that occur in the parse tree. These types may be generated from the parser output (see Tree.pm), or by the compiler itself during a pass.

sv_literal

Represents a scalar literal value.

type

The literal's type, either one of the scalar types, PerlHash for an anonymous hash reference, or PerlArray for an anonymous array reference.

lval

The thing's value. This is not the same as the code-generating val method. For scalar types, lval is a string; for reference types, a reference to the contents' parse tree.

variable

A variable.

type

Either one of the scalar types, PerlHash, or PerlArray.

global

True if the variable is global (currently unimplemented).

implicit

True for implicit block parameters, e.g. $^a.

topical

True for members of the current topic, e.g. $.foo.

name

The variable's name. For simple variables, this is the literal name, including sigil (e.g. $foo). For "complicated" variables, this is a reference to their parse tree (currently unimplemented).

Binop

A node type representing a binary infix operation. Note that comparison operators are not binary, since they can be chained. Both comma and semicolon are binary.

op

For simple operators, the operator name as a string. For hyper operators, a reference to a hype node.

l, r

The left and right operands of the operator.

hype

A "hyped" operator. Its single member, op is the normal operator that has been lifted. If it turns out that other things besides operators can be hyped, op may refer to more complex nodes.

apply_rhs

The right-hand side of an apply operation (e.g. the "foo()" in "$a.foo()").

prop

The function- or property-name being accessed (e.g. "foo").

subscripts

A reference to a list of subscripts, or an empty array if none are present. Subscripts may be either an indices node, as for variable subscripts, or "something else" representing a parameter list. This is kind of ugly, and may change once these things actually get implemented.

indices

A single subscript, e.g. [@xs].

type

The type of thing on which the subscript operates, either PerlHash or PerlArray.

indices

The parse tree for the subscript contents.

subscript_exp

An item and one or more indices.

thing

The expression or variable to be subscripted.

subscripts

A reference to an array of indices.

incr

An increment or decrement operator.

post

True if the operator is a postincrement.

op

The operator.

thing

The incremented expression.

prefix

A prefix operator. Many things are prefix operators: filetests (possibly combined), declared functions, and unary -, ~, \\, and !.

name

The operator name.

args

The argument tree.

context

A single context operator.

ctx

The operator.

thing

The operand.

pair

A pair (e.g. a => "pair").

l, r

The left and right operands of the pair constructor.

compare

A comparison sequence. Its single member, seq, is a reference to a list of operators and operands in left-to-right order. For example, 1 lt 3 lt "three" becomes [1, "lt", 3, "lt", "three"]

ternary

A ternary operation.

if

The test.

then

The "true" branch.

else

The "false" branch.

scope_class

Qualifiers that occur before the variables in a declaration.

scope

The variable scope, e.g. "my", "our", "temp".

class

The variable class, e.g. "int".

decl

A declaration of one or more variables, not including initializers.

qual

The variables' scope/class.

vars

The variables' names.

props

A list of properties (e.g. "is foo(42)").

property

A single variable, class, or function property.

name

The property name.

args

The argument list (for e.g. something(1, 2)).

but

A node representing a "but" clause, e.g. $foo = 23 but false but Inf.

thing

The exceptional thing.

buts

A reference to an array of exception clauses.

adverb

An adverbial modifier (i.e. ':').

thing

The left-hand side of the colon.

adv

The right-hand side.

params

A sub parameter list (not argument list).

req

A reference to an array of required parameters, or an empty array if none.

opt

A reference to an array of optional parameters, i.e. those occuring after the ';', or an empty array if none.

rest

The name of the final "slurping" parameter, or undef if none present.

param

A subroutine parameter.

qual

Variable scope/class.

var

The variable.

props

Its properties.

init

An initializer expression, or undef if none.

initializer

A parameter initializer (not an initializer in a variable declaration).

op

The initializing operator, probably =.

expr

The initialization expression.

sub_def

A subroutine definition or declaration.

qual

Sub scope.

name
props

An array of subroutine properties, or an empty array if none.

closure

The closure associated with this name.

closure

A closure, which may be either an anonymous function or the parameters and body of a named subroutine.

params

The subroutine parameter list, or undef if no parameter list was given. The appropriate implicit parameter list then depends on context.

block

The sequence of statements making up the closure body. This is a reference to an array of statements, or a single yadda node for ... definitions, or undef for a declaration.

yadda

A node representing a ... statement. Its single member, msg, is either undef or an appropriate error message to be generated if the statement is reached.

guard

A guard (statement modifier?), e.g. the unless in die unless $foo.

name

The modifier name, either "if", "unless", "while", "until", or "for".

expr
test
directive

A "use", "package", or "module" directive

name

The directive name (e.g. "use").

thing

The directive's object (e.g. "perl" in "use perl").

args

Whatever else is on the directive line.

label

A statement label. It will appear before the labeled statement in a statement sequence.

loop

A loop(;;) { ... } statement.

init
test
incr

The initialization, test, and increment expressions in the loop header.

block

The block (sequence of statements, not closure) controlled by the loop.

class_def

A class definition

qual

Class scope.

name
props
block
P6C::ValueList

List operators and functions with named parameters currently receive their arguments in different formats -- the former as a tree of binary ',' ops, the latter as an array. This is a common class to do context handling for both.

P6C::Register

Gratuitous object? Not quite... It's a way of passing a temporary register in place of an unexpanded rvalue. Useful for e.g. autoincrement, where we have the register lying around.

NOTE: this would be a good place to take care of conversions between register types. Right now things are always passed in P regs, but we could do better by passing back a wrapped S, I, or N register, which would be promoted if necessary. On the other hand, we might do better using context to do this. Hopefully all will be clear once things get a bit more developed.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 11:

=over without closing =back

Around line 323:

Expected text after =item, not a bullet