1.2 Language Processing Activities The fundamental language processing activities divided into two...
-
Upload
shawn-poole -
Category
Documents
-
view
556 -
download
15
Transcript of 1.2 Language Processing Activities The fundamental language processing activities divided into two...
![Page 1: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/1.jpg)
1.2 Language Processing Activities
• The fundamental language processing activities divided into
two parts.
1. Program generation activities
2. Program execution activities
[Prog. Generation] [Prog. Execution]
Specification Gap Execution GapApplication PL ExecutionDomain Domain Domain
1
![Page 2: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/2.jpg)
Language Processing Activities
• A program generation activity aims to generation of a
program. Source is the application domain and target is
the PL domain. It bridges specification gap.
• A program execution activity aims to execute a program
written in PL. source is PL domain and target is
execution domain. It bridges execution gap.
2
![Page 3: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/3.jpg)
1. Program Generation
• The program generator is a software system which
accepts the specification of a program to be generated and
generates program in a the target PL.
• This activity is done by program generator domain.
Program
Specification
Program
Specification
Program
Generator
Program
Generator
Program
in target PL
Program
in target PL
ErrorsErrors
3
![Page 4: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/4.jpg)
1. Program Generation
• The generator domain is close to the application domain, it is
easy for the designer or programmer to write the specification
of the program to be generated.
• A program generator is software that enables an individual to
create a program with less efforts and prog. Knowledge.
• A user may only be required to specify the step or rules
required for the program and not need to write and code or
less code.
4
![Page 5: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/5.jpg)
2. Program Execution
• Two popular models for program execution are:
1. Program Translation
2. Program Interpretation
5
![Page 6: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/6.jpg)
2.1 Program Translation
• The program translation model bridges the execution
gap by translating a program written in a PL called
source program(SP), into an equivalent program in the
machine language called target program(TP)
Source
Program
Source
Program
TranslatorTranslator Target
Program
Target
Program
ErrorsErrors
m/c language
program
m/c language
program
6
![Page 7: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/7.jpg)
2.1 Program Translation
• Characteristics of the program translation model are: A program must be translated before it can be executed. The translated program may be saved in file. The saved
program may be executed repeatedly. A program must be retranslated following modifications.
7
![Page 8: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/8.jpg)
2.2 Program Interpretation
• It reads the source program and stores it in its memory.
• During interpretation it takes a source statement,
determines its meaning, and performs actions like
computation and I/O which implement it.
8
![Page 9: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/9.jpg)
2.2 Program Interpretation
• In the program interpretation, the CPU use a program
counter(PC) to note the address of the next instruction to
be executed. This instruction is subjected to the
instruction execution cycle consisting following step:
1. Fetch the instruction
2. Decode the instruction to determine the operation to be
performed.
3. Execute the instruction.
9
![Page 10: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/10.jpg)
2.2 Program Interpretation
• At the end of the cycle. The PC is updated and the cycle
is repeated for the next instruction.
• Thus, the PC can indicate which statement of the source
program is to be interpreted next.
PCPC Source
Program
+
Data
Source
Program
+
Data
InterpreterInterpreter
ErrorsErrors
PCPC M.L.
Program
+
Data
M.L.
Program
+
Data
CPUCPUMemoryMemory MemoryMemory
10
![Page 11: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/11.jpg)
MCQ
• The _________ is a software system which generates a program in the target PL.
A. Program GeneratorB. Program SpecificationC. Program ExecutionD. program Interpretation
![Page 12: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/12.jpg)
MCQ
• The _________ is a software system which generates a program in the target PL.
A. Program GeneratorB. Program SpecificationC. Program ExecutionD. program Interpretation
![Page 13: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/13.jpg)
MCQ
• the CPU use ___________ to note the address of the next instruction to be executed.
A. program counter(PC)
B. Pretty printer
C. static checker
D. None
![Page 14: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/14.jpg)
MCQ
• the CPU use ___________ to note the address of the next instruction to be executed.
A. program counter(PC)
B. Pretty printer
C. static checker
D. None
![Page 15: 1.2 Language Processing Activities The fundamental language processing activities divided into two parts. 1. Program generation activities 2. Program execution.](https://reader036.fdocuments.in/reader036/viewer/2022071708/56649d825503460f94a671a0/html5/thumbnails/15.jpg)
MCQ
• The Program generator _______ to convert _________• The _________ fetch, decode and execute instruction