1 / 17

10 -6

10 -6. Software Language Levels. Machine Language (Binary) Assembly Language Assembler converts Assembly into machine High Level Languages (C, Perl, Shell) Compiled : C Interpreted : Perl, Shell. Compilation Convert Source to Object . SUM = A + B Compiles to Machine language of:

abby
Télécharger la présentation

10 -6

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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. CompilationConvert 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 Stepsfor 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<stdio.h> 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.

More Related