Skip to main content

Module ast

Module ast 

Source
Expand description

Abstract syntax representation. It’s mostly not actually a tree.

In the AST, terminology follows the TX-2 assembler’s documentation, and this doesn’t always match modern usage. In particular, “block” is used to refer to a contiguously-allocated sequence of instructions which share an origin statement. Such as the RC-block. This is not the same as a block in a language like C, where “block” is also a declaration-scoping construct.

Instead, in the TX-2 assembler, scopes are introduced by macro expansion. So, a “block” may contain some instructions followed by a macro-expansion (which has an associated scope) which itself might contain a macro-expansion, with another scope.

Re-exports§

use std::borrow::Cow; 🔒
use std::cmp::Ordering; 🔒
use std::collections::BTreeMap; 🔒
use std::error::Error; 🔒
use std::fmt; 🔒
use std::fmt::Display; 🔒
use std::fmt::Formatter; 🔒
use std::fmt::Octal; 🔒
use std::fmt::Write; 🔒
use std::hash::Hash; 🔒
use std::hash::Hash; 🔒
use std::ops::Shl; 🔒
use std::ops::Shr; 🔒
use tracing::Level; 🔒
use tracing::event; 🔒
use tracing::event; 🔒
use base::charset::Script; 🔒
use base::charset::subscript_char; 🔒
use base::charset::superscript_char; 🔒
use base::u18; 🔒
use super::collections::OneOrMore; 🔒
use super::eval::Evaluate; 🔒
use super::eval::EvaluationContext; 🔒
use super::eval::EvaluationFailure; 🔒
use super::eval::HereValue; 🔒
use super::eval::ScopeIdentifier; 🔒
use super::eval::evaluate_elevated_symbol; 🔒
use super::glyph; 🔒
use super::listing::Listing; 🔒
use super::listing::ListingLine; 🔒
use super::manuscript::MacroParameterBindings; 🔒
use super::manuscript::MacroParameterValue; 🔒
use super::memorymap::MemoryMap; 🔒
use super::memorymap::RcAllocator; 🔒
use super::memorymap::RcWordAllocationFailure; 🔒
use super::memorymap::RcWordKind; 🔒
use super::memorymap::RcWordSource; 🔒
use super::source::Source; 🔒
use super::span::Span; 🔒
use super::span::Spanned; 🔒
use super::span::span; 🔒
use super::state::MacroLookup; 🔒
use super::symbol::InconsistentSymbolUse; 🔒
use super::symbol::SymbolContext; 🔒
use super::symbol::SymbolName; 🔒
use super::symtab::BadSymbolDefinition; 🔒
use super::symtab::ExplicitDefinition; 🔒
use super::symtab::ExplicitSymbolTable; 🔒
use super::symtab::FinalSymbolDefinition; 🔒
use super::symtab::FinalSymbolTable; 🔒
use super::symtab::FinalSymbolType; 🔒
use super::symtab::ImplicitSymbolTable; 🔒
use super::symtab::IndexRegisterAssigner; 🔒
use super::symtab::TagDefinition; 🔒
use super::symtab::record_undefined_symbol_or_return_failure; 🔒
use super::types::AssemblerFailure; 🔒
use super::types::BlockIdentifier; 🔒
use super::types::ProgramError; 🔒
use base::prelude::*; 🔒

Modules§

asteval 🔒
Evaluate (i.e. generate binary data from) parts of the AST.

Structs§

ArithmeticExpression 🔒
Represents an arithmetic expression.
CommaDelimitedFragment 🔒
A component (usually a number) of an assembly-language instruction with possible leading or trailing commas.
ConfigValue 🔒
An expression used to specify the configuration bits of an instruction.
Equality 🔒
An “Equality” (modern term: assignment).
EqualityValue 🔒
The right-hand-side of an Equality.
FragmentWithHold 🔒
Part of a TX-2 instruction, convertible to a 36-bit value.
InstructionSequence 🔒
LiteralValue 🔒
Eventually we will support symbolic expressions.
RegistersContaining 🔒
SignedAtom 🔒
SpannedSymbolOrLiteral 🔒
Tag 🔒
A “Tag” is a symex used as a name for a place in a program. A tag is always terminated by an arrow (“->”) and [in the symbol table] it set to the numerical location of the word that it tags. [from section 6-2.2 of the User’s Handbook].
TaggedProgramInstruction 🔒
A TX-2 instruction with zero or more Tags.
UntaggedProgramInstruction 🔒
An instruction word in a TX-2 program.

Enums§

Atom 🔒
A component of an arithmetic expression.
Commas 🔒
One, two or three commas.
CommasOrInstruction 🔒
An instruction fragment (FragmentWithHold) or one or more commas.
HoldBit 🔒
Indicates whether the hold bit is set, cleared or unspecified.
InstructionFragment 🔒
Part of a TX-2 instruction.
LocalSymbolTableBuildFailure 🔒
We failed to build a local symbol table.
OnUnboundMacroParameter 🔒
Indicates the action to be taken when a macro invocation does not specify a value for one of its dummy parameters.
Operator 🔒
The Users Handbook specifies that the operators are the four arithmetic operators (+-×/) and the logical operators ∧ (AND), ∨ (OR), and a circled ∨ meaning XOR.
Origin 🔒
Represents the origin of a block of program code.
RegisterContaining 🔒
An RC-word.
SymbolOrLiteral 🔒
A symbol name or a numeric literal, or #.
SymbolSubstitution 🔒
Indicates how some particular macro parameter should be processed.
SymbolUse 🔒
Records a reference to or definition of a symbol.

Traits§

RcUpdater 🔒
Allows updates to the values of RC-words.

Functions§

block_items_with_offset 🔒
Enumerate a sequence of items, decorating each with an Unsigned18Bit offset value.
elevated_string 🔒
Convert a normal string to subscript or superscript (or leave it as-is).
format_elevated_chars 🔒
Format a string in super/sub/normal script, using @...@ where necessary.
write_glyph_name 🔒
Write the name of a glyph with optional superscript / subscript indicator.