assembler/lib.rs
1//! Assembler for the TX-2.
2//!
3//! Accepts symbolic assembly source code for the TX-2. Follows the
4//! syntax and behaviour of the TX-2's M4 assembler written by Larry
5//! Roberts.
6//!
7//! There are a number of differences between this assembler and M4. These are:
8//!
9//! - This assembler's input is a Unicode text file, while M4's input
10//! was a tape (or magnetic tape input) containing Lincoln Writer codes.
11//! This has some consequences for how the input is represented (among
12//! other reasons because the Lincoln Writer supported some superscript
13//! and subscript characters which are not in Unicode).
14//! - M4's input includes editing commands; these are not needed on
15//! modern systems, since they support files and editors which are
16//! independent of the assembler.
17//! - M4 produced output directly on a paper tape; this assmebler
18//! produces a tape image file (containing the same data).
19//! - Some features, notably support for local tag scope inside macro
20//! bodies, are not yet implemented.
21//! - Tab characters are not supported in the input.
22//! - This assembler produces diagnositics for some kinds of erroneous
23//! input that M4 accepted (see below).
24//!
25//! # Diagnostics
26//!
27//! This assembler produces diagnostics giving the line number (and
28//! often, the approximate column number) of errors.
29//!
30//! The M4 assembler accepted circular symbol definitions (for origins
31//! for example, see XXX) but this assembler detects this and generates
32//! an error message.
33//!
34//! There may be some cases in which M4 generated an error but were we
35//! either do not, or where we lack a test ensuring that the error
36//! message is correctly generated;
37//! <https://github.com/TX-2/TX-2-simulator/issues/159> enumerates
38//! these.
39#![deny(unreachable_pub)]
40#![deny(unsafe_code)]
41#![warn(clippy::must_use_candidate)]
42#![warn(clippy::manual_string_new)]
43#![warn(clippy::semicolon_if_nothing_returned)]
44#![warn(clippy::return_self_not_must_use)]
45#![warn(clippy::wildcard_imports)]
46#![warn(clippy::bool_to_int_with_if)]
47#![warn(clippy::clone_on_ref_ptr)]
48#![warn(clippy::match_same_arms)]
49#![warn(clippy::missing_errors_doc)]
50#![warn(clippy::items_after_statements)]
51#![warn(clippy::explicit_iter_loop)]
52#![warn(clippy::unreadable_literal)]
53#![warn(clippy::redundant_closure_for_method_calls)]
54#![warn(clippy::pedantic)]
55#![allow(clippy::verbose_bit_mask)] // because many of our types don't have trailing_zeros().
56#![allow(clippy::too_many_lines)] // fix later
57#![allow(clippy::default_trait_access)] // fix later
58
59mod ast;
60mod collections;
61mod directive;
62mod driver;
63mod eval;
64mod glyph;
65mod lexer;
66mod listing;
67mod manuscript;
68mod memorymap;
69mod parser;
70mod readerleader;
71mod source;
72mod span;
73mod state;
74mod symbol;
75mod symtab;
76mod types;
77
78pub use driver::*;
79pub use readerleader::*;
80pub use types::AssemblerFailure;