← All projects
Project record1 mention
Originally shared on Hacker News

TypeSpec binary parser library and emitter

A TypeSpec library and emitter that lets developers describe binary file layouts in TypeSpec, specifying where and what each piece of data in the file is, and generates the parser and typed interfaces so a binary stream can be dropped into a parse function to get a typed object back.

Last shared
01 / The problem

What it addresses

Hand-parsing binary file formats requires lots of trial and error; the author wanted a descriptor language that generates the parser and interfaces so a binary stream can be parsed into a typed object.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. TypeSpec binary parser library and emitter

    A TypeSpec library and emitter that lets developers describe binary file layouts in TypeSpec, specifying where and what each piece of data in the file is, and generates the parser and typed interfaces so a binary stream can be dropped into a parse function to get a typed object back.

    Problem: Hand-parsing binary file formats requires lots of trial and error; the author wanted a descriptor language that generates the parser and interfaces so a binary stream can be parsed into a typed object.

    Posted by @Dathuil · Original source ↗

    Source text · @Dathuil · · Source ↗

    What I would have prefered is some sort of descriptor language that lets me generate the parser and interfaces for everything so I just drop the binary stream into a parse function and get my typed object back. I'm working on creating a TypeSpec Library and Emitter for this so that you can describe everything in Typespec as to where and what is in the file and have it parse.