> ## Documentation Index
> Fetch the complete documentation index at: https://docs.potpie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Parsing

> With Potpie, you can with ease, parse through repository’s complex source code, build a structured dependency graph & seamlessly capture every symbol along with their relationship.

<img src="https://mintcdn.com/potpieai/gJ4EwDE1Ctkm-zsd/images/img1.png?fit=max&auto=format&n=gJ4EwDE1Ctkm-zsd&q=85&s=5288fde1b7eebf044b3024c9012a5f7e" alt="a simple image showing code to graph text" width="2161" height="704" data-path="images/img1.png" />

## Repo Onboarding

As you add a repository, Potpie instantly validates the current parsed `status`.

If parsed graph exists, then potpie uses the existing graph, else the repository is passed to the **File Analysis**.

## File Analysis

Every file in the repository is evaluated before parsing action is initiated.

* Files without meaningful source code, such as images, binaries, or notebooks, are excluded early on to avoid unnecessary processing.
* Files with recognized source extensions are accepted as valid inputs and forwarded for structured analysis.

## AST Querying

Each file is parsed into an abstract syntax tree and queried for symbols, which are extracted by matching the file against the language grammar.

* Every `function`, `class`, `method`, or `interface` discovered is recorded with its exact name and precise location in the codebase.
* Each symbol is also classified to indicate whether it represents an **original definition** or a **reference** to a definition elsewhere.

## Graph Construction

* **Definitions** are represented as nodes in the knowledge graph.
* **References** between symbols are represented as edges.

This creates a navigable structural map of the codebase that captures not only what exists, but also interdependency between the components.

## Storage

* The repository is marked as `ready` only when all nodes & relationships are persisted.
* Any subsequent request for the same commit skips parsing entirely and queries the existing graph directly.
