Course Note 4
Course Note 4
The specification and translation of a programming language involve defining the rules and
syntax of the language and then transforming the code written in that language into executable
machine code or an intermediate representation that can be executed by a computer.
Syntax and Semantics: A programming language's specification defines its syntax (the
structure and grammar of valid language constructs) and semantics (the meaning of those
constructs).
Language Features: It outlines the available data types, control structures (loops,
conditionals), functions or procedures, and other elements within the language.
Translation Process: A compiler translates the entire source code into an executable or
an intermediate form (like bytecode). It typically includes several stages: lexical analysis
(breaking code into tokens), syntax analysis (parsing the code structure), semantic
analysis (checking semantics and generating intermediate code), optimization, and code
generation.
Output: The result is an executable file or bytecode that can be run on the target
platform.
Interpreter:
Line-by-Line Execution: An interpreter translates and executes the code line by line or
statement by statement without producing a separate compiled output.
Execution Process: It reads each line, interprets it, and executes the corresponding
operations immediately without creating a compiled version beforehand.
Assembler: Is a Low Level Language translator. It translate symbolic codes and symbolic
address into actual machine addresses. It is less time consuming because it is machine orientd.
Just-In-Time (JIT) Compilation:
Hybrid Approach: Some systems use JIT compilation, where code is initially
interpreted but then compiled into native machine code for performance improvements
during execution.
Both compilers and interpreters play crucial roles in the translation process, converting human-
readable code into a form that computers can understand and execute. The choice between
compilers and interpreters often depends on factors like performance, development speed, and
the target environment of the programming language.
Computer Architecture is concerned with the way hardware components are connected together
to form a computer system. It deals with design of computers, data storage devices and
networking components that store and run programs, transmit data and drive interaction between
computers across networks and with users.
Computer organization is concerned with the structure and behavior of a computer system as
seen by the user. It act as the interface between hardware and software of a connection in
a system.
It also deals with the structural relationship that are not visible to the programmers such
as interfaces to peripherals device, the clock frequency and the technology used for the
memory. It is also internal working storage structure and implementation of a computer
system. 31/2mks