Latest Tech News

Stay updated with the latest in technology, AI, cybersecurity, and more

Filtered by: i32 Clear Filter

Writing a C compiler in 500 lines of Python (2023)

Writing a C compiler in 500 lines of Python Posted August 30, 2023 A few months ago, I set myself the challenge of writing a C compiler in 500 lines of Python , after writing my SDF donut post. How hard could it be? The answer was, pretty hard, even when dropping quite a few features. But it was also pretty interesting, and the result is surprisingly functional and not too hard to understand! There's too much code for me to comprehensively cover in a single blog post , so I'll just give an ove

Topics: code emit i32 lexer type

Writing a C compiler in 500 lines of Python

Writing a C compiler in 500 lines of Python Posted August 30, 2023 A few months ago, I set myself the challenge of writing a C compiler in 500 lines of Python , after writing my SDF donut post. How hard could it be? The answer was, pretty hard, even when dropping quite a few features. But it was also pretty interesting, and the result is surprisingly functional and not too hard to understand! There's too much code for me to comprehensively cover in a single blog post , so I'll just give an ove

Topics: code emit i32 lexer type

So you want to serialize some DER?

So you want to serialize some DER? (Editor’s Note: My day job is at Anthropic.) This story starts where all good stories start, with ASN.1. ASN.1 is… I guess you’d call it a meta-serialization format? It’s a syntax for describing data abstractly (a notation, you might say), and then there’s a bunch of different actual encodings that you can use to turn data into bytes. There’s only one encoding I choose to acknowledge, which is DER (the Distinguished Encoding Representation, it’s got a monocle