Download presentation
Presentation is loading. Please wait.
1
10 -6
2
Software Language Levels Machine Language (Binary) Assembly Language –Assembler converts Assembly into machine High Level Languages (C, Perl, Shell) –Compiled : C –Interpreted : Perl, Shell
3
Compilation Convert Source to Object SUM = A + B Compiles to Machine language of: LDR R1, A LDR R2, B ADD R1, R1, R2 STR R1, C
4
Some Terms Source –The language program was written in Object –The machine language equivalent of the program after compilation Compiler –A software program that translates the source code into object code –Assembler is a special case of compiler where the source was written in Assembly language
5
Programming Steps for Compilation Create/Edit source Compile source Link object modules together Test executable If errors, Start over Stop
6
Example: Good Morning Use text editor to create source file print.c: #include int main() { printf(‘’Good Morning\n’’); return 0; }
7
Compilation process: Invoke compiler on source program to generate machine language equivalent Compiler translates source to object Saves object output as disk file[s] Large Systems may have many source programs Each has to be compiled
8
Link object modules together Combine them together to form executable Take multiple object modules LINKER then takes object module(s) and creates executables for you –Linker resolves references to other object modules –Handles calls to external libraries –Creates an executable
9
Interpretation No linking No object code generated Source statements executed line by line
10
Steps in interpretation Read a source line Parse line Do what the line says –Allocate space for variables –Execute arithmetic opts etc.. –Go to back to step 1 Similar to instruction cycle
11
Example: Good Morning Perl script: print.pl print ‘’Good Morning\n’’; Shell script print.sh echo ‘Good Morning\n’;
12
Compilation Advantages Faster Execution Single file to execute Compiler can do better diagnosis of syntax and semantic errors, since it has more info than an interpreter (Interpreter only sees one line at a time) Compiler can optimize code
13
Compilation Disadvantages Harder to debug Takes longer to change source code, recompile and relink
14
Interpreter Advantages Easier to debug Faster development time
15
Interpreter disadvantages Slower execution times No optimization Need all of source code available Source code larger than executable for large systems
16
Some Interpretive Systems Languages –BASIC, Perl, Lisp OS Interfaces –C Shell, Bourne Shell –WINEXEC
17
Conclusion Many different ways of developing systems There is always a tradeoff between system development time, testing, debugging and performance, support etc.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.