Notes on Computer Languages
1. Introduction to Computer Languages
A computer language is a formal language used to communicate instructions to a computer.
It allows programmers to write code that the computer can execute.
Types of Computer Languages
1. Machine Language (1st Generation)
o Binary code (0s and 1s) directly understood by the CPU.
o Fast but difficult for humans to read/write.
2. Assembly Language (2nd Generation)
o Uses mnemonics (e.g., MOV, ADD) instead of binary.
o Requires an assembler to convert to machine code.
3. High-Level Languages (3rd Generation)
o Closer to human language (e.g., Python, Java, C++).
o Requires a compiler or interpreter to convert to machine code.
o Examples:
C (system programming, fast execution)
Python (easy syntax, general-purpose)
Java (platform-independent, "Write Once, Run Anywhere")
4. Fourth-Generation Languages (4GL)
o Designed for database and business applications.
o Example: SQL (Structured Query Language).
5. Fifth-Generation Languages (5GL)
o Used for AI and machine learning.
o Example: Prolog (logic programming).
2. Key Concepts in Programming Languages
A. Syntax vs. Semantics
Syntax: Rules for writing code (grammar).
o Example: In Python, print("Hello") is correct, but Print("Hello") is wrong (case-
sensitive).
Semantics: Meaning of the code (logic).
o Example: x = 5 + "10" (semantic error if language doesn’t allow adding numbers and
strings).
B. Compiler vs. Interpreter
Feature Compiler Interpreter
Converts entire code to machine language before Translates and executes line
Execution
execution. by line.
Speed Faster execution (after compilation). Slower (translates at runtime).
Debuggin Easier (errors shown line by
Harder (errors shown after compilation).
g line).
Examples C, C++, Java (partially compiled). Python, JavaScript, Ruby.
C. Paradigms of Programming Languages
1. Procedural Programming
o Follows step-by-step procedures (functions).
o Example: C, Pascal.
2. Object-Oriented Programming (OOP)
o Uses objects and classes (encapsulation, inheritance, polymorphism).
o Example: Java, Python, C++.
3. Functional Programming
o Focuses on mathematical functions (immutable data).
o Example: Haskell, Lisp, Python (supports functional features).
4. Scripting Languages
o Used for automating tasks.
o Example: Python, JavaScript, Bash.
3. Popular Programming Languages & Their Uses
Language Key Features Common Uses
Easy syntax, dynamic typing, large
Python AI, web dev, data science.
libraries.
Java Platform-independent, OOP. Android apps, enterprise software.
C/C++ Fast, low-level control. Game dev, OS, embedded systems.
Web development
JavaScript Runs in browsers, asynchronous.
(frontend/backend).
SQL Database query language. Data management, analytics.
4. Key Takeaways
Low-level languages (Machine, Assembly) are fast but hard to use.
High-level languages (Python, Java) are easier but need translation.
Compiled languages (C, C++) run faster than interpreted ones (Python).
Different paradigms (OOP, Functional) suit different tasks.
Would you like additional details on any specific language or concept? 😊