How are programming languages related to hardware?

How do hardware components work on the lowest level?

2 states: 1 | 0

How do we express instructions and data?

We represent all these in binary, known as Machine Language / Object code

How do we decide what languages to use?

Ease of expression for hardware -> Natural language, high level language, assembly language, machine language <- Ease of expression for humans

What are the tools used to convert languages to other languages?

  • Translator Accepts a program written in a source language -> translates it to a program in a target language

  • Compiler Standard name for a translator whose source language is a high-level language

  • Interpreter A translator that translates & executes a source program

What processes does a high level compiled program go through to get executed on the machine?

  • EDITOR Edit program ->

  • COMPILER SUITE (Compilation errors get thrown here) Compile to assembly -> Assemble to machine language -> link multiple machine language programs into one executable ->

  • OS (Runtime errors, logic errors thrown here) load executable into computer memory -> Execute executable

Examples: Java, Haskell

What processes does a interpreted program go through

  • EDITOR Edit program ->

Per code statement:

  • INTERPRETER Compile, assemble, link -> Load, execute

Examples: Javascript, python

What processes does a program on a VM go through?

  • EDITOR Edit program ->

  • COMPILER Compile, assemble, link ->

  • VM Load, execute ->

  • OS Load, execute

What processes does a C program go through?

Same as a compiled program

During compiling process we use gcc to compile, do linking and assemble to assembly