IR Nodes

Pages

IR Type Nodes Used to express the types of the Volt Language.
IR Context Classes These non-nodes handle the symbol space of nodes. These provide 'mechanism' over 'policy'; how look ups are performed, where they're performed. Parameter shadowing parent Scopes is allowed by these, that error has to come from another layer. The main restriction provided by these classes is that you can't have multiple Stores associated with the same name in a single Scope.
IR TopLevel Nodes Top level nodes are Nodes relating to the the module system. They either are part of the machinery that it works with (modules, imports) or define types and friends that work with the module system (structs, classes), or simply things that can only live in top level contexts (e.g. unittest blocks).
IR Statement Nodes Statements make things happen. They control the flow of execution, and can control lookup of symbols in certain scopes. This is in contrast to expressions, which compute values...and sometimes control flow. But the latter is mostly the domain of statements, and allows Volt to be a Turing complete language. Which is sometimes useful, we're told.
IR Expression Nodes Expressions compute a value based on an operation and one or more values. Exp Nodes represent this. There are a lot of expressions with wide ranging effects.
IR Declaration Nodes Declarations associate names with types.

Classes

Node Base class for all IR nodes.
QualifiedName A series of identifiers and dots referring to a declared item.
Identifier A single string that could be a part of an ir.QualifiedName or stand-alone node inside of the ir, referencing a declared item.
Type Base class for all types.
PrimitiveType PrimitiveTypes are types that are entirely well known to the compiler ahead of time. Consisting mostly of integral types, the only abstract one is Void, which indicates no type or (in the case of arrays and pointers) any type.
TypeReference A TypeReference is generated for user defined types, and a pass fills in the information so it can act as a cache, and not require multiple lookups.
PointerType A pointer is an abstraction of an address. You can dereference a pointer (get the thing it's pointing to), perform pointer arithmetic (move to the next possible address that could contain the same type), or reseat a pointer (change what it points to). You can also slice a pointer to get an array.
NullType The NullType represents the Type of a null.
ArrayType An ArrayType represents a slice of memory. It contains a pointer, that contains elements of the base type, and a length, which says how many elements this slice shows. This is lowered into a struct before the backend gets it.
AmbiguousArrayType A type that is either an AAType or a StaticArrayType, but we cannot tell which yet.
StaticArrayType A StaticArray is a list of elements of type base with a statically (known at compile time) number of elements. Unlike C, these are passed by value to functions.
AAType An AAType is an associative array -- it associates keys with values.
FunctionType A FunctionType represents the form of a function, and defines how it is called. It has a return type and a number of parameters.
DelegateType A DelegateType is a function pointer with an additional context pointer.
StorageType A StorageType changes how a Type behaves.
AutoType For representing inferred types. auto a = 3; const b = 2;
AliasStaticIf A special kind of type that allows an alias to have multiple configurations.
Store A container class for a various things that can be stored in a Scope.
Scope A single scope containing declared items and their identifiers.
Module The toplevelest node.
Import An Import adds a module to the search path of identifiers inside the module it's in.
Attribute Attributes apply different behaviours and access levels to one or more top level nodes. These are lowered onto the object by the attribremoval pass.
Named Named is a base class for named types, like Enum, Struct, Class and so on. This is slightly different from Aggregate since Enum is not a Aggregate, but is a named type.
Aggregate Aggregate is a base class for Struct, Union & Class.
Class Java style class declaration. Classes enable polymorphism, and are always accessed through opaque references (to prevent slicing -- look it up!)
_Interface Java style interface declaration. An interface defines multiple functions that an implementing class must define. A class can inherit from multiple interfaces, and can be treated as an instance of any one of them.
Union C style union. Structs are a POD data type, and should be binary compatible with the same union as defined by your friendly neighbourhood C compiler.
Struct C style struct. Structs are a POD data type, and should be binary compatible with the same struct as defined by your friendly neighbourhood C compiler.
Enum C style Enum. Enums create symbols that are associated with compile time constants. By default, they are enumerated with ascending numbers, hence the name.
Unittest Unittest code to be run on if selected by user.
Condition Node represention a compile time conditional compilation.
ConditionTopLevel Node represention a compile time conditional compilation, at the toplevel. Uses Condition to specify the if it should be compiled.
MixinFunction Node represention of a function mixin.
MixinTemplate Node represention of a template mixin.
Statement Base class for all statements.
BlockStatement A block statement is a group of zero or more statements. Why these exist depends on where they live.
ReturnStatement The return statement returns execution to the caller of the current function, and optionally returns a value.
AsmStatement The asm statement contains inline assembly. It's a list of tokens so different backends can parse it however they want. It all still has to lex as valid Volt, of course.
AssertStatement The assert statement aborts if condition is flase, optionally displaying message. isStatic determines whether condition is checked at compile time or not.
IfStatement If exp is true, execution flows to thenState. If exp is false, execution flows to elseState, if it exists, otherwise it skips to the end of the if statement.
WhileStatement The while statement keeps executing the statements in block, as long as condition evaluates in true.
DoStatement Like a while statement, executes block while condition is true. Unlike the while statement, at least one execution of block is guaranteed.
ForStatement The for statement is a while statement that evaluates init first (optionally introducing Variables into the for's scope), and running increment at the end of each block's execution. Other than that, it keeps executing block while test evaluates to true.
ForeachStatement The foreach statement loops over elements in an aggregate. Arrays and AAs have builtin support, but users can define iteration solutions for their own types too.
LabelStatement A label statement associates a string with a position in the statement stream. Goto can then be used to jump to that position and anger Dijkstra.
ExpStatement An ExpStatement wraps an Expression in a Statement.
SwitchStatement A switch statement jumps to various case labels depending on the value of its condition.
ContinueStatement The continue statement restarts a loop (while, dowhile, for, foreach).
BreakStatement The break statement halts execution of a loop or a switch statement.
GotoStatement The goto statement jumps to a label, or controls flow inside a switch statement.
WithStatement All lookups inside of a WithStatement first check exp before performing a regular lookup. Ambiguities are still errors.
SynchronizedStatement A synchronized statement ensures that only one thread of execution can enter its block. An explicit mutex may be provided.
TryStatement The try statement allows the resolution of throw statements, by rerouting thrown exceptions into various catch blocks.
ThrowStatement A throw statements halts the current functions execution and unwinds the stack until it hits a try statement with an appropriate catch statement or, failing that, it halts execution of the entire program.
ScopeStatement ScopeStatements are executed on various conditions. Exits are always executed when the given scope is left. Successes are executed when the scope is left normally. Failures are executed when the scope is left by way of an Exception.
PragmaStatement Pragma statements do magical things. pragma(lib, "SDL"), for instance, tells the compiler to link with SDL without the user having to specify it on the command line. What pragmas are supported vary from compiler to compiler, the only thing specified is that complying implementations must die on unknown pragmas by default.
ConditionStatement A ConditionStatement provides for conditional compilation of statements. If condition is true, then it is as if block was where the ConditionStatement was. Otherwise, the _else block replaces it (if present).
MixinStatement The mixin statement mixes in a mixin function, mixin template or a string.
Exp Base class for all expressions.
LiteralExp Base class for literal expressions.
Ternary A ternary expression is a shorthand if statement in the form of an expression.
BinOp A BinOp is an operation the operates on two expressions with a given operation.
Unary A Unary operation is prepended to the back of an expression.
Postfix A postfix operation is appended to an expression.
PropertyExp A looked up postfix operation is appended to an expression.
Constant A Constant is a literal value of a given type.
ArrayLiteral Represents an array literal. Contains a list of expressions with (if semantically sound) a common type.
AssocArray Represents an associative array literal -- a list of key/value pairs.
IdentifierExp Represents a single identifier. Replaced with ExpReference in a pass.
Assert An Assert checks that a condition is true, and dies with an optional message if not.
StringImport A StringImport creates a string literal from a file on disk at compile time.
Typeid The typeid expression returns the typeinfo of a given type or expression.
IsExp The is expression is a bit of a swiss army knife. It can be simply used to determine whether a given type is well-formed, or if a given type is a certain other type, or can be converted into another type.
FunctionLiteral A function literal can define a normal function, or a delegate (a function with context). There are multiple ways to define these but the long hand way is int function(int a, int b) { return a + b; } Defines a function that takes two integers and returns them added up. int delegate(int a, int b) { return a + b + c; } Is the same, except it has access to the outer scope's variables.
ExpReference An ExpReference replaces chained postfix look ups with the result of the lookup. A cache that is inserted later, in other words.
TypeExp A TypeExp is used when a primitive type is used in an expression. This is currently limited to .max/min and (void*).max/min.
StoreExp A StoreExp is used when a NamedType is used in an expression within a WithStatement, like so: with (Class.Enum) { int val = DeclInEnum; }.
StatementExp A StatementExp is a internal expression for inserting statements into a expression. Note that this is not a function and executes the statements just as if they where inserted in the BlockStatement that the StatementExp is in. Meaning any ReturnStatement will return the current function not this StatementExp.
TokenExp Expression that corresponds to what was once special tokens. FUNCTION, PRETTY_FUNCTION, FILE, and __LINE.
VaArgExp Expression that assists in working with varargs.
AccessExp An expression that represents a simple identifier.identifier lookup.
RunExp An expression that forces the compiler to evaluate another expression at compile time.
ComposableString A string that contains expressions to be formatted inline.
Declaration Base class for all declarations.
Variable Represents an instance of a type.
Alias An Alias associates names with a Type. Once declared, using that name is as using that Type directly.
Function A function is a block of code that takes parameters, and may return a value. There may be additional implied context, depending on where it's defined.
FunctionSet Represents multiple functions associated with a single name.
FunctionParam Represents a parameter to a function.
TemplateInstance Creates a concrete instance of a template.

Enums

NodeType Each concrete class derived from ir.Node has a value in this enumeration. The value for the type is stored in ir.Node.nodeType by the constructor. While using type tags is not very OOP, it is extremely convenient. For example, during debugging you can simply inspect ir.Node.nodeType to find out the actual type of the object.
Access Common access levels used on declared functions, methods, classes, interfaces, structs, enums and variables.
Linkage Controls the calling convention and how symbols are mangled.
ScopeKind Used by ScopeStatement and other nodes.