2 releases

0.1.2 Aug 21, 2019
0.1.1 Aug 21, 2019
0.1.0 Aug 19, 2019

#8 in #lc3

25 downloads per month

GPL-2.0-only

34KB
883 lines

lc3asm

LC-3 assembly code parser & assembler
Copyright (C) 2019 Nam Jeonghyun. (ska827@snu.ac.kr)

Installation

cargo install lc3asm --features binary-build

Assembly language parser

lc3asm::AsmParser and lc3asm::Rule provides an assembly parser and rules. Parser grammar follows definitions from Introduction to Computing Systems: From Bits and Gates to C and Beyond. Plus, some features are added:

  • UTF-8 string literal support(currently panics if non UTF-8 file is given)
  • Backslash escape sequence("\\"/"\r"/"\n"/"\t"/"\b"/"\f"/"\u00A9") support in string literal
    • Note that unicode escape sequence requires exactly four hexadecimal numbers for each character.
  • Elegant syntax error reporting(powered by Pest)
  • For compatiability issues, decimal literal without # is accepted for immediate values, but this could be removed in the future.

Dependencies

~2.2–3.5MB
~63K SLoC