> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/concept/parser.md).

# parser

[JS](/web/js.md) ⟩ [concept](/web/browser/concepts.md) ⟩ parser

{% hint style="success" %}
A *<mark style="color:purple;">**parser**</mark>* is a <mark style="color:yellow;">**program**</mark> that&#x20;

* <mark style="color:yellow;">**reads a piece of text**</mark> and <mark style="color:yellow;">**produces a**</mark> [**data structure**](/web/appendix/data.md) that reflects the structure of the program contained in that text.&#x20;
* if the text <mark style="color:yellow;">**does**</mark>**&#x20;**<mark style="color:red;">**not**</mark>**&#x20;**<mark style="color:yellow;">**form a**</mark>**&#x20;**<mark style="color:red;">**valid**</mark>**&#x20;**<mark style="color:yellow;">**program**</mark>, the parser should <mark style="color:yellow;">**point out the**</mark>**&#x20;**<mark style="color:red;">**error**</mark>.
  {% endhint %}

{% tabs %}
{% tab title="💈範例" %}

* [Language: Egg](/web/js/proj/lang.md)
  {% endtab %}

{% tab title="📗 參考" %}

* [ ] Eloquent JS ⟩ [Project: A Programming Language](https://eloquentjavascript.net/12_language.html) ⟩ [Parsing](https://eloquentjavascript.net/12_language.html#h_cpTTNxAWkQ)
  {% endtab %}
  {% endtabs %}
