![]() |
ArkScript
A small, lisp-inspired, functional scripting language
|
The ArkScript AST to IR compiler. More...
#include <ASTLowerer.hpp>
Classes | |
| struct | Page |
Public Member Functions | |
| ASTLowerer (unsigned debug) | |
| Construct a new ASTLowerer object. | |
| void | addToTables (const std::vector< std::string > &symbols, const std::vector< ValTableElem > &constants) |
| Pre-fill tables (used by the debugger) | |
| void | offsetPagesBy (std::size_t offset) |
| Start bytecode pages at a given offset (by default, 0) | |
| void | process (Node &ast) |
| Start the compilation. | |
| const std::vector< IR::Block > & | intermediateRepresentation () const noexcept |
| Return the IR blocks (one per scope) | |
| const std::vector< std::string > & | symbols () const noexcept |
| Return the symbol table pre-computed. | |
| const std::vector< ValTableElem > & | values () const noexcept |
| Return the value table pre-computed. | |
Public Member Functions inherited from Ark::internal::Pass | |
| Pass (std::string name, unsigned debug_level) | |
| Construct a new Pass object. | |
| virtual | ~Pass ()=default |
| void | configureLogger (std::ostream &os) |
| Set a custom output stream for the logger. | |
Private Types | |
| enum class | ErrorKind { InvalidNodeMacro , InvalidNodeNoReturnValue , InvalidNodeInOperatorNoReturnValue , InvalidNodeInTailCallNoReturnValue } |
Private Member Functions | |
| Page | createNewCodePage (const bool temp=false) noexcept |
| IR::Block & | page (const Page page) noexcept |
| helper functions to get a temp or finalized code page | |
| bool | isFunctionCallingItself (const std::string &name) noexcept |
| Check if we are in a recursive self call. | |
| void | warning (const std::string &message, const Node &node) |
| Display a warning message. | |
| void | compileExpression (Node &x, Page p, bool is_result_unused, bool is_terminal) |
| Compile an expression (a node) recursively. | |
| void | compileSymbol (const Node &x, Page p, bool is_result_unused, bool can_use_ref) |
| void | compileListInstruction (Node &x, Page p, bool is_result_unused) |
| void | compileApplyInstruction (Node &x, Page p, bool is_result_unused) |
| void | compileIf (Node &x, Page p, bool is_result_unused, bool is_terminal) |
| void | compileFunction (Node &x, Page p, bool is_result_unused) |
| void | compileLetMutSet (Keyword n, Node &x, Page p, bool is_result_unused) |
| void | compileWhile (Node &x, Page p) |
| void | compilePluginImport (const Node &x, Page p) |
| void | pushFunctionCallArguments (Node &call, Page p, bool is_tail_call) |
| void | handleCalls (Node &x, Page p, bool is_result_unused, bool is_terminal) |
| void | handleShortcircuit (Node &x, Page p) |
| void | handleOperator (Node &x, Page p, Instruction op) |
| bool | handleFunctionCall (Node &x, Page p, bool is_terminal) |
| uint16_t | addSymbol (const Node &sym) |
| Register a given node in the symbol table. | |
| uint16_t | addValue (const Node &x) |
| Register a given node in the value table. | |
| uint16_t | addValue (std::size_t page_id, const Node ¤t) |
| Register a page id (function reference) in the value table. | |
Static Private Member Functions | |
| static std::optional< Instruction > | getOperator (const std::string &name) noexcept |
| Checking if a symbol is an operator. | |
| static std::optional< uint16_t > | getBuiltin (const std::string &name) noexcept |
| Checking if a symbol is a builtin. | |
| static std::optional< Instruction > | getListInstruction (const std::string &name) noexcept |
| Checking if a symbol is a list instruction. | |
| static bool | isBreakpoint (const Node &node) |
| static bool | nodeProducesOutput (const Node &node) |
| static bool | isUnaryInst (Instruction inst) noexcept |
| Check if a given instruction is unary (takes only one argument) | |
| static bool | isTernaryInst (Instruction inst) noexcept |
| Check if a given instruction is ternary (takes three arguments) | |
| static bool | isRepeatableOperation (Instruction inst) noexcept |
| Check if an operator can be repeated. | |
| static void | buildAndThrowError (const std::string &message, const Node &node) |
| Throw a nice error message. | |
| static void | makeError (ErrorKind kind, const Node &node, const std::string &additional_ctx) |
| Throw a nice error message, using a message builder. | |
Private Attributes | |
| LocalsLocator | m_locals_locator |
| std::vector< std::string > | m_symbols |
| std::vector< ValTableElem > | m_values |
| std::size_t | m_start_page_at_offset = 0 |
| Used to offset the page numbers when compiling code in the debugger. | |
| std::vector< IR::Block > | m_code_pages |
| std::vector< IR::Block > | m_temp_pages |
| we need temporary code pages for some compilations passes | |
| IR::label_t | m_current_label = 0 |
| std::stack< std::string > | m_opened_vars |
| stack of vars we are currently declaring | |
Additional Inherited Members | |
Protected Attributes inherited from Ark::internal::Pass | |
| Logger | m_logger |
The ArkScript AST to IR compiler.
Definition at line 41 of file ASTLowerer.hpp.
|
strongprivate |
| Enumerator | |
|---|---|
| InvalidNodeMacro | |
| InvalidNodeNoReturnValue | |
| InvalidNodeInOperatorNoReturnValue | |
| InvalidNodeInTailCallNoReturnValue | |
Definition at line 112 of file ASTLowerer.hpp.
|
explicit |
Construct a new ASTLowerer object.
| debug | the debug level |
Definition at line 27 of file ASTLowerer.cpp.
|
private |
Register a given node in the symbol table.
Can throw if the table is full
| sym |
Definition at line 938 of file ASTLowerer.cpp.
References buildAndThrowError(), m_symbols, Ark::MaxValue16Bits, and Ark::internal::Node::string().
Referenced by compileExpression(), compileFunction(), compileLetMutSet(), compileSymbol(), and handleFunctionCall().
| void Ark::internal::ASTLowerer::addToTables | ( | const std::vector< std::string > & | symbols, |
| const std::vector< ValTableElem > & | constants ) |
Pre-fill tables (used by the debugger)
| symbols | |
| constants |
Definition at line 31 of file ASTLowerer.cpp.
References m_symbols, m_values, and symbols().
Referenced by Ark::Welder::generateBytecodeUsingTables().
|
private |
Register a given node in the value table.
Can throw if the table is full
| x |
Definition at line 954 of file ASTLowerer.cpp.
References buildAndThrowError(), m_values, and Ark::MaxValue16Bits.
Referenced by compileExpression(), compileFunction(), and compilePluginImport().
|
private |
Register a page id (function reference) in the value table.
Can throw if the table is full
| page_id | |
| current | A reference to the current node, for context |
Definition at line 970 of file ASTLowerer.cpp.
References buildAndThrowError(), m_values, and Ark::MaxValue16Bits.
|
staticprivate |
Throw a nice error message.
| message | |
| node |
Definition at line 181 of file ASTLowerer.cpp.
References Ark::internal::Node::filename(), and Ark::internal::Node::position().
Referenced by addSymbol(), addValue(), addValue(), compileApplyInstruction(), compileExpression(), compileFunction(), compileIf(), compileLetMutSet(), compileListInstruction(), compileSymbol(), handleFunctionCall(), handleOperator(), handleShortcircuit(), and makeError().
|
private |
Definition at line 427 of file ASTLowerer.cpp.
References Ark::internal::APPLY, buildAndThrowError(), compileExpression(), Ark::internal::Node::constList(), Ark::internal::IR::Entity::Goto(), InvalidNodeNoReturnValue, Ark::internal::IR::Entity::Label(), Ark::internal::Node::list(), m_current_label, makeError(), nodeProducesOutput(), page(), Ark::internal::POP, and Ark::internal::PUSH_RETURN_ADDRESS.
Referenced by compileExpression().
|
private |
Compile an expression (a node) recursively.
| x | the Node to compile |
| p | the current page number we're on |
| is_result_unused | |
| is_terminal |
Definition at line 210 of file ASTLowerer.cpp.
References addSymbol(), addValue(), Ark::internal::Language::Apply, Ark::internal::Namespace::ast, Ark::internal::Begin, buildAndThrowError(), Ark::internal::BUILTIN, compileApplyInstruction(), compileExpression(), compileFunction(), compileIf(), compileLetMutSet(), compileListInstruction(), compilePluginImport(), compileSymbol(), compileWhile(), Ark::internal::Node::constArkNamespace(), Ark::internal::Node::constList(), Ark::internal::DEL, Ark::internal::Del, Ark::internal::Field, Ark::internal::Node::filename(), Ark::internal::Fun, Ark::internal::GET_FIELD, getBuiltin(), getListInstruction(), handleCalls(), Ark::internal::If, Ark::internal::Import, Ark::internal::Keyword, Ark::internal::Let, Ark::internal::FilePos::line, Ark::internal::List, Ark::internal::Node::list(), Ark::internal::LOAD_CONST, Ark::internal::Mut, Ark::internal::Namespace, Ark::internal::Node::nodeType(), Ark::internal::Number, page(), Ark::internal::Node::position(), Ark::internal::Set, Ark::internal::FileSpan::start, Ark::internal::String, Ark::Value::string(), Ark::internal::Symbol, Ark::internal::typeToString(), Ark::internal::Unused, and Ark::internal::While.
Referenced by compileApplyInstruction(), compileExpression(), compileFunction(), compileIf(), compileLetMutSet(), compileListInstruction(), compileWhile(), handleFunctionCall(), handleOperator(), handleShortcircuit(), process(), and pushFunctionCallArguments().
Definition at line 492 of file ASTLowerer.cpp.
References Ark::internal::LocalsLocator::addLocal(), addSymbol(), addValue(), buildAndThrowError(), Ark::internal::CAPTURE, Ark::internal::Capture, Ark::internal::LocalsLocator::Closure, compileExpression(), Ark::internal::Node::constList(), createNewCodePage(), Ark::internal::LocalsLocator::createScope(), Ark::internal::LocalsLocator::deleteScope(), Ark::internal::LocalsLocator::Function, InvalidNodeMacro, Ark::internal::Node::isAnonymousFunction(), Ark::internal::List, Ark::internal::Node::list(), Ark::internal::LOAD_CONST, m_locals_locator, m_opened_vars, Ark::internal::MAKE_CLOSURE, makeError(), Ark::internal::MutArg, page(), Ark::internal::POP, Ark::internal::RefArg, Ark::internal::RENAME_NEXT_CAPTURE, Ark::internal::RET, Ark::internal::STORE, Ark::internal::STORE_REF, Ark::internal::Symbol, Ark::internal::typeToString(), and warning().
Referenced by compileExpression().
|
private |
Definition at line 453 of file ASTLowerer.cpp.
References buildAndThrowError(), compileExpression(), Ark::internal::Node::constList(), Ark::internal::LocalsLocator::dropVarsForBranch(), Ark::internal::IR::Entity::Goto(), Ark::internal::IR::Entity::GotoIf(), Ark::internal::IR::Entity::Label(), Ark::internal::Node::list(), m_current_label, m_locals_locator, page(), and Ark::internal::LocalsLocator::saveScopeLengthForBranch().
Referenced by compileExpression().
|
private |
Definition at line 572 of file ASTLowerer.cpp.
References Ark::internal::LocalsLocator::addLocal(), addSymbol(), buildAndThrowError(), compileExpression(), Ark::internal::Node::constList(), Ark::internal::Node::filename(), InvalidNodeMacro, Ark::internal::Let, Ark::internal::FilePos::line, Ark::internal::Node::list(), Ark::internal::LOAD_SYMBOL, m_locals_locator, m_opened_vars, makeError(), Ark::internal::Mut, page(), Ark::internal::Node::position(), Ark::internal::SET_VAL, Ark::internal::FileSpan::start, Ark::internal::STORE, Ark::internal::Symbol, and Ark::internal::typeToString().
Referenced by compileExpression().
|
private |
Definition at line 348 of file ASTLowerer.cpp.
References Ark::internal::APPEND, Ark::internal::APPEND_IN_PLACE, buildAndThrowError(), compileExpression(), Ark::internal::CONCAT, Ark::internal::CONCAT_IN_PLACE, Ark::internal::Node::constList(), getListInstruction(), InvalidNodeNoReturnValue, Ark::internal::LIST, Ark::internal::Node::list(), makeError(), Ark::MaxValue16Bits, nodeProducesOutput(), page(), Ark::internal::POP, Ark::internal::POP_LIST, Ark::internal::POP_LIST_IN_PLACE, Ark::internal::SET_AT_2_INDEX, Ark::internal::SET_AT_INDEX, Ark::Value::string(), and warning().
Referenced by compileExpression().
Definition at line 645 of file ASTLowerer.cpp.
References addValue(), Ark::internal::Node::constList(), Ark::internal::Node::filename(), Ark::internal::FilePos::line, page(), Ark::internal::PLUGIN, Ark::internal::Node::position(), Ark::internal::FileSpan::start, and Ark::internal::String.
Referenced by compileExpression().
|
private |
Definition at line 316 of file ASTLowerer.cpp.
References addSymbol(), buildAndThrowError(), Ark::internal::BUILTIN, Ark::internal::Node::filename(), getBuiltin(), getOperator(), Ark::internal::FilePos::line, Ark::internal::LOAD_FAST, Ark::internal::LOAD_FAST_BY_INDEX, Ark::internal::LOAD_SYMBOL, Ark::internal::LocalsLocator::lookupLastScopeByName(), m_locals_locator, page(), Ark::internal::POP, Ark::internal::Node::position(), Ark::internal::FileSpan::start, Ark::internal::Node::string(), and warning().
Referenced by compileExpression(), and pushFunctionCallArguments().
Definition at line 612 of file ASTLowerer.cpp.
References compileExpression(), Ark::internal::Node::constList(), Ark::internal::CREATE_SCOPE, Ark::internal::LocalsLocator::createScope(), Ark::internal::LocalsLocator::deleteScope(), Ark::internal::Node::filename(), Ark::internal::IR::Entity::Goto(), Ark::internal::IR::Entity::GotoIf(), InvalidNodeMacro, Ark::internal::IR::Entity::Label(), Ark::internal::FilePos::line, Ark::internal::Node::list(), m_current_label, m_locals_locator, makeError(), page(), Ark::internal::POP_SCOPE, Ark::internal::Node::position(), Ark::internal::RESET_SCOPE_JUMP, and Ark::internal::FileSpan::start.
Referenced by compileExpression().
|
inlineprivatenoexcept |
Definition at line 120 of file ASTLowerer.hpp.
Referenced by compileFunction(), handleFunctionCall(), and process().
|
staticprivatenoexcept |
Checking if a symbol is a builtin.
| name | symbol name |
Definition at line 79 of file ASTLowerer.cpp.
References Ark::internal::Builtins::builtins.
Referenced by compileExpression(), and compileSymbol().
|
staticprivatenoexcept |
Checking if a symbol is a list instruction.
| name |
Definition at line 90 of file ASTLowerer.cpp.
References Ark::internal::LIST, and Ark::internal::Language::listInstructions.
Referenced by compileExpression(), and compileListInstruction().
|
staticprivatenoexcept |
Checking if a symbol is an operator.
| name | symbol name |
Definition at line 71 of file ASTLowerer.cpp.
References Ark::internal::FIRST_OPERATOR, and Ark::internal::Language::operators.
Referenced by compileSymbol(), and handleCalls().
|
private |
Definition at line 683 of file ASTLowerer.cpp.
References Ark::internal::Language::And, Ark::internal::BREAKPOINT, Ark::internal::Node::constList(), getOperator(), handleFunctionCall(), handleOperator(), handleShortcircuit(), Ark::internal::Node::nodeType(), Ark::internal::Language::Or, page(), Ark::internal::POP, Ark::internal::Node::string(), and Ark::internal::Symbol.
Referenced by compileExpression().
Definition at line 813 of file ASTLowerer.cpp.
References addSymbol(), buildAndThrowError(), Ark::internal::BUILTIN, Ark::internal::Builtin, Ark::internal::Builtins::builtins, Ark::internal::CALL, Ark::internal::CALL_BUILTIN, Ark::internal::CALL_CURRENT_PAGE, Ark::internal::CALL_SYMBOL, Ark::internal::CALL_SYMBOL_BY_INDEX, Ark::internal::Capture, Ark::internal::Classic, compileExpression(), Ark::internal::Node::constList(), createNewCodePage(), Ark::internal::Node::filename(), Ark::internal::GET_FIELD, Ark::internal::GET_FIELD_AS_CLOSURE, Ark::internal::IR::Entity::Goto(), isBreakpoint(), isFunctionCallingItself(), Ark::internal::IR::Entity::Label(), Ark::internal::FilePos::line, Ark::internal::Node::list(), Ark::internal::LOAD_FAST, Ark::internal::LOAD_FAST_BY_INDEX, m_current_label, m_temp_pages, nodeProducesOutput(), Ark::internal::Node::nodeType(), page(), Ark::internal::Node::position(), Ark::internal::PUSH_RETURN_ADDRESS, pushFunctionCallArguments(), Ark::internal::Node::repr(), Ark::internal::SelfNotRecursive, Ark::internal::FileSpan::start, Ark::internal::Node::string(), Ark::internal::Symbol, Ark::internal::SymbolByIndex, and Ark::internal::TAIL_CALL_SELF.
Referenced by handleCalls().
|
private |
Definition at line 759 of file ASTLowerer.cpp.
References buildAndThrowError(), compileExpression(), Ark::internal::Node::constList(), Ark::internal::Node::filename(), Ark::internal::FIRST_OPERATOR, InvalidNodeInOperatorNoReturnValue, isBreakpoint(), isRepeatableOperation(), isTernaryInst(), isUnaryInst(), Ark::internal::FilePos::line, Ark::internal::Node::list(), makeError(), nodeProducesOutput(), Ark::internal::Language::operators, page(), Ark::internal::Node::position(), Ark::internal::Node::repr(), and Ark::internal::FileSpan::start.
Referenced by handleCalls().
Definition at line 716 of file ASTLowerer.cpp.
References Ark::internal::Language::And, buildAndThrowError(), compileExpression(), Ark::internal::Node::constList(), Ark::internal::IR::Entity::Goto(), Ark::internal::IR::Entity::Label(), Ark::internal::Node::list(), m_current_label, nodeProducesOutput(), page(), Ark::internal::SHORTCIRCUIT_AND, Ark::internal::SHORTCIRCUIT_OR, and Ark::internal::Node::string().
Referenced by handleCalls().
|
nodiscardnoexcept |
Return the IR blocks (one per scope)
Definition at line 56 of file ASTLowerer.cpp.
References m_code_pages.
Referenced by Ark::Welder::generateBytecode().
|
staticprivate |
Checks if a node is a list and is a call to 'breakpoint'
| node | node to check |
Definition at line 98 of file ASTLowerer.cpp.
References Ark::internal::Node::constList(), Ark::internal::List, Ark::internal::Node::nodeType(), and Ark::internal::Symbol.
Referenced by handleFunctionCall(), handleOperator(), and pushFunctionCallArguments().
|
inlinenodiscardprivatenoexcept |
Check if we are in a recursive self call.
| name | symbol name being compiled |
Definition at line 151 of file ASTLowerer.hpp.
Referenced by handleFunctionCall().
|
staticprivatenoexcept |
Check if an operator can be repeated.
| inst |
Definition at line 161 of file ASTLowerer.cpp.
References Ark::internal::ADD, Ark::internal::DIV, Ark::internal::MUL, and Ark::internal::SUB.
Referenced by handleOperator().
|
staticprivatenoexcept |
Check if a given instruction is ternary (takes three arguments)
| inst |
Definition at line 149 of file ASTLowerer.cpp.
References Ark::internal::AT_AT.
Referenced by handleOperator().
|
staticprivatenoexcept |
Check if a given instruction is unary (takes only one argument)
| inst |
Definition at line 129 of file ASTLowerer.cpp.
References Ark::internal::HEAD, Ark::internal::IS_EMPTY, Ark::internal::IS_NIL, Ark::internal::LEN, Ark::internal::NOT, Ark::internal::TAIL, Ark::internal::TO_NUM, Ark::internal::TO_STR, and Ark::internal::TYPE.
Referenced by handleOperator().
|
staticprivate |
Throw a nice error message, using a message builder.
| kind | error kind |
| node | erroneous node |
| additional_ctx | optional context for the error, e.g. the macro name |
Definition at line 186 of file ASTLowerer.cpp.
References buildAndThrowError(), InvalidNodeInOperatorNoReturnValue, InvalidNodeInTailCallNoReturnValue, InvalidNodeMacro, and InvalidNodeNoReturnValue.
Referenced by compileApplyInstruction(), compileFunction(), compileLetMutSet(), compileListInstruction(), compileWhile(), handleOperator(), and pushFunctionCallArguments().
|
staticprivate |
Checks if a node is a list and has a keyboard as its first node, indicating if it's producing a value on the stack or not
| node | node to check |
Definition at line 105 of file ASTLowerer.cpp.
References Ark::internal::Begin, Ark::internal::Node::constList(), Ark::internal::Fun, Ark::internal::If, Ark::internal::Keyword, Ark::internal::Let, Ark::internal::List, Ark::internal::Mut, nodeProducesOutput(), Ark::internal::Node::nodeType(), Ark::internal::Set, and Ark::internal::Symbol.
Referenced by compileApplyInstruction(), compileListInstruction(), handleFunctionCall(), handleOperator(), handleShortcircuit(), nodeProducesOutput(), and pushFunctionCallArguments().
| void Ark::internal::ASTLowerer::offsetPagesBy | ( | std::size_t | offset | ) |
Start bytecode pages at a given offset (by default, 0)
| offset |
Definition at line 37 of file ASTLowerer.cpp.
References m_start_page_at_offset.
Referenced by Ark::Welder::generateBytecodeUsingTables().
helper functions to get a temp or finalized code page
| page | page descriptor |
Definition at line 138 of file ASTLowerer.hpp.
Referenced by compileApplyInstruction(), compileExpression(), compileFunction(), compileIf(), compileLetMutSet(), compileListInstruction(), compilePluginImport(), compileSymbol(), compileWhile(), handleCalls(), handleFunctionCall(), handleOperator(), and handleShortcircuit().
| void Ark::internal::ASTLowerer::process | ( | Node & | ast | ) |
Start the compilation.
| ast |
Definition at line 42 of file ASTLowerer.cpp.
References compileExpression(), createNewCodePage(), Ark::internal::Pass::m_logger, Ark::internal::Logger::traceEnd(), and Ark::internal::Logger::traceStart().
Referenced by Ark::Welder::generateBytecode().
|
private |
Definition at line 664 of file ASTLowerer.cpp.
References compileExpression(), compileSymbol(), Ark::internal::Node::constList(), InvalidNodeInTailCallNoReturnValue, InvalidNodeNoReturnValue, isBreakpoint(), Ark::internal::Node::list(), makeError(), nodeProducesOutput(), and Ark::internal::Symbol.
Referenced by handleFunctionCall().
|
nodiscardnoexcept |
Return the symbol table pre-computed.
Definition at line 61 of file ASTLowerer.cpp.
References m_symbols.
Referenced by addToTables(), and Ark::Welder::generateBytecode().
|
nodiscardnoexcept |
Return the value table pre-computed.
Definition at line 66 of file ASTLowerer.cpp.
References m_values.
Referenced by Ark::Welder::generateBytecode().
|
private |
Display a warning message.
| message | |
| node |
Definition at line 176 of file ASTLowerer.cpp.
References Ark::internal::Logger::colorize(), Ark::internal::Pass::m_logger, Ark::Diagnostics::makeContextWithNode(), and Ark::internal::Logger::warn().
Referenced by compileFunction(), compileListInstruction(), and compileSymbol().
|
private |
Definition at line 107 of file ASTLowerer.hpp.
Referenced by intermediateRepresentation().
|
private |
Definition at line 109 of file ASTLowerer.hpp.
Referenced by compileApplyInstruction(), compileIf(), compileWhile(), handleFunctionCall(), and handleShortcircuit().
|
private |
Definition at line 101 of file ASTLowerer.hpp.
Referenced by compileFunction(), compileIf(), compileLetMutSet(), compileSymbol(), and compileWhile().
|
private |
stack of vars we are currently declaring
Definition at line 110 of file ASTLowerer.hpp.
Referenced by compileFunction(), and compileLetMutSet().
|
private |
Used to offset the page numbers when compiling code in the debugger.
Definition at line 106 of file ASTLowerer.hpp.
Referenced by offsetPagesBy().
|
private |
Definition at line 104 of file ASTLowerer.hpp.
Referenced by addSymbol(), addToTables(), and symbols().
|
private |
we need temporary code pages for some compilations passes
Definition at line 108 of file ASTLowerer.hpp.
Referenced by handleFunctionCall().
|
private |
Definition at line 105 of file ASTLowerer.hpp.
Referenced by addToTables(), addValue(), addValue(), and values().