A clear syntax definition: syntax is the set of rules and patterns for arranging words and phrases into sentences that make sense in a language. "The dog chased the cat" and "The cat chased the dog" use the same words, but the syntax, the order and structure, changes who does what.
The word also has a big second life in computing, where syntax means the exact rules for writing instructions a program can read. Miss a bracket and you get a syntax error. Writers, teachers and coders all use the term, and this page covers each use with examples.
Entry at a glance
Meaning
The arrangement of words in sentences; the rules for writing codePart of speech
Noun (plural: syntaxes)Pronunciation
SIN-taksWord forms
syntactic or syntactical (adjective), syntactically (adverb)Origin
Late Latin syntaxis, from Greek syntassein, "to put in order"; English around 1600Related terms
grammar, semantics, morphology, word orderRegister
Neutral to technical; used in linguistics, writing and programming
What syntax means in language
Syntax answers questions like: Which word comes first? Where does the verb go? How do you join two ideas into one sentence? Every language has its own answers.
- Word order: English usually puts subject, then verb, then object: "Priya (subject) baked (verb) a cake (object)." Japanese usually puts the verb at the end.
- Building phrases: adjectives normally come before the noun in English ("a red car"), but after it in French ("une voiture rouge").
- Forming questions and negatives: English adds helper verbs: "Do you know?", "I do not know."
- Joining clauses: words like because, although and which link smaller parts into longer sentences.
The parts syntax arranges are the word classes you meet in school, such as nouns, verbs and adjectives.
Syntax vs grammar vs semantics
| Term | Covers | Example question |
|---|---|---|
| Syntax | How words are ordered and combined into sentences | Is "Quickly the bus she caught" a normal sentence? |
| Morphology | How words themselves are built from parts | Why is it "walked" but "ran"? |
| Grammar | The whole system, including syntax and morphology | Is this sentence correct English? |
| Semantics | What words and sentences mean | What does this sentence say about the world? |
A sentence can have perfect syntax and still make no sense, like "The purple idea slept loudly". It can also be meaningful but badly built, like "Me hungry very". Syntax is about the structure; semantics is about the meaning.
The syntax definition in programming
In computing, syntax is the strict set of rules for how code must be written: which words, symbols, brackets, commas and spacing a language accepts. Human readers can forgive a missing comma. Computers usually cannot.
Each programming language has its own syntax, which is why code from one language rarely works in another without changes. The term moved into computing in the 1950s.
Syntax in example sentences
- The poet bends normal syntax to put the most important word last.
- My code would not compile because of a single syntax error on line twelve.
- In the linguistics course we drew tree diagrams to show sentence syntax.
- Her emails are clear because her syntax is simple and direct.
- The new spreadsheet formula uses a slightly different syntax from the old one.
How writers use syntax
In literature classes, a writer's syntax means their sentence style: long and winding, or short and sharp; plain order, or unusual order for effect. Teachers ask students to comment on syntax when analysing prose and poetry. Short sentences can create tension. Long ones with many clauses can feel calm, crowded or breathless. Inverted order, such as "Gone were the days of easy summers", adds drama.
Diction is the writer's choice of words; syntax is how those words are arranged. Together they create tone.
Origin of the word syntax
Syntax entered English around 1600 with the general sense of a systematic arrangement of parts. Within a decade or two, writers had narrowed it to the ordering of words in sentences. It came through French syntaxe and Late Latin syntaxis from Greek syntassein, "to put in order", made of syn- (together) and tassein (to arrange). The military word tactics shares the same Greek root, which fits: both are about putting things in the right order. See more terms in grammar and writing.
Frequently asked questions
How would you define syntax for a beginner?
Syntax is the order and structure of words in a sentence. It decides whether a group of words reads as a normal sentence and who is doing what to whom.
What is an example of syntax?
"She gave her brother a book" follows standard English syntax. "Book a brother her gave she" uses the same words but breaks the syntax, so it no longer reads as a sentence.
How do you pronounce syntax?
SIN-taks. Put the weight on SIN; the whole word rhymes with "tin tax".
What is a syntax error?
An error in the form of code, such as a missing bracket or misspelled keyword, that stops a program from running. In writing, people sometimes use it jokingly for a clumsy sentence.
Is syntax the same as grammar?
No. Syntax is one part of grammar, the part about sentence structure. Grammar also includes how words change form, such as plurals and verb tenses.
Which adjective goes with syntax?
Syntactic, as in "syntactic rules" or "a syntactic error". Syntactical is also used, with the same meaning.