kb/data/developer.mozilla.org/en-US/docs/Glossary/Syntax-0.md

11 KiB

title chunk source category tags date_saved instance
Syntax - Glossary | MDN 1/3 https://developer.mozilla.org/en-US/docs/Glossary/Syntax reference web, html, css, javascript, documentation 2026-05-05T05:46:30.670450+00:00 kb-cron

MDN HTML HTML: Markup language

HTML reference

HTML guides

Markup languages

CSS CSS: Styling language

CSS reference

CSS guides

Layout cookbook

JavaScriptJS JavaScript: Scripting language

JS reference

JS guides

Web APIs Web APIs: Programming interfaces

Web API reference

Web API guides

All All web technology

Technologies

Topics

Learn Learn web development

Frontend developer course

Learn HTML

Learn CSS

Learn JavaScript

Tools Discover our tools

About Get to know MDN better

Blog

  1. Glossary
  2. Syntax

Syntax

Syntax specifies the required combination and sequence of characters making up correctly structured code. Syntax generally includes grammar and the rules that apply to writing it, such as indentation requirements in Python. Syntax varies from language to language (e.g., syntax is different in HTML and JavaScript). Although languages can share few similarities in terms of their syntaxes for example "operand operator operand" rule in JavaScript and Python. This does not mean the two languages share similarities with syntax. Syntax applies both to programming languages (commands to the computer) and markup languages (document structure information) alike. Syntax only governs ordering and structure; the instructions must also be meaningful , which is the province of semantics. Code must have correct syntax in order to compile correctly, otherwise a syntax error occurs. Even small errors, like a missing parenthesis, can stop source code from compiling successfully. Frameworks are said to have a "clean" syntax if they produce simple, readable, concise results. If a codebase uses "a lot of syntax", it requires more characters to achieve the same functionality.

In this article

See also