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.
Tree.pm
Represents a scalar literal value.
The literal's type, either one of the scalar types, PerlHash for an anonymous hash reference, or PerlArray for an anonymous array reference.
PerlHash
PerlArray
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.
val
lval
A variable.
Either one of the scalar types, PerlHash, or PerlArray.
True if the variable is global (currently unimplemented).
True for implicit block parameters, e.g. $^a.
$^a
True for members of the current topic, e.g. $.foo.
$.foo
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).
$foo
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.
For simple operators, the operator name as a string. For hyper operators, a reference to a hype node.
hype
The left and right operands of the operator.
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.
op
The right-hand side of an apply operation (e.g. the "foo()" in "$a.foo()").
The function- or property-name being accessed (e.g. "foo").
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].
[@xs]
The type of thing on which the subscript operates, either PerlHash or PerlArray.
The parse tree for the subscript contents.
An item and one or more indices.
The expression or variable to be subscripted.
A reference to an array of indices.
An increment or decrement operator.
True if the operator is a postincrement.
The operator.
The incremented expression.
A prefix operator. Many things are prefix operators: filetests (possibly combined), declared functions, and unary -, ~, \\, and !.
-
~
\\
!
The operator name.
The argument tree.
A single context operator (eg the * in *@arr).
The operand.
A pair (e.g. a => "pair").
a => "pair"
The left and right operands of the pair constructor.
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"]
seq
1 lt 3 lt "three"
[1, "lt", 3, "lt", "three"]
A ternary operation.
The test.
The "true" branch.
The "false" branch.
Qualifiers that occur before the variables in a declaration.
The variable scope, e.g. "my", "our", "temp".
The variable class, e.g. "int".
A declaration of one or more variables, not including initializers.
The variables' scope/class.
The variables' names.
A list of properties (e.g. "is foo(42)").
A single variable, class, or function property.
The property name.
The argument list (for e.g. something(1, 2)).
something(1, 2)
A node representing a "but" clause, e.g. $foo = 23 but false but Inf.
$foo = 23 but false but Inf
The exceptional thing.
A reference to an array of exception clauses.
An adverbial modifier (i.e. ':').
The left-hand side of the colon.
The right-hand side.
A sub parameter list (not argument list).
A reference to an array of required positional parameters, or an empty array if none.
A reference to an array of optional positional parameters, i.e. those occurring after the ';', or an empty array if none.
A reference to an array of required named parameters.
The final "slurping" parameter, or undef if none present.
undef
The "slurping" parameter for named arguments, or undef if none present.
A reference to an array of optional named parameters.
A subroutine parameter.
The type of the parameter.
Which zone the parameter is in -- positional, optional, named, etc.
The variable.
Its traits.
An initializer expression, or undef if none.
Private variable: 'no_named' means that named arguments are not used. For the caller, this means that the extra hash containing named arguments is not passed. For the callee, this means that the extra hash is not expected, and therefore is not read off of the passed-in arguments. Both of these had better agree!
A parameter initializer (not an initializer in a variable declaration).
The initializing operator, probably =.
=
The initialization expression.
A subroutine definition or declaration. This is created for all of: method X ... sub X ... rule X ...
The sub_def contains only the name and properties; the signature and body are stored in a P6C::closure object.
Sub scope. (my/our/...)
An array of subroutine properties, or an empty array if none.
The closure associated with this name.
A closure, which may be either an anonymous function or the parameters and body of a named subroutine -- or merely a bare block.
The subroutine parameter list, or undef if no parameter list was given. The appropriate implicit parameter list then depends on context.
The subroutine's return type.
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
...
True only for bare blocks, eg $x = { print "hi!" } or just { print "hi!" }
Appears to be used only to determine that a particular block is an anonymous subroutine (Addcontext.pm's is_anon_sub() says that it is an anonymous subroutine unless it is marked noreturn, or it is a sub_def, or it's both a bare block and in a "last statement" context. Urk?)
A boolean flag saying whether the closure is a rule (as opposed to a sub).
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.
msg
A guard (statement modifier?), e.g. the unless in die unless $foo.
unless
die unless $foo
The modifier name, either "if", "unless", "while", "until", or "for".
A "use", "package", or "module" directive
The directive name (e.g. "use").
The directive's object (e.g. "perl" in "use perl").
Whatever else is on the directive line.
A statement label. It will appear before the labeled statement in a statement sequence.
A loop(;;) { ... } statement.
loop(;;) { ... }
The initialization, test, and increment expressions in the loop header.
The block (sequence of statements, not closure) controlled by the loop.
The string name of the label.
A class definition
Class scope.
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.
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.
To install Ruby, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ruby
CPAN shell
perl -MCPAN -e shell install Ruby
For more information on module installation, please visit the detailed CPAN module installation guide.