# jq Bytecode Compiler and Virtual Machine: Deep Dive into the Execution Engine

> Explore the jq bytecode compiler and virtual machine. Understand how jq executes JSON filters efficiently with its custom stack-based engine, supporting advanced features.

- Repository: [jqlang/jq](https://github.com/jqlang/jq)
- Tags: deep-dive
- Published: 2026-04-11

---

**jq transforms JSON-processing filters into compact bytecode instructions and executes them on a custom stack-based virtual machine that supports closures, backtracking, and tail-call optimization.**

The `jqlang/jq` repository implements a complete compiler toolchain that turns its domain-specific language (DSL) into a linear instruction stream, then interprets that stream using a purpose-built VM. Understanding this **jq bytecode compiler and virtual machine** architecture reveals how the tool achieves its characteristic combination of expressive power and execution efficiency.

## From Filter Text to Bytecode: The Compilation Pipeline

jq employs