This assembler was built for Nisan and Schocken's NAND to Tetris (Building a Modern Computer from First Principles) course. This course involves building a simple Turing-complete computer and all its components, starting at the NAND gate, and then building software for the computer. This assembler is built as part of the course, and is used to assemble the "HACK" computer's assembly language into machine language.
The assembly language specifications can be found here.
My implementation of the assembler uses a single-pass recursive algorithm to read the input and either assemble it or report an error if the input is syntactically invalid. The input is read exactly once, from start to finish, as part of the algorithm; no loop structures are used (except to arrange the memory in a specific order to pass the course's test cases - this feature is not actually required for the assembler to function, however.)