# grammar

[JS](https://lochiwei.gitbook.io/web/js) ⟩ grammar

{% hint style="success" %}
:u6307: synonyms：<mark style="color:purple;">**lexical grammar**</mark>

the set of <mark style="color:yellow;">**elementary rules**</mark> 🚧 that specifies how you write programs.
{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}

* [token](https://lochiwei.gitbook.io/web/js/grammar/token "mention")
  * [keyword](https://lochiwei.gitbook.io/web/js/grammar/token/keyword "mention")
  * [punctuator](https://lochiwei.gitbook.io/web/js/grammar/token/punctuator "mention")
  * [id](https://lochiwei.gitbook.io/web/js/grammar/token/id "mention")
  * [literal](https://lochiwei.gitbook.io/web/js/grammar/token/literal "mention")
* [comment](https://lochiwei.gitbook.io/web/js/grammar/comment "mention")
* [declare](https://lochiwei.gitbook.io/web/js/grammar/declare "mention")
* [statement](https://lochiwei.gitbook.io/web/js/grammar/statement "mention")
  {% endtab %}

{% tab title="⭐️ 重點" %}
{% hint style="info" %} <mark style="color:yellow;">**JS code：**</mark>

* <mark style="color:orange;">**case-sensitive**</mark>
* <mark style="color:orange;">**ignores whitespaces**</mark> (some exceptions for <mark style="color:red;">**line breaks**</mark>).
  {% endhint %}
  {% endtab %}

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

* (2020) JavaScript The Definitive Guide (Ch. 2).
  {% endtab %}

{% tab title="📘 手冊" %}

* [Lexical grammar](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar)
* ECMA ⟩ [Lexical Grammar](https://262.ecma-international.org/13.0/#sec-ecmascript-language-lexical-grammar) ⟩&#x20;
  * [5.1.2 The Lexical and RegExp Grammars](https://262.ecma-international.org/13.0/#sec-lexical-and-regexp-grammars)
  * [12.6.2 Keywords and Reserved Words](https://262.ecma-international.org/13.0/#sec-keywords-and-reserved-words) ⭐️
  * [12.7 Punctuators](https://262.ecma-international.org/13.0/#sec-punctuators)
    {% endtab %}

{% tab title="🚧" %}
{% hint style="warning" %}
what are elementary rules?
{% endhint %}
{% endtab %}
{% endtabs %}
