Latest Tech News

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

Filtered by: lexer 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

Pearl – An Erlang lexer and syntax highlighter in Gleam

Pearl An Erlang lexer and syntax highlighter for Gleam! Pearl is a lexer and syntax highlighter for Erlang, written in Gleam. The lexer is based on glexer and just , allowing you to convert Erlang source code into tokens. There is also an API which allows you to highlight Erlang code using ansi colours, html or a custom format. Heavily inspired by contour . gleam add pearl@2 import pearl pub fn main ( ) { let code = " -module(hello). -export([hello_world/0]). hello_world() -> io:fwrite( \" H