๐Ÿ—ฃ๏ธ

Languages

Part 1: High Level vs. Low Level Languages

  1. Many programming languages you have used are high level languages. This means that their source code is made up of semantics (e.g. words and symbols) that are easy for humans to understand and learn to write.
  2. Computers are electronic devices that process information using binary code (aka machine code). This is an example of a low level language.
  3. When a program runs, the high level code must be translated into low level code in order for the computer's hardware to process it.
image

๐Ÿ”  High Level Languages

A high level language contains human readable words and is used to create source code.

e.g Python, Java, Ruby

๐Ÿ”Ÿ Low Level Languages

A low level language contains machine code (such as binary). Low level language is closer to a computer's instruction set.

e.g. binary code, machine code

๐Ÿ‘จโ€๐Ÿ’ป Easier for humans to read and understand - contains human-oriented words / words that are closer to natural language.

๐Ÿ—ฃ๏ธ Before execution, must be translated to low level language in order to be executed - can take up time and resources such as memory.

๐Ÿ’ป The same code works on different processors (any processor must translate it into machine code before processing).

๐Ÿ”ก One high level command can represent multiple instructions (e.g. print() or a function).

๐ŸŽฎ In-depth knowledge of the computer's architecture (how is processes and stores information) is not needed in order to program - that's the processor's job.

๐Ÿ‘จโ€๐Ÿ’ป Difficult for humans to read / understand as it contains binary code. A human would have to memorise these in order to write in this language.

๐Ÿ—ฃ๏ธ Execution is quick as translation is not necessary: low level languages are written in the same language that the processor computes / understands.

๐Ÿ’ป Each low level language is written specifically for a CPU's architecture and won't work on other CPU's.

๐Ÿ”Ÿ One command represents one instruction. ๐ŸŽฎ Programming in low level language gives the programmer access to commands that have more control over what the CPU does and how it uses memory

Part 2: Translators

  1. Computers are electronic devices that process information and instructions written in binary code (aka machine code). Machine code is an example of a low level language.
  2. Programmers program using high level language, source code that is made up of human-based semantics (e.g. words and symbols) that is easier to read and learn.
  3. For a computer to run high level source code, a translator translates each high level programming statement into low level instructions that the CPU can process.

A translator turns high level source code into low level machine code. There are two types:

Interpreter

A 10-course tasting menu

1๏ธโƒฃ Translates one line of source code at a time

โŒ Does not create an executable file that can run on its own

โ‰๏ธ Returns the first error it finds and stops interpreting further (which is useful for debugging!)

๐ŸŒ Programs run more slowly as the code is being translated at the same time as it is being executed

Compiler

A takeaway McDonald's order

โ™พ๏ธ Translates all source code at the same time, once

โ˜‘๏ธ Creates an executable file that can be exported/imported

๐Ÿงพ Returns a list of errors for the entire program, once, when the entire program has finished compiling

๐Ÿ† Compiled code runs quickly, but the compiling process might take a long time