SlideShare uma empresa Scribd logo
1 de 5
Interpreter Vs Compiler




            By : Aya Yakout Alkhamese



                      Compiler
                           4th
Dept : Computer Science & Information Technology
    Faculty of Science – Portsaid Univeristy
• Interpreter Vs Compiler

 Programming languages can be divided into two major categories: low level and
  high level. “Assembly language” and “machine language” are called low-level
  languages because they more than others “speak” the language the computer
  understands. On the other hand, C, C++, Pascal,Python, Visual Basic, Java,
  and COBOL are high-level languages because they require more manipulation by
  the computer, a process called compiling.



    When writing programs in a high level language, the computer will not be able
    to understand it. So that it will be usable, you need to convert it into
    something that a computer understands. This is where compilers and
    interpreters come in as they both do the same function – convert a high level
    language (like C, Java) instructions into the binary form which is
    understandable by computer hardware. They are the software used to execute
    the high level programs and codes to perform various tasks. Specific
    compilers/interpreters are designed for different high level languages.
    However both compiler and interpreter have the same objective but they
    differ in the way they accomplish their task



 An interpreter :

 reads the source code one instruction or line at a time, converts this line into
  machine code and executes it. The machine code is then discarded and the next line
  is read. executing each line as it is "translated," much the way a foreign language
  interpreter would translate a book, by translating one line at a time.
 The interpreter takes one statement then translates it and executes it and then
  takes another statement.
 interpreter stops translating after the first error.
 Programming Steps for Interpretion :
                      •   Edit the Program
                      •   No linking
                      •   No object code generated
                      •   Source statements executed line by line
 The advantage of this is that :
                    • Interpreters however are easier to use, particularly for
                         beginners, since errors are immediately displayed, corrected
                         by the user, until the program is able to be executed.
                    • you can interrupt it while it is running, change
                         the program and either continue or start again.




   The disadvantage of this is that :
                      • every line has to be translated every time it is executed,
                         even if it is executed many times as the program runs.
                         Because of this interpreters tend to be slow. that
                         interpreted programs run much slower than compiled
                         programs. As much as 5-10 times slower as every line of
                         code has to be re-read, then re-processed.
                      • interpreted programs can only run on computers that also
                         have the interpreter.



    Examples of interpreters are Basic on older home computers, and script
    interpreters such as JavaScript, and languages such as Lisp and Forth.




A compiler :
 reads the whole program (called source code) written in some high level language
  and translates code of a programming language in machine code "binarycode,", also
  called object code. The object code can be executed directly on the machine where
  it was compiled.
    a special program that analyses all the statements in a program (called source
    code) written in some high level language and links the code (using libraries) to
    produce an executable. To run the program you submit the executable which would
    produce some output. To make changes in the program you must repeat these
    steps .
 the compiler translates the entire program in one go and then executes it.
 Compilers, on the other hand, analyse the entire program, taking note of where
  errors have occurred, and places these in an error/diagnostic file. If errors have
  occurred then the program cannot run. Programmers must then use the error
  messages to identify and remove the errors in the source code. Some compilers
  assist by adding line numbers to the source listing to help pinpoint errors .
  compilers offer programmers some advantages. compiled programs make the
  programmer wait until the program is complete.



Programming Steps for Compilation :
 Edit the Program
 parses or analyzes all of the language statements syntactically in a sequential
  manner and then, in one or more successive passes, builds the output code, ensuring
  that statements that refer to other statements are referenced correctly in the
  final code.
 Link the Machine code files into a runnable program (also known as an exe).
 Debug or Run the Program



 The advantage of this is that :
                    • the translation is done once only and as a separate process.
                         The program that is run is already translated into machine
                         code so is much faster in execution.
                    • compiled programs can run on any computer



 The disadvantage of this is that :
                    •    you cannot change the program without going back to the
                        original source code, editing that and recompiling (though
                        for a professional software developer this is more of an
                        advantage because it stops source code being copied, so
                        there’s an element of security built in to compiled
                        programs.).



 Examples of compilers are Visual Basic, C, C++, C#, Fortran, Cobol, Ada, Pascal and
  so on.
 A compiler works with what are sometimes called 3GL and higher-level languages
  (3rd-generation languages, such as Java and C
compiler vs interpreter

Mais conteúdo relacionado

Mais procurados

Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentationfazli khaliq
 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAMaulik Borsaniya
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programmingRokonuzzaman Rony
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
Character set in c
Character set in cCharacter set in c
Character set in cpolast
 
Classification of Compilers
Classification of CompilersClassification of Compilers
Classification of CompilersSarmad Ali
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programmingTejaswiB4
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreterParas Patel
 
Programming languages
Programming languagesProgramming languages
Programming languagesAsmasum
 
Text Editor for System software
Text Editor for System softwareText Editor for System software
Text Editor for System softwarekalaivanan vanan
 
Compiler Design
Compiler DesignCompiler Design
Compiler DesignMir Majid
 

Mais procurados (20)

Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
 
Introduction to problem solving in C
Introduction to problem solving in CIntroduction to problem solving in C
Introduction to problem solving in C
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
Compilers
CompilersCompilers
Compilers
 
Interpreter
InterpreterInterpreter
Interpreter
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Character set in c
Character set in cCharacter set in c
Character set in c
 
Classification of Compilers
Classification of CompilersClassification of Compilers
Classification of Compilers
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Text Editor for System software
Text Editor for System softwareText Editor for System software
Text Editor for System software
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Function C programming
Function C programmingFunction C programming
Function C programming
 
loaders and linkers
 loaders and linkers loaders and linkers
loaders and linkers
 
Python - the basics
Python - the basicsPython - the basics
Python - the basics
 
Yacc
YaccYacc
Yacc
 

Destaque (20)

Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
 
Compilers and interpreters
Compilers and interpretersCompilers and interpreters
Compilers and interpreters
 
Language translator
Language translatorLanguage translator
Language translator
 
Compilers
CompilersCompilers
Compilers
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
What is Compiler?
What is Compiler?What is Compiler?
What is Compiler?
 
Database management system
Database management systemDatabase management system
Database management system
 
Database management system presentation
Database management system presentationDatabase management system presentation
Database management system presentation
 
Chapter 2.3
Chapter 2.3Chapter 2.3
Chapter 2.3
 
Computer system
Computer systemComputer system
Computer system
 
Compilation v. interpretation
Compilation v. interpretationCompilation v. interpretation
Compilation v. interpretation
 
Using Memoir as a Genre in Writing
Using Memoir as a Genre in WritingUsing Memoir as a Genre in Writing
Using Memoir as a Genre in Writing
 
4 various operating systems
4 various operating systems4 various operating systems
4 various operating systems
 
Interpreted and compiled language
Interpreted and compiled languageInterpreted and compiled language
Interpreted and compiled language
 
Types and components of computer system
Types and components of computer systemTypes and components of computer system
Types and components of computer system
 
Input and output devices
Input and output devicesInput and output devices
Input and output devices
 
Techniques & applications of Compiler
Techniques & applications of CompilerTechniques & applications of Compiler
Techniques & applications of Compiler
 
Binary code
Binary codeBinary code
Binary code
 
compiladores
compiladorescompiladores
compiladores
 

Semelhante a compiler vs interpreter

Computer assignment for grade 9
Computer assignment for grade  9Computer assignment for grade  9
Computer assignment for grade 9nahomyitbarek
 
Language processing system.pdf
Language processing system.pdfLanguage processing system.pdf
Language processing system.pdfRakibRahman19
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to CompilersAkhil Kaushik
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSsonalikharade3
 
Life cycle of a computer program
Life cycle of a computer programLife cycle of a computer program
Life cycle of a computer programAbhay Kumar
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptxPCSG_Computer_Science_Unit_1_Lecture_2.pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptxAliyahAli19
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution pptKeerty Smile
 
Programming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresProgramming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresNisarg Amin
 
compilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfcompilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfHarshaVardhan196987
 
Programming Languages / Translators
Programming Languages / TranslatorsProgramming Languages / Translators
Programming Languages / TranslatorsProject Student
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compilerA. S. M. Shafi
 
Introduction to programming language (basic)
Introduction to programming language (basic)Introduction to programming language (basic)
Introduction to programming language (basic)nharsh2308
 
lce1 مترجمات.pptx
lce1 مترجمات.pptxlce1 مترجمات.pptx
lce1 مترجمات.pptxSamiAAli44
 

Semelhante a compiler vs interpreter (20)

Computer assignment for grade 9
Computer assignment for grade  9Computer assignment for grade  9
Computer assignment for grade 9
 
Language processing system.pdf
Language processing system.pdfLanguage processing system.pdf
Language processing system.pdf
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
 
COMPILER DESIGN.docx
COMPILER DESIGN.docxCOMPILER DESIGN.docx
COMPILER DESIGN.docx
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
 
Life cycle of a computer program
Life cycle of a computer programLife cycle of a computer program
Life cycle of a computer program
 
Compiler vs interpreter
Compiler vs interpreter Compiler vs interpreter
Compiler vs interpreter
 
C programming
C programmingC programming
C programming
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
 
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptxPCSG_Computer_Science_Unit_1_Lecture_2.pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
 
Programming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresProgramming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwares
 
Languages in computer
Languages in computerLanguages in computer
Languages in computer
 
compilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfcompilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdf
 
Cf&oa
Cf&oaCf&oa
Cf&oa
 
Programming Languages / Translators
Programming Languages / TranslatorsProgramming Languages / Translators
Programming Languages / Translators
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Introduction to programming language (basic)
Introduction to programming language (basic)Introduction to programming language (basic)
Introduction to programming language (basic)
 
lce1 مترجمات.pptx
lce1 مترجمات.pptxlce1 مترجمات.pptx
lce1 مترجمات.pptx
 

Mais de Faculty of Science , portsaid Univeristy (8)

Library Management System
Library Management SystemLibrary Management System
Library Management System
 
الحسن بن الهيثم
الحسن بن الهيثمالحسن بن الهيثم
الحسن بن الهيثم
 
الحسن بن الهيثم
الحسن بن الهيثمالحسن بن الهيثم
الحسن بن الهيثم
 
Html course
Html courseHtml course
Html course
 
Teach yourself html_ar
Teach yourself html_arTeach yourself html_ar
Teach yourself html_ar
 
GUI
GUI GUI
GUI
 
Algorithms python arraylistmatrix
Algorithms python arraylistmatrixAlgorithms python arraylistmatrix
Algorithms python arraylistmatrix
 
Algorithms.
Algorithms. Algorithms.
Algorithms.
 

Último

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Último (20)

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

compiler vs interpreter

  • 1. Interpreter Vs Compiler By : Aya Yakout Alkhamese Compiler 4th Dept : Computer Science & Information Technology Faculty of Science – Portsaid Univeristy
  • 2. • Interpreter Vs Compiler  Programming languages can be divided into two major categories: low level and high level. “Assembly language” and “machine language” are called low-level languages because they more than others “speak” the language the computer understands. On the other hand, C, C++, Pascal,Python, Visual Basic, Java, and COBOL are high-level languages because they require more manipulation by the computer, a process called compiling.  When writing programs in a high level language, the computer will not be able to understand it. So that it will be usable, you need to convert it into something that a computer understands. This is where compilers and interpreters come in as they both do the same function – convert a high level language (like C, Java) instructions into the binary form which is understandable by computer hardware. They are the software used to execute the high level programs and codes to perform various tasks. Specific compilers/interpreters are designed for different high level languages. However both compiler and interpreter have the same objective but they differ in the way they accomplish their task  An interpreter :  reads the source code one instruction or line at a time, converts this line into machine code and executes it. The machine code is then discarded and the next line is read. executing each line as it is "translated," much the way a foreign language interpreter would translate a book, by translating one line at a time.  The interpreter takes one statement then translates it and executes it and then takes another statement.  interpreter stops translating after the first error.  Programming Steps for Interpretion : • Edit the Program • No linking • No object code generated • Source statements executed line by line
  • 3.  The advantage of this is that : • Interpreters however are easier to use, particularly for beginners, since errors are immediately displayed, corrected by the user, until the program is able to be executed. • you can interrupt it while it is running, change the program and either continue or start again.  The disadvantage of this is that : • every line has to be translated every time it is executed, even if it is executed many times as the program runs. Because of this interpreters tend to be slow. that interpreted programs run much slower than compiled programs. As much as 5-10 times slower as every line of code has to be re-read, then re-processed. • interpreted programs can only run on computers that also have the interpreter.  Examples of interpreters are Basic on older home computers, and script interpreters such as JavaScript, and languages such as Lisp and Forth. A compiler :  reads the whole program (called source code) written in some high level language and translates code of a programming language in machine code "binarycode,", also called object code. The object code can be executed directly on the machine where it was compiled.  a special program that analyses all the statements in a program (called source code) written in some high level language and links the code (using libraries) to produce an executable. To run the program you submit the executable which would produce some output. To make changes in the program you must repeat these steps .
  • 4.  the compiler translates the entire program in one go and then executes it.  Compilers, on the other hand, analyse the entire program, taking note of where errors have occurred, and places these in an error/diagnostic file. If errors have occurred then the program cannot run. Programmers must then use the error messages to identify and remove the errors in the source code. Some compilers assist by adding line numbers to the source listing to help pinpoint errors . compilers offer programmers some advantages. compiled programs make the programmer wait until the program is complete. Programming Steps for Compilation :  Edit the Program  parses or analyzes all of the language statements syntactically in a sequential manner and then, in one or more successive passes, builds the output code, ensuring that statements that refer to other statements are referenced correctly in the final code.  Link the Machine code files into a runnable program (also known as an exe).  Debug or Run the Program  The advantage of this is that : • the translation is done once only and as a separate process. The program that is run is already translated into machine code so is much faster in execution. • compiled programs can run on any computer  The disadvantage of this is that : • you cannot change the program without going back to the original source code, editing that and recompiling (though for a professional software developer this is more of an advantage because it stops source code being copied, so there’s an element of security built in to compiled programs.).  Examples of compilers are Visual Basic, C, C++, C#, Fortran, Cobol, Ada, Pascal and so on.  A compiler works with what are sometimes called 3GL and higher-level languages (3rd-generation languages, such as Java and C