Oriel — AI & technology worth noticing, every day.

An LC-3 Disassembler in Haskell

Web page · https://abhinavsarkar.net/posts/lc3-disassembler

First seen by Oriel on .

AI summary

This post implements an LC-3 binary disassembler in Haskell, using instruction decoding, contextual speculation, data cleanup, and label insertion to reconstruct textual assembly.

  • LC-3 object files contain intermixed raw instructions and data without section tables, symbols, relocation information, or debug symbols.
  • The disassembler performs multiple passes: unambiguous decoding, iterative context-based speculation, byte combining, and label insertion.
  • Its Instruction type represents valid instructions, invalid or raw words, characters, strings, labels, and speculative interpretations.
  • Type-safe Tribit and Nibble pattern synonyms mirror LC-3 bit fields while GHC’s COMPLETE pragma enforces exhaustive opcode matching.
  • Malformed encodings become RAW values, while BR words without condition flags may be recognized as ASCII characters instead.

#haskell #lc-3 #disassemblers #assembly

Generated by gpt-5.6-sol. Check the original for details.

Metric trends

Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained

Points

Score reported by the source.

  • Lobsters: 15, latest observation ; +14 over observed period since

Comments

Comment count reported by the source.

  • Lobsters: 4, latest observation ; +4 over observed period since

Aliases

SourceExternal IDURL
Lobstersqoznnhhttps://abhinavsarkar.net/posts/lc3-disassembler/ Read discussion