Skip to content

Instantly share code, notes, and snippets.

@brendanberg
Last active July 5, 2021 22:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendanberg/4601354 to your computer and use it in GitHub Desktop.
Save brendanberg/4601354 to your computer and use it in GitHub Desktop.
How to tell a computer what to do using words instead of numbers.

Sometimes we want to tell computers what to do. People like using words to tell people or things what to do. But computers don't understand words in this way. Instead, they understand numbers that tell them what to do. So we need to tell computers what the words mean as numbers. This is an easy story that tells how we can do that (but doesn't tell in fine points).

To tell computers what words mean as numbers, we can write words that change other words into numbers. To do this, we need to decide what words we can use and what orders we can use them in. Then we need to tell the computer what to do with these words.

Even though a computer can't read words that tell it what to do, it can see if one word is the same as another word. It can do this for one word after another after another. We can tell the computer what words are allowed to follow earlier words. And we can give these groups of words names. Some groups of words can have other named groups of words inside them. Some words by themselves have names without space for other groups of words inside.

As the computer gives the groups of words names, and puts new groups of words inside earlier groups, the computer ends up with one named group of words that has all the other named groups of words inside it. If you drew each named group of words joined to the named groups of words inside them, and so on until you reach the names that have no space inside them for other groups of words, it would kind of look like a tree.

If we tell the computer what each name means in numbers, it's easy for the computer to move through the tree in the right order and change each named group of words into the numbers that tell the computer what to do. That is how we can change words that people use for telling what to do into numbers that computers understand as things to do.

You might ask how we can tell the computer how to do all of this without going mad from telling the computer only numbers. Think about the story I just told that changes words into the numbers that computers understand. The amazing thing is we can tell the story to the story and get the numbers of the story instead of the words of the story! It might sound crazy, but we just build bigger stories on top of smaller stories until we can tell the computer the stories that are easy to tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment