> For the complete documentation index, see [llms.txt](https://docs.hylo-lang.org/hylo-ir/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hylo-lang.org/hylo-ir/concepts/abstract-machine.md).

# Abstract machine

The semantics of Hylo IR is defined in terms of an abstract machine. A language implementation shall interpret or compile native programs that follow the same behavior.

The Val abstract machine consists of a collection of *threads* and a global memory space. A thread consists of a *register map* that associates local register names to objects or locations in the machine's global memory, a *control stack* that contains instructions, and a *call stack* that contains register map&#x73;*.*

{% hint style="info" %}
A thread is similar to a [SECD machine](https://en.wikipedia.org/wiki/SECD_machine) without a register stack. Just like in [ANF](https://en.wikipedia.org/wiki/A-normal_form), instruction operands are either constants or names denoting the value of a local register.
{% endhint %}

When a basic block is loaded into a thread, its instructions are pushed onto the stack in reverse order (i.e., the last instruction is pushed first).

## Program execution

Program execution starts by adding a thread to the abstract machine, which gets designated as the *main thread*. The register map and call stack of the main thread are initialized empty. The control stack is initialized by loading the entry block of the main function of the program's entry module.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hylo-lang.org/hylo-ir/concepts/abstract-machine.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
