# Visiting an Abstract Syntax Tree

DevFeed: [Visiting an Abstract Syntax Tree](<https://devfeed.tech/articles/visiting-an-abstract-syntax-tree-31803.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2022/1/22/visiting-an-abstract-syntax-tree>)

Author: Pat Shaughnessy

Published: 2022-01-22T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Crystal](<https://devfeed.tech/topics/crystal.md>), [Parser](<https://devfeed.tech/topics/parser.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Computer science](<https://devfeed.tech/topics/computer-science.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [crystal](<https://devfeed.tech/tags/crystal.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

## AI overview

This tutorial examines how Crystal uses abstract syntax tree visitors during semantic analysis. It explains the visitor pattern as a way to apply multiple algorithms to the same tree data structure and describes how Crystal's compiler uses visitors to inspect syntax, record type and object information, and potentially transform code.

## Source excerpt

Joshua Tree National Park (via: Wikimedia Commons) In my