UNIHIVE

Study Hub UNIPORT CSC 280

CSC 280 · Introduction to Computer Programming

Programming languages, translators and errors

Machine, assembly and high-level languages, compilers and interpreters, how a program is built and run, and the three kinds of errors.

Our notes

2 min read

Generations of languages

GenerationExampleNotes
1st: machine language10110000 01100001binary, runs directly, specific to one processor
2nd: assembly languageMOV AL, 61hshort words (mnemonics), needs an assembler
3rd: high-level languagesFORTRAN, C, Java, PythonEnglish-like, portable
4th: very high-levelSQL, report generatorssay what you want, not how
5th: logic/AI languagesPrologsolve problems from rules and facts

Famous high-level languages

  • FORTRAN (FORmula TRANslation, 1957): science and engineering maths.
  • COBOL (1959): business records.
  • BASIC: teaching beginners.
  • C (1972): operating systems, fast programs.
  • Java, C#: large applications, Android (Java/Kotlin).
  • Python (1991): simple syntax, data science, AI, automation, now the most common teaching language.
  • JavaScript and PHP: websites (UniHive itself is written in PHP).

Translators

A computer runs only machine code, so other code must be translated.

TranslatorWhat it does
Assemblerassembly → machine code
Compilertranslates the whole program into machine code first (object code), then it runs; fast to run; reports all errors after compiling (C, FORTRAN)
Interpretertranslates and runs one statement at a time; slower, but easy to test; stops at the first error (Python, BASIC)

Source code is what the programmer writes; object code is the translated version; a linker joins object code with library code into an executable; a loader puts it in memory to run.

Three kinds of errors

ErrorWhen foundExample
Syntax errorwhen translating`prnt("hi")`, a missing bracket or colon
Run-time errorwhile running, program crashesdividing by zero, opening a file that is not there
Logic errorprogram runs but gives wrong answerswriting `avg = a + b / 2` instead of `avg = (a + b) / 2`

A first Python program

name = input("Your name: ")
print("Hello,", name)
The first line shows a prompt and stores what the user types; the second prints a greeting.

Integrated development environments (IDEs)

An IDE puts an editor, translator and debugger together: IDLE, Thonny and VS Code for Python; Code::Blocks for C and FORTRAN. On a phone, apps like Pydroid 3 run Python offline, useful when the lab is full.

Exams usually ask: generations of languages; compiler vs interpreter; define source code, object code, linker, loader; the three kinds of errors with examples.

Common mistake: saying a program with no syntax errors is correct. Logic errors are only found by testing with known answers.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All CSC 280 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.