Skip to main content Link Menu Expand (external link) Copy Copied

Syntax vs semantics

Before we set off it’s probable best to have a look at what I will be referring to when I use these terms.


Perhaps translated as The language that makes a computer understand. This is the code itself, the structures and design/coding patterns you use.


Translates to the language that makes a human understand. This is the language you create by using syntax. Luckily most programming languages leave a lot of room for you to perform this task. Variables, functions, classes and modules can have a that is chosen by you! Structures can be made to support the story you are trying to tell.

so… syntax vs semantics?

Let’s take it from a very low level point of view. Assembly languages are very powerful as a syntax, where likely nothing is impossible to program (as long as the computer is capable of doing it). However, it is VERY hard to understand as a human. It offers little opportunity for providing semantics: you’re always looking into tiny details without ever getting an overview. Variables or functions can’t be named, classes don’t exist, etc. This means you are limited in your expression.

On the other side of the spectrum we have most modern programming languages where a lot of tiny details have been wrapped into meaningful chunks called “the standard api/library”. These programming languages have created a new syntax on top of more detailed, low level syntax. In those terms these programming languages and their libraries can be considered a new semantic language!

So instead of trying to understand operations at the opcode level, you are now greeted with very human friendly concepts called new List() or console.log()

Is a programming language’s base syntax the only language I can use to create semantics?

No! Just like a new programming language is hiding harder to lower level details in new shiny names and structures, so can you! You have the ability to add semantic layers, one by one, until it’s very easy for a human to understand what you mean to achieve! A single one of those layers can be called “a single layer of abstraction” (a high level example of that in action can be found here)

In essence, by creating a higher level syntax you increase the ease at which a human can understand the code by adding semantic meaning. You are creating the Missing language

Below is a very normal layering of syntaxes, all to make it easy for humans to understand and change the code to suite the business:

- Assembly language
- C++ language (and standard library)
- Java language (and standard library)
- added syntax and semantics from your favorite library
- very detailed business code for low level concepts
- ...
- less detailed business code for medium level concepts
- ...
- not-detailed business code for high level concepts

You can see how it bridges the gap between what a computer can understand in bits and bytes and what a human can understand in business concepts. You should also note that your codebase will have an arbitrary number of extra syntax layers. This varies a lot with complexity of your business domain. Without a proper example this might not make a huge amount of sense, I’ll come to that shortly. (work in progress). A smaller basic example can be found in this experiment, where we start with human-readable text and transform it into code

We can also continue the list above with modules and architecture components, but they behave a little different in terms of adding semantics. This is a subject for a different article all together.