# 3A.1 语法分析简介

{% hint style="info" %}
本章将简略地介绍语法分析的理论知识，以便让读者对文法、CFG、LALR 等描述编译器语法分析的专业术语有清晰的认识。但本章知识对于学习 Go 的语法解析器并不是必须的，不感兴趣的读者可以直接跳过直接进入[Golang 编译器 - 语法分析](/3.-golang-bian-yi-qi-yu-fa-fen-xi/3.1-jian-jie.md)一章。
{% endhint %}

经过词法扫描，编译器获得了一个 Token 流，语法分析会解析这些 Token 所代表的程序结构信息，并根据程序语言的文法规则，将 Token 流构造成一颗抽象语法树（Abstract Syntax Tree），简称 AST。

AST 是编译阶段的重要数据结构，也是很多后续的操作的基础。


---

# 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://gocompiler.shizhz.me/3.b-yu-fa-fen-xi-li-lun-zhi-shi/3.1-yu-fa-fen-xi-jian-jie.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.
