Skip to main content

Crate assembler

Crate assembler 

Source
Expand description

Assembler for the TX-2.

Accepts symbolic assembly source code for the TX-2. Follows the syntax and behaviour of the TX-2’s M4 assembler written by Larry Roberts.

There are a number of differences between this assembler and M4. These are:

  • This assembler’s input is a Unicode text file, while M4’s input was a tape (or magnetic tape input) containing Lincoln Writer codes. This has some consequences for how the input is represented (among other reasons because the Lincoln Writer supported some superscript and subscript characters which are not in Unicode).
  • M4’s input includes editing commands; these are not needed on modern systems, since they support files and editors which are independent of the assembler.
  • M4 produced output directly on a paper tape; this assmebler produces a tape image file (containing the same data).
  • Some features, notably support for local tag scope inside macro bodies, are not yet implemented.
  • Tab characters are not supported in the input.
  • This assembler produces diagnositics for some kinds of erroneous input that M4 accepted (see below).

§Diagnostics

This assembler produces diagnostics giving the line number (and often, the approximate column number) of errors.

The M4 assembler accepted circular symbol definitions (for origins for example, see XXX) but this assembler detects this and generates an error message.

There may be some cases in which M4 generated an error but were we either do not, or where we lack a test ensuring that the error message is correctly generated; https://github.com/TX-2/TX-2-simulator/issues/159 enumerates these.

Re-exports§

pub use disassembler::DisassemblerFailure;
pub use disassembler::disassemble_file;
pub use types::AssemblerFailure;
pub use output::write_user_program;

Modules§

ast 🔒
Abstract syntax representation. It’s mostly not actually a tree.
collections 🔒
Containers, including OneOrMore.
directive 🔒
Intermetiate representation of the assembly language input.
disassembler 🔒
driver 🔒
Invoke the various passes of the assembler.
eval 🔒
Turn the symbolic program into a sequence of words in binary.
glyph 🔒
Implement the @...@ constructs in the source code.
lexer 🔒
Turn text input into a sequence of tokens.
listing 🔒
Emit assembly language listing, with a symbol table.
manuscript 🔒
The immediate output of the parsing process.
memorymap 🔒
Decide final position of blocks of code and allocate RC-words.
output
Generate the output binary, as a tape image file.
parser 🔒
Turn a sequence of input tokens into a data structure representing it.
readerleader 🔒
The first part of the binary program output.
source 🔒
Representation of the original input.
span 🔒
Representation of locations within the original source file.
state 🔒
Represents the state of the source code parser.
symbol 🔒
Symbol names and information about how these are used in the program.
symtab 🔒
Explicit and implicit symbol definitions.
types 🔒
Fundamental types and errors.

Structs§

Binary
The assembled program; a sequence of BinaryChunk instances with an optional entry point.
BinaryChunk
A contiguous sequence of words at some starting address.
NoRcBlock
Placeholder for the RC-block which will not allocate words.
OutputOptions
Indicates what kind of output the user wants.
Pass2Output
Output of pass 2 of the assembler.

Enums§

AssemblerPass1Or2Output
Describes the result of running the first (and possibly the second) pass of the assembler.
DirectiveMetaCommand
Represents the meta commands which are still relevant in the directive. Excludes things like the PUNCH meta command.

Functions§

assemble_file
Assemble input file, producing a tape image.
assemble_nonempty_input
Assemble a non-empty input.
assemble_pass1
Pass 1 converts the program source into an abstract syntax representation.
assemble_pass2
Pass 2 converts the abstract syntax representation into a Directive, which is closer to binary code.
assemble_pass3
Pass 3 generates binary code.
assemble_source
Run all the passes of assembly, generating an output-ready Binary.
bit_index
Convert a bit designator (as described in the documentation for the SKM opcode on page 3-34 of the User Handbook) into an Unsigned6Bit field (suitable for use as the index portion of an instruction word).
cleanup_control_chars
Pass-through a String instance; the output quotes control characters and backslashes.
fail_with_diagnostics
Convert raw parse errors into instances of ProgramError.
initial_symbol_table
reader_leader
Returns the standard reader leader.