Programming Language Basics: A Comprehensive Guide
Programming Language Basics
Introduction to Macros
A macro is a written instruction in a language different from Assembler or machine language. Through a translation process, it is converted into a set of machine language instructions that perform a specific action.
Language Classifications
High-Level Languages
4th Generation (Declarative)
These modern languages resemble formal languages in expressive power and functionality. They specify “what to do” rather than “how.”
3rd Generation
These languages are programmer-oriented and offer:
- Easy readability and understanding
- High portability (machine independence)
- Fast programming (thanks to macros)
Medium-Level Languages
These languages combine features of 3rd generation high-level languages with access to machine architecture, offering the potential of low-level languages with the ease of high-level ones.
Classification by Application
- Advisory
- Data Processing
- Word Processing
- Artificial Intelligence
- Systems Programming
Basic Elements of a Programming Language
Characters
These basic symbols form more complex syntactic structures. Natural languages have alphabets with letters (uppercase and lowercase), digits, and special characters (e.g., , : ;). These symbols have agreed-upon meanings. Computer languages also have character sets.
Multiple-Character Basic Symbols (Keywords)
These reserved words have specific, unambiguous meanings recognized by the translator. Programmers must use them correctly.
Syntactic Structures
These elements are formed from basic symbols at different complexity levels.
1. Values
Values represent numbers, logical results, and other situations.
- Numerical Values: Incorporate digits and special characters (+, -, ., etc.) governed by algebra.
- Logical Values: Represented by true or false and governed by Boolean algebra.
2. Identifiers (Symbolic Names)
Formed by letters and digits (starting with a letter, except in COBOL), identifiers represent variables, arrays, procedures, and subprograms.
3. Tags
Used to mark instructions for branching program execution.
4. Strings
Character sets with no specific meaning to the compiler, used for messages and headers in output.
Expressions
Larger syntactic units formed from basic symbols and elements. They define the calculation of outcomes:
- Numeric: Arithmetic expression
- Logical: Boolean expression
- Label: Designation expression
- String: String expression
Simple Arithmetic Expressions
These expressions follow algebraic structure and meaning, using mathematical notation similar to natural language with some syntax differences.
Boolean Expressions
These expressions determine the evaluation of a specified condition.
Statements
Consecutive instructions describing an algorithm, executed sequentially unless otherwise specified.
- Allocation: Evaluating and storing a calculated value.
- Bifurcation: Branching to a different instruction.
- Test/Decision: Evaluating a value to make a decision.
- I/O: Input/Output operations.
Allocation Statements
Evaluating an expression and storing the value in a symbolic address.
Bifurcation Statements (e.g., GO TO)
Modifying the sequential execution of instructions.
Test/Decision Statements (Conditional)
Making decisions based on the result of a test (true or false).