I spent a year of my life making an ASN.1 compiler in D
6 months ago
- #Compiler
- #D-Language
- #ASN.1
- The author is working on a tool called dasn1, which is a work-in-progress ASN.1 compiler.
- ASN.1 is a complex data specification language used in various protocols, including x.509 certificates for TLS.
- The post discusses the challenges of implementing ASN.1, including its notation and various encodings like DER.
- ASN.1's notation is defined by specifications x.680, x.681, x.682, and x.683, with x.680 being the base notation.
- The author highlights the complexity of ASN.1, including its many encodings and the difficulty of reading its specifications.
- D programming language features like static imports, module-local lookups, and typeof() are praised for making code generation easier.
- The post includes examples of how D's metaprogramming features are used in dasn1, such as mixin templates and compile-time tuples.
- The author shares frustrations with ASN.1's complexity, including ambiguous syntax and scattered specifications.
- Despite the challenges, the author finds ASN.1 interesting and powerful, especially its constraint features.
- The post concludes with a humorous note about the difficulties of working with ASN.1 and the tech industry's hiring practices.