Abhinav 🌏
@abnv.me
Programming languages aficionado, occasional runner, quantified-self enthusiast, and fervent napper. Works as senior software engineer at Google.
If you want to follow […]
🌉 bridged from ⁂ https://fantastic.earth/@abnv, follow @ap.brid.gy to interact
If you want to follow […]
🌉 bridged from ⁂ https://fantastic.earth/@abnv, follow @ap.brid.gy to interact
Pinned
https://stic.earth is a collection of privacy-respecting, self-hosted applications and services, which includes https://fantastic.earth, my server. It currently runs these services:
- #mastodon (Microblogging)
- #pixelfed (Image posting)
- #bookwyrm (Book […]
[Original post on fantastic.earth]
- #mastodon (Microblogging)
- #pixelfed (Image posting)
- #bookwyrm (Book […]
[Original post on fantastic.earth]
Reposted by Abhinav 🌏
Always nice to have options
November 10, 2025 at 12:09 AM
Always nice to have options
RE: https://bots.robots.rodeo/@scream/115523526520806858
This is your sysadmin tooting. https://fantastic.earth is now on #mastodon 4.5! Please enjoy quote posts responsibly.
This is your sysadmin tooting. https://fantastic.earth is now on #mastodon 4.5! Please enjoy quote posts responsibly.
bots.robots.rodeo
November 10, 2025 at 4:46 AM
RE: https://bots.robots.rodeo/@scream/115523526520806858
This is your sysadmin tooting. https://fantastic.earth is now on #mastodon 4.5! Please enjoy quote posts responsibly.
This is your sysadmin tooting. https://fantastic.earth is now on #mastodon 4.5! Please enjoy quote posts responsibly.
I did a short survey of #compiler backends: https://abhinavsarkar.net/notes/2025-compiler-backend-survey/
#compilers #programming #pldev #langdev #blogging
#compilers #programming #pldev #langdev #blogging
A Short Survey of Compiler Backends
As an amateur compiler developer, one of the decisions I struggle with is deciding choosing the compiler backends. Unlike the 80’s when people had to target various machine architectures directly, now there are many mature options available. This is a short and very incomplete survey of some of the popular and interesting options.
### Contents
1. Machine Code / Assembly
2. Intermediate Representations
3. Other High-level Languages
4. Virtual Machines / Bytecode
5. WebAssembly
6. Meta-tracing Frameworks
7. Unconventional Backends
8. Conclusion
## Machine Code / Assembly
A compiler can always directly output machine code or assembly targeted for one or more architectures. A well-known example is the Tiny C Compiler. It’s known for its speed and small size, and it can compile and run C code on the fly. Another such example is Turbo Pascal. You could do this with your compiler too, but you’ll have to figure out the intricacies of the _Instruction set_ of each architecture (ISA) you want to target, as well as, concepts like register allocation.
## Intermediate Representations
Most modern compilers actually don’t emit machine code or assembly directly. They lower the source code down to a language-agnostic _Intermediate representation_ (IR) first, and then generate machine code for major architectures (x86-64, ARM64, etc.) from it.
The most prominent tool in this space is LLVM. It’s a large, open-source compiler-as-a-library. Compilers for many languages such as Rust, Swift, C/C++ (via Clang), and Julia use LLVM as an IR to emit machine code.
An alternative is the GNU C compiler (GCC), via its GIMPLE IR, though no compilers seem to use it directly. GCC can be used as a library to compile code, much like LLVM, via libgccjit. It is used in Emacs to _Just-in-time_ (JIT) compile Elisp. Cranelift is another new option in this space, though it supports only few ISAs.
For those who find LLVM or GCC too large or slow to compile, minimalist alternatives exist. QBE is a small backend focused on simplicity, targeting “70% of the performance in 10% of the code”. It’s used by the language Hare that prioritizes fast compile times. Another option is libFIRM, which uses a graph-based SSA representation instead of a linear IR.
## Other High-level Languages
Sometimes you are okay with letting other compilers/runtimes take care of the heavy lifting. You can transpile your code to a another established high-level language and leverage that language’s existing compiler/runtime and toolchain.
A common target in such cases is C. Since C compilers exist for nearly all platforms, generating C code makes your language highly portable. This is the strategy used by Chicken Scheme and Vala. Or you could compile to C++ instead, like Jank, if that’s your thing.
Another ubiquitous target is JavaScript (JS), which is one of the two options (other being WebAssembly) for running code natively in a web browser or one of the JS runtimes (Node, Deno, Bun). Multiple languages such as TypeScript, PureScript, Reason, ClojureScript, Dart and Elm transpile to JS. Nim interestingly, can transpile to C, C++ or JS.
A more niche approach is to target a Lisp dialect. Compiling to Chez Scheme, for example, allows you to leverage its macro system, runtime, and compiler. The Idris 2 and Racket use Chez Scheme as their primary backends.
## Virtual Machines / Bytecode
This is a common choice for application languages. You compile to a portable bytecode for a _Virtual machine_ (VM). VMs generally come with features like _Garbage collection_ , _JIT compilation_ , and security sandboxing.
The Java Virtual Machine (JVM) is probably the most popular one. It’s the target for many languages including Java, Kotlin, Scala, Groovy, and Clojure. Its main competitor is the Common Language Runtime, originally developed by Microsoft, which is targeted by languages such as C#, F#, and Visual Basic.NET.
Another notable VM is the BEAM, originally built for Erlang. The BEAM VM isn’t built for raw computation speed but for high concurrency, fault tolerance, and reliability. Recently, new languages such as Elixir and Gleam have been created to target it.
Finally, this category also includes MoarVM—the spiritual successor to the Parrot VM—built for the Raku (formerly Perl 6) language, and the LuaJIT VM for Lua, and other languages that transpile to Lua, such as MoonScript and Fennel.
## WebAssembly
WebAssembly (Wasm) is a relatively new target. It’s a portable binary instruction format focused on security and efficiency. Wasm is supported by all major browsers, but not limited to them. The _WebAssembly System Interface_ (WASI) standard provides APIs for running Wasm in non-browser and non-JS environments. Wasm is now targeted by many languages such as Rust, C/C++, Go, Kotlin, Scala, Zig, and Haskell.
## Meta-tracing Frameworks
_Meta-tracing Frameworks_ are a more complex category. These are not the backend you target in your compiler, instead, you use them to build a custom JIT compiler for your language by specifying an interpreter for it.
The most well-known example is PyPy, an implementation of Python, created using the RPython framework. Another such framework is GraalVM/Truffle, a polyglot VM and meta-tracing framework from Oracle. Its main feature is zero-cost interoperability: code from GraalJS, TruffleRuby, and GraalPy can all run on the same VM, and can call each other directly.
## Unconventional Backends
Move past the mainstream, and you’ll discover a world of unconventional and esoteric compiler backends. Developers pick them for academic curiosity, artistic expression, or to test the boundaries of viable compilation targets.
* Brainfuck: An esoteric language with only eight commands, Brainfuck is _Turing-complete_ and has been a target for compilers as a challenge. People have written compilers for C, Haskell and Lambda calculus.
* Lambda calculus: Lambda calculus is a minimal programming languages that expresses computation solely as functions and their applications. It is often used as the target of educational compilers because of its simplicity, and its link to the fundamental nature of computation. Hell, a subset of Haskell, compiles to Simply typed lambda calculus.
* SKI combinators: The SKI combinator calculus is even more minimal than lambda calculus. All programs in SKI calculus can be composed of only three combinators: S, K and I. MicroHs compiles a subset of Haskell to SKI calculus.
* JSFuck: Did you know that you can write all possible JavaScript programs using only six characters `[]()!+`? Well, now you know.
* Postscript: Postscript is also a Turing-complete programming language. Your next compiler could target it!
* Regular Expressions? Lego? Cellular automata?
## Conclusion
I’m going to write a compiler from C++ to JSFuck.
If you have any questions or comments, please leave a comment below. If you liked this post, please share it. Thanks for reading!
abhinavsarkar.net
November 5, 2025 at 11:17 AM
I did a short survey of #compiler backends: https://abhinavsarkar.net/notes/2025-compiler-backend-survey/
#compilers #programming #pldev #langdev #blogging
#compilers #programming #pldev #langdev #blogging
Right time #photography #silentsunday
November 2, 2025 at 7:50 AM
Right time #photography #silentsunday
Reposted by Abhinav 🌏
Next #indieweb Club #bangalore session is scheduled on this Saturday https://blr.indiewebclub.org/#upcoming-event. Get your tickets now!
This will be a writing focused session. This week we’re talking about digital gardens! Our agenda for the discussions is:
- A rapid fire history of digital […]
This will be a writing focused session. This week we’re talking about digital gardens! Our agenda for the discussions is:
- A rapid fire history of digital […]
Original post on fantastic.earth
fantastic.earth
October 29, 2025 at 2:35 AM
Next #indieweb Club #bangalore session is scheduled on this Saturday https://blr.indiewebclub.org/#upcoming-event. Get your tickets now!
This will be a writing focused session. This week we’re talking about digital gardens! Our agenda for the discussions is:
- A rapid fire history of digital […]
This will be a writing focused session. This week we’re talking about digital gardens! Our agenda for the discussions is:
- A rapid fire history of digital […]
I wrote a new note with some pointless facts about me: https://abhinavsarkar.net/notes/2025-ten-pointless-facts/ #pointless10 @daj
#blogging
#blogging
Ten Pointless Facts About Me
I love participating in blogging challenges because they give me ready-made prompt to write about. So here is a new one that is doing the rounds:
## Do you floss your teeth?
Yes, I do floss my teeth, about 80% of days, which is more than what most Indian can say. Flossing is not big in India, and I didn’t do it most of my life either. But ever since I had a series of painful appointments with my dentist, I’ve been trying to do it as regularly as I can.
## Tea, coffee, or water?
Uh, all of them? Why is water an option? Are there people who don’t drink water? I religiously consume my three liters of water every day. I also have my morning cup of tea or coffee, and my evening cup of tea. I prefer coffee in mornings, though I’ve been abstaining from it for the last couple of months for health reasons.
## Footwear preference?
I’ve been wearing my ASICS/Nike trainers as my daily footwear for almost a decade now. At home, I prefer slippers.
## Favourite dessert?
This is a hard one because I have a massive sweet tooth, but to choose a few: Chomchom, Apple pie, Blueberry cheesecake and Thapthim krop.
## The first thing you do when you wake up?
I hug my wife and child and greet them. Then I check my email (I don’t get much mail) and notifications on my phone.
## Age you’d like to stick at?
I am actually fine with aging. But if I could stick to an age while being capable of gaining experience and wisdom, I’d choose 27.
## How many hats do you own?
None! Indians don’t wear hats. I do own two (nice) caps, and many beanies.
## Describe the last photo you took?
It’s a selfie with my kid! I take so many of them these days.
## Worst TV show?
I find most TV shows boring, and I don’t watch many. There are so many popular ones that my friends talk about watching, and I’m almost always clueless about them.
## As a child, what was your aspiration for adulthood?
To be honest, I just wanted to build things and have fun. I’m computer programmer now, so I guess I succeeded.
If you have any questions or comments, please leave a comment below. If you liked this post, please share it. Thanks for reading!
abhinavsarkar.net
October 30, 2025 at 2:26 PM
I wrote a new note with some pointless facts about me: https://abhinavsarkar.net/notes/2025-ten-pointless-facts/ #pointless10 @daj
#blogging
#blogging
Reposted by Abhinav 🌏
It’s worth noting that your employer may match these donations; mine does. So, in the end, this was $2,060 donated to the PSF.
https://wandering.shop/@offby1/115448024565488288
It’s what I can spare right now; you may not be able to spare as much, but there are tens of thousands of us.
https://wandering.shop/@offby1/115448024565488288
It’s what I can spare right now; you may not be able to spare as much, but there are tens of thousands of us.
Chris is. (@[email protected])
I have nothing but respect and sympathy for @[email protected] in their decision to withdraw from the NSF grant program in order not to compromise on their mission to keep #Python a diverse and welcoming open source community It's hard to turn down that kind of money So, here's my .02c for it, metaphorically. I'll personally make a $1000 donation to help fill in that gap. There are certainly 1500 of us who can spare that much, in the global python community. Who's with me? https://fosstodon.org/@ThePSF/115446659188615376
wandering.shop
October 27, 2025 at 9:27 PM
It’s worth noting that your employer may match these donations; mine does. So, in the end, this was $2,060 donated to the PSF.
https://wandering.shop/@offby1/115448024565488288
It’s what I can spare right now; you may not be able to spare as much, but there are tens of thousands of us.
https://wandering.shop/@offby1/115448024565488288
It’s what I can spare right now; you may not be able to spare as much, but there are tens of thousands of us.
Next #indieweb Club #bangalore session is scheduled on this Saturday https://blr.indiewebclub.org/#upcoming-event. Get your tickets now!
This will be a writing focused session. This week we’re talking about digital gardens! Our agenda for the discussions is:
- A rapid fire history of digital […]
This will be a writing focused session. This week we’re talking about digital gardens! Our agenda for the discussions is:
- A rapid fire history of digital […]
Original post on fantastic.earth
fantastic.earth
October 29, 2025 at 2:35 AM
Next #indieweb Club #bangalore session is scheduled on this Saturday https://blr.indiewebclub.org/#upcoming-event. Get your tickets now!
This will be a writing focused session. This week we’re talking about digital gardens! Our agenda for the discussions is:
- A rapid fire history of digital […]
This will be a writing focused session. This week we’re talking about digital gardens! Our agenda for the discussions is:
- A rapid fire history of digital […]
Reposted by Abhinav 🌏
I'm starting a series of blog posts, in which I write a #bytecode #compiler and a #virtualmachine for arithmetic in #haskell. We explore the following topics in the series:
- Parsing arithmetic expressions to ASTs.
- Compiling ASTs to bytecode.
- Interpreting ASTs.
- Efficiently executing […]
- Parsing arithmetic expressions to ASTs.
- Compiling ASTs to bytecode.
- Interpreting ASTs.
- Efficiently executing […]
Original post on fantastic.earth
fantastic.earth
August 2, 2025 at 12:40 PM
I'm starting a series of blog posts, in which I write a #bytecode #compiler and a #virtualmachine for arithmetic in #haskell. We explore the following topics in the series:
- Parsing arithmetic expressions to ASTs.
- Compiling ASTs to bytecode.
- Interpreting ASTs.
- Efficiently executing […]
- Parsing arithmetic expressions to ASTs.
- Compiling ASTs to bytecode.
- Interpreting ASTs.
- Efficiently executing […]
Reposted by Abhinav 🌏
Which brings us to the age-old question:
Has nobody done this before because it's hard?
Or because it's really fucking stupid?
Has nobody done this before because it's hard?
Or because it's really fucking stupid?
October 26, 2025 at 5:22 PM
Which brings us to the age-old question:
Has nobody done this before because it's hard?
Or because it's really fucking stupid?
Has nobody done this before because it's hard?
Or because it's really fucking stupid?
Reposted by Abhinav 🌏
Writing an #interpreter for #brainfuck is almost a rite of passage for any programming language implementer, and it’s my turn now. In this post, I write not one but four Brainfuck #interpreters in #haskell: https://abhinavsarkar.net/posts/brainfuck-interpreter/
#programminglanguages #compilers […]
#programminglanguages #compilers […]
Original post on fantastic.earth
fantastic.earth
January 19, 2025 at 4:40 PM
Writing an #interpreter for #brainfuck is almost a rite of passage for any programming language implementer, and it’s my turn now. In this post, I write not one but four Brainfuck #interpreters in #haskell: https://abhinavsarkar.net/posts/brainfuck-interpreter/
#programminglanguages #compilers […]
#programminglanguages #compilers […]
Reposted by Abhinav 🌏
Introducing my state of the art Linux distro, Ebian. It's secure, performant, and awesome.
https://www.debian.org/ follow the instructions here to get an iso (we use this software project only to bootstrap ebian) and then install it.
Then, run `sudo apt update && sudo apt install emacs`
This […]
https://www.debian.org/ follow the instructions here to get an iso (we use this software project only to bootstrap ebian) and then install it.
Then, run `sudo apt update && sudo apt install emacs`
This […]
Original post on hachyderm.io
hachyderm.io
October 22, 2025 at 3:38 PM
Introducing my state of the art Linux distro, Ebian. It's secure, performant, and awesome.
https://www.debian.org/ follow the instructions here to get an iso (we use this software project only to bootstrap ebian) and then install it.
Then, run `sudo apt update && sudo apt install emacs`
This […]
https://www.debian.org/ follow the instructions here to get an iso (we use this software project only to bootstrap ebian) and then install it.
Then, run `sudo apt update && sudo apt install emacs`
This […]
Reposted by Abhinav 🌏
Good morning! I am looking for contract work. If you have 10-15 hours a week of work on a well defined technical project (‘we need to move 6 websites by this date’, ‘we need to hire a team to do an infra migration’, ‘we need to complete an accessibility audit and figure out next steps’, ‘we need […]
Original post on hachyderm.io
hachyderm.io
October 21, 2025 at 3:40 PM
Good morning! I am looking for contract work. If you have 10-15 hours a week of work on a well defined technical project (‘we need to move 6 websites by this date’, ‘we need to hire a team to do an infra migration’, ‘we need to complete an accessibility audit and figure out next steps’, ‘we need […]
I've written a series of blog posts, in which I write a #bytecode #compiler and a #virtualmachine for arithmetic in #haskell. We explore the following topics in the series:
- Parsing arithmetic expressions to ASTs.
- Compiling ASTs to bytecode.
- Interpreting ASTs.
- Efficiently executing […]
- Parsing arithmetic expressions to ASTs.
- Compiling ASTs to bytecode.
- Interpreting ASTs.
- Efficiently executing […]
Original post on fantastic.earth
fantastic.earth
October 21, 2025 at 3:14 PM
I've written a series of blog posts, in which I write a #bytecode #compiler and a #virtualmachine for arithmetic in #haskell. We explore the following topics in the series:
- Parsing arithmetic expressions to ASTs.
- Compiling ASTs to bytecode.
- Interpreting ASTs.
- Efficiently executing […]
- Parsing arithmetic expressions to ASTs.
- Compiling ASTs to bytecode.
- Interpreting ASTs.
- Efficiently executing […]
Reposted by Abhinav 🌏
This is the Machete Washboard V2 and it fills me with longing even though it makes no sense at all. #mechnicalkeyboard #keyboards
October 17, 2025 at 11:50 PM
This is the Machete Washboard V2 and it fills me with longing even though it makes no sense at all. #mechnicalkeyboard #keyboards
IndieWebClub Bangalore
Website of the IndieWebClub Bangalore community
blr.indiewebclub.org
October 19, 2025 at 6:17 AM
Reposted by Abhinav 🌏
Next session of #indieweb Club #bangalore is in two days: https://indiewebclubblr.github.io/website/#upcoming-event.
This will be a tech and design focused session. During the session, we’ll co-work on our personal websites, try new designs, squash bugs, or just do some long-neglected digital […]
This will be a tech and design focused session. During the session, we’ll co-work on our personal websites, try new designs, squash bugs, or just do some long-neglected digital […]
Original post on fantastic.earth
fantastic.earth
October 16, 2025 at 5:01 AM
Next session of #indieweb Club #bangalore is in two days: https://indiewebclubblr.github.io/website/#upcoming-event.
This will be a tech and design focused session. During the session, we’ll co-work on our personal websites, try new designs, squash bugs, or just do some long-neglected digital […]
This will be a tech and design focused session. During the session, we’ll co-work on our personal websites, try new designs, squash bugs, or just do some long-neglected digital […]