← Back to context

Comment by bouk

10 hours ago

I highly recommend anyone to look at jq's VM implementation some time, it's kind of mind-blowing how it works under the hood: https://github.com/jqlang/jq/blob/master/src/execute.c

It does some kind of stack forking which is what allows its funky syntax

The backtracking implementation in jq is really the secret sauce for how it handles those complex filters without getting bogged down

Looks like naive implementation of homemade bytecode interpreter. What's so mind blowing about that? Maybe I missed something.