# Compiler

Class in [Yarn.Compiler](/3.1/api/csharp/yarn.compiler.md)

Inherits from `System.Object`

## Summary

Compiles Yarn code.

```csharp
public static class Compiler
```

## Methods

| Name                                                                                                                                                                | Description                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Compile(CompilationJob)](/3.1/api/csharp/yarn.compiler/yarn.compiler.compiler/yarn.compiler.compiler.compile.md)                                                   | Compiles Yarn code, as specified by a compilation job.                                                                                                                             |
| [FlattenParseTree(IParseTree)](/3.1/api/csharp/yarn.compiler/yarn.compiler.compiler/yarn.compiler.compiler.flattenparsetree.md)                                     | Flattens a tree of `Antlr4.Runtime.Tree.IParseTree` objects by recursively visiting their children, and converting them into a flat ``System.Collections.Generic.IEnumerable`1`` . |
| [GetDocumentComments(CommonTokenStream,ParserRuleContext,bool)](/3.1/api/csharp/yarn.compiler/yarn.compiler.compiler/yarn.compiler.compiler.getdocumentcomments.md) | Gets the text of the documentation comments that either immediately precede `context` , or are on the same line as `context` .                                                     |
| [GetLineIDForNodeName(string)](/3.1/api/csharp/yarn.compiler/yarn.compiler.compiler/yarn.compiler.compiler.getlineidfornodename.md)                                 | Generates a line id for a raw text node                                                                                                                                            |


---

# Agent Instructions: 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:

```
GET https://docs.yarnspinner.dev/3.1/api/csharp/yarn.compiler/yarn.compiler.compiler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
