Re-exports
pub use semantic_analysis::TypedDeclaration;
pub use crate::parse_tree::Declaration;
pub use crate::parse_tree::*;
pub use error::CompileError;
pub use error::CompileResult;
pub use error::CompileWarning;
Modules
Configurable yet nonchanging constants for the compiler.
Tools related to handling/recovering from Sway compile errors and reporting them to the user.
Contains all the code related to parsing Sway source code.
Type checking for Sway.
Contains post-type-engine resolved types.
Structs
An AbstractInstructionSet is a set of instructions that use entirely virtual registers and excessive moves, with the intention of later optimizing it.
Configuration for the overall build and compilation process.
A namespace represents all items that exist either via declaration or importing.
Represents some exportable information that results from compiling some Sway source code.
Represents a parsed, but not yet type-checked, Sway program. A Sway program can be either a contract, script, predicate, or it can be a library to be imported into one of the aforementioned program types.
A UseStatement is a statement that imports something from a module into the local namespace.
A parsed while loop. Contains the condition
, which is defined from an Expression, and the body
from a CodeBlock.
Enums
Represents the various structures that constitute a Sway program.
Represents the result of compiling Sway code via compile_to_bytecode. Contains the compiled bytecode in byte form, or resulting errors, and any warnings generated.
Represents the result of compiling Sway code via compile_to_asm. Contains the compiled assets or resulting errors, and any warnings generated.
Represents a parsed, but not yet type checked, Expression.
Represents an ASM set which has had register allocation, jump elimination, and optimization applied to it
The SwayAsmSet contains either a contract ABI and corresponding ASM, a script’s main function’s ASM, or a predicate’s main function’s ASM. ASM is never generated for libraries, as that happens when the library itself is imported.
Represents the different variants of the AST.
Type information without an associated value, used for type inferencing and definition.
Traits
Functions
Given input Sway source code, compile to a CompilationResult which contains the asm in opcode form (not raw bytes/bytecode).
Given input Sway source code, compile to a BytecodeCompilationResult which contains the asm in bytecode form.
Create a new module (Namespace), insert it into the arena, and get its id back.
If a given Rule exists in the input text, return
that string trimmed. Otherwise, return None
. This is typically used to find keywords.
Given an input Arc<str>
and an optional BuildConfig, parse the input into a SwayParseTree.
Given a NamespaceRef, get a clone of the actual Namespace it refers to.