Introduction to Programming

Module 1 · Introduction to Programming · Lesson 3 of 7

What makes a language

Whether it's English or Python, every language is built from the same four layers. Start with an alphabet of allowed symbols, combine those into a vocabulary of words, arrange the words using syntax rules, and the result carries meaning. Watch one Python statement come together layer by layer.

  1. Alphabetthe symbols you may use
  2. Lexissymbols grouped into words
  3. Syntaxwords arranged by the rules
  4. Semanticswhat it actually means
print("Hi")✓ valid
prints Hi

The alphabet is every character you're allowed to type. The lexis is the set of real words — keywords like print, names, numbers and symbols. Syntax is the grammar: the rules for how those words may be put together. And semantics is what a correctly formed statement actually does.

Break a rule in any layer and it stops working: an unknown character, a misspelled word, or words in the wrong order. Python will tell you — which is exactly what the next two lessons are about.