COS1521 - Computer Systems: Fundamental Concepts (COS1521)
Institution
University Of South Africa (Unisa)
Hi Everyone, I hope that exam studying is going great for you. I compiled summaries from the textbook for each chapter so you dont need too. I work very hard on these and added multiple diagrams as well. I study at UNISA and I am not a huge fan of theory so this makes it easy for me to study just w...
COS1521 - Computer Systems: Fundamental Concepts (COS1521)
All documents for this subject (16)
1
review
By: tjmahlatji • 4 year ago
Seller
Follow
examsummaries29
Reviews received
Content preview
Chapter 9 Programming Languages
To write a program for a computer, we must use a programming language. A computer language is a
set of predefined words that are combined into a program according to predefined rules.
Machine Languages
These are the programming languages available at an earlier stage. Made up of streams of 1’s and
0’s. The only language understood by the computer is machine language. Machine language has two
drawbacks. First, it is machine dependant. Second, it is very tedious to write programs in this
language and even more difficult to spot errors.
Assembly Languages
This is the next evolution, it replaces binary code with instructions and address with symbols or
mnemonics(also known as symbolic languages). An assembler is used to translate this into machine
language. Ex STORE Number1 RF means Store Register F into Number 1
High Level Languages
Assembly languages greatly improved programming efficiency but they still required programmers
to concentrate on the hardware they were using. There was a desire to improve efficiency and
change focus from the computer to the problem being solved. These are portable so the
programmer can focus on the program and not the computer. This language is easier for a human to
understand.
Translation
This is the method to convert higher level languages into machine language so that the computer
can understand the code. There are two types: compilers and interpreters.
- Compilers: translate the whole source program into the object program.
, - Interpreters: translates each line of the source program into the corresponding line of object
program and executing the line.
Translation Process:
- Lexical Analyzer: reads source code, symbol by symbol and creates a list of tokens in the
source language. Ex C, C++, Java
- Syntax Analyzer: Parses a set of tokens to follow instructions Ex
- Semantic Analyzer: Checks sentences created by the syntax analyser making sure of no
ambiguity.
- Code generator: Instructions are converted to a set of machine language instructions for the
computer
Programming Paradigms: Programming Languages approach they use to solve a problem
Procedural Paradigm: In the procedural paradigm (or imperative paradigm) we can think of a
program as an active agent that manipulates passive objects. We encounter man y passive objects in
our daily life: a stone, a book, a lamp, and so on. A passive object cannot initiate an action by itself,
but it can receive actions from active agents. A program in a procedural paradigm is an active agent
that uses passive objects that we refer to as data or data items. To manipulate a piece of data, the
active agent (program) issues an action, referred to as a procedure.
Examples: FORTRAN, COBOL, Pascal, C, Ada
- FORTRAN: Designed by a group of IBM engines under Jack Backus in 1957.
, - COBOL: Designed by a group of computer scientists under Grace Hopper of US Navy
- Pascal: Invented by Niklaus Wirth in 1971, named after Blaise Pascal
- C: Developed by Dennis Ritchie at Bell in 1970
- Ada: Named after Augusta Ada Byron, Assistance to Charles Babbage. Made for the US
Department of Defence
Object Oriented Paradigm: Deals with active objects instead of passive objects
- Classes are used to for a set of methods to react to outside stimuli
- Methods
- Inheritance
- Polymorphism: Meaning many forms. Treat several operations with the same name that can
do different things in related classes.
- Examples: C++ & Java
- C++: Bjarne Stroustup at Bell to improve C
- Java: Developed by Sun microsystems. Based on C & C++. Supports multithreading.
Functional Paradigm: Considered a mathematical function.
- Examples: LISP & Scheme
- LISP: Designed by a team of researchers at MIT in early 1960s.Everything is considered a list
- Scheme: a standardised version of LISP made by MIT in 1970s
Declarative Paradigm: Uses principle of logical reasoning to answer queries
- Based on deduction
- PROLOG is an example: Developed by A. Colmerauer in France 1972 Made up of facts &
Rules.
Common Concepts
- Identifiers: The name of objects.
- Data Types: A set of values and operations that can be applied to those values.
Simple: Cannot be broken into smaller data types. Have been defined in imperative
languages:
Integer – Whole number
Real – Number with fraction
Character – Symbol type
Boolean – True or false
Composite: Set of elements in which each element is a simple type or composite type:
Array: Set of elements each of the same type
Record: Set of elements in which element can be of different type
- Variables: The names for memory locations. (Initialization stores a value in a variable and
declaration sets a variable with a given name and type.
- Literals: A predetermined value used in a program
- Constants: A constant is similar to a variable but the value cannot be changed.
- Input:
- Output:
- Expressions: A sequence of operands and operators that reduce to a single value.
Operators(a language specific token that requires an action to be taken)
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller examsummaries29. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $9.08. You're not tied to anything after your purchase.