-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zh-CN: create Glossary/Syntax (#22231)
Co-authored-by: Jason Ren <[email protected]>
- Loading branch information
1 parent
d778bc4
commit f2230b4
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: 语法 | ||
slug: Glossary/Syntax | ||
l10n: | ||
sourceCommit: ada5fa5ef15eadd44b549ecf906423b4a2092f34 | ||
--- | ||
|
||
{{GlossarySidebar}} | ||
|
||
语法指定了组成正确结构代码所需的{{Glossary("character", "字符")}}的组合和顺序。语法通常包括语法规则和适用于书写的规则,例如 Python 中的缩进要求。 | ||
|
||
语法因语言而异(例如,{{Glossary("HTML")}} 和 {{Glossary("JavaScript")}} 的语法不同)。尽管语言在语法方面可能有一些相似之处,比如 JavaScript 和 Python 语言都有一条“操作数 运算符 操作数”语法规则,但这并不意味着两种语言的语法相似。 | ||
|
||
语法既适用于编程语言(对计算机的命令),也适用于标记语言(文档结构信息)。 | ||
|
||
语法只管顺序和结构;指令还必须*有意义*,这就是{{Glossary("semantics", "语义")}}的范畴。 | ||
|
||
代码必须符合正确的语法才能正确{{Glossary("compile", "编译")}},否则会出现{{Glossary("syntax error", "语法错误")}}。即使是小错误,比如缺少一个括号,也会导致源代码无法成功编译。 | ||
|
||
如果框架具有“干净”的语法,则表示它们生成简单、可读、简洁的结果。如果代码库使用“很多语法”,则意味着它需要更多字符来实现相同的功能。 | ||
|
||
## 参见 | ||
|
||
- 维基百科上的[语法](<https://en.wikipedia.org/wiki/Syntax_(programming_languages)>) |