SlideShare a Scribd company logo
Topic:   SOURCE TO SOURCE COMPILER
          Course Title: SYSTEM   SOFTWARE
                  Course Code: CAP   607

SUBMITTED TO:                          SUBMITTED BY:
Mr. SANJAY SOOD                        MINTOO
JAKHMOLA
                                       REG. NO.: 11009054
                                       ROLL NO.: B20
                                       SECTION: D1006
INTRODUCTION


A compiler, in the broadest sense, is just a tool that converts from a language (or a
way of expressing some knowledge) into another. Most people see compilers as
tools that have source code as input and produce binary files as output.

Source-to-source compilers have as input source code and produce source code as
output. It is assumed that the output can be used as well as the input of another
compiler (or even the same!).

It is also known as transcompiler (or transpiler) and it is also a type of compiler
that takes the source code of a programming language as its input and outputs the
source code in another programming language. For example, it may perform a
translation of a program from Pascal to C.




DEFINITION "transpiler":
A program which reads code in language A and converts it into code for language
B. The transpiler converts between languages at the same level. Examples: (C++
-> C, Pascal -> C).
DIFFERENCE BETWEEN COMPILER
     AND TRANSCOMPILER

A compiler translates source code to machine code that can be understood by the
CPU hardware. A transpiler translates source code to another form of source code
that can be understood by another compiler.

Or

The difference between a compiler and a transpiler is that the compiler usually
converts from a high to a low level language (C -> Assembler, Java -> Bytecode)
while the transpiler converts between languages at (roughly) the same level.
Examples: (C++ -> C, Pascal -> C).




     SOURCE                                                     MACHINE
                                 COMPILER
     CODE                                                          CODE



                  COMPILER WORKING
SOURCE                                                         SOURCE
                                TRANSPILER
      CODE                                                           CODE



                  TRANSPILER WORKING



Why A Source-To-Source Compiler Is
             Useful

One might wonder why a source-to-source compiler is useful if they are
generating again source code and not a binary ready to run like a "full" compiler
would.
Well, it turns that compilers are complex tools. Complex tools because they have
to deal with several processes including, but not limiting to: parsing the input,
checking the semantics, implement these semantics, finding out opportunities of
optimization under the semantics, generating binary code, etc.
So, that is why the source-to-source compiler is useful. A source-to-source
compiler performs a parsing phase but the generated AST must be much more
detailed than the one of a binary generating compiler. The reason is that the output
of the source-to-source compiler must be valid as an input for another compiler.



   SOURCE-TO-SOURCE COMPILER
            EXAMPLE

   1.   ROSE: It is an open source compiler infrastructure to build source-to-
        source program transformation and analysis tools for large-scale Fortran
        77/95/2003, C, C++, OpenMP, and UPC applications.

   2.   DMS Software Reengineering Toolkit: It is a source-to-source
        program transformation tool. It can be used for translating from one
        computer language to another, for compiling domain-specific languages to a
        general purpose language, or for carrying out optimizations or massive
        modifications within a specific language.

   3.   OpenMP: In this implementation is source-to-source, meaning that it
        converts the input program, in Fortran source, which contains OpenMP
        directives into an output program, also in Fortran source. The output
        program explicitly creates and synchronizes parallel threads to implement
        parallelism, as indicated by the OpenMP directives in the input program.

   4.   Cetus: It is a compiler infrastructure for the source-to-source
        transformation of software programs. It currently supports ANSI C. Since
        its creation in 2004, it has grown to over 80,000 lines of Java code, has been
        made available publicly on the web, and has become a basis for several
        research projects.

More Related Content

What's hot

C language in hindi (cलेग्वेज इन हिंदी )
C language  in hindi (cलेग्वेज इन हिंदी )C language  in hindi (cलेग्वेज इन हिंदी )
C language in hindi (cलेग्वेज इन हिंदी )
Chand Rook
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
Sivant Kolhe
 
Programming in c
Programming in cProgramming in c
Programming in c
indra Kishor
 
C Programming - Refresher - Part I
C Programming - Refresher - Part I C Programming - Refresher - Part I
C Programming - Refresher - Part I
Emertxe Information Technologies Pvt Ltd
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
ismailmrribi
 
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
Emertxe Information Technologies Pvt Ltd
 
Streit APC brochure
Streit APC  brochureStreit APC  brochure
Streit APC brochure
Florin S. Fleseriu
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
TIB Academy
 
Embedded C - Day 2
Embedded C - Day 2Embedded C - Day 2
1. over view and history of c
1. over view and history of c1. over view and history of c
1. over view and history of cHarish Kumawat
 
Advanced C - Part 1
Advanced C - Part 1 Advanced C - Part 1
Evolution of Computer Languages
Evolution of Computer LanguagesEvolution of Computer Languages
Evolution of Computer Languages
Electro Computer Warehouse
 
Introduction to Python IDLE | IDLE Tutorial | Edureka
Introduction to Python IDLE | IDLE Tutorial | EdurekaIntroduction to Python IDLE | IDLE Tutorial | Edureka
Introduction to Python IDLE | IDLE Tutorial | Edureka
Edureka!
 
Compilers
CompilersCompilers
Programming languages
Programming languagesProgramming languages
Programming languages
Asmasum
 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on python
RaginiJain21
 
Steps for c program execution
Steps for c program executionSteps for c program execution
Steps for c program execution
Rumman Ansari
 
C Programming - Refresher - Part II
C Programming - Refresher - Part II C Programming - Refresher - Part II
C Programming - Refresher - Part II
Emertxe Information Technologies Pvt Ltd
 
Machine language
Machine languageMachine language
Machine language
trekalover
 
Python basic syntax
Python basic syntaxPython basic syntax
Python basic syntax
Mohamed Essam
 

What's hot (20)

C language in hindi (cलेग्वेज इन हिंदी )
C language  in hindi (cलेग्वेज इन हिंदी )C language  in hindi (cलेग्वेज इन हिंदी )
C language in hindi (cलेग्वेज इन हिंदी )
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Programming in c
Programming in cProgramming in c
Programming in c
 
C Programming - Refresher - Part I
C Programming - Refresher - Part I C Programming - Refresher - Part I
C Programming - Refresher - Part I
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
 
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
 
Streit APC brochure
Streit APC  brochureStreit APC  brochure
Streit APC brochure
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
 
Embedded C - Day 2
Embedded C - Day 2Embedded C - Day 2
Embedded C - Day 2
 
1. over view and history of c
1. over view and history of c1. over view and history of c
1. over view and history of c
 
Advanced C - Part 1
Advanced C - Part 1 Advanced C - Part 1
Advanced C - Part 1
 
Evolution of Computer Languages
Evolution of Computer LanguagesEvolution of Computer Languages
Evolution of Computer Languages
 
Introduction to Python IDLE | IDLE Tutorial | Edureka
Introduction to Python IDLE | IDLE Tutorial | EdurekaIntroduction to Python IDLE | IDLE Tutorial | Edureka
Introduction to Python IDLE | IDLE Tutorial | Edureka
 
Compilers
CompilersCompilers
Compilers
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on python
 
Steps for c program execution
Steps for c program executionSteps for c program execution
Steps for c program execution
 
C Programming - Refresher - Part II
C Programming - Refresher - Part II C Programming - Refresher - Part II
C Programming - Refresher - Part II
 
Machine language
Machine languageMachine language
Machine language
 
Python basic syntax
Python basic syntaxPython basic syntax
Python basic syntax
 

Viewers also liked

Transpilers(Source-to-Source Compilers)
Transpilers(Source-to-Source Compilers)Transpilers(Source-to-Source Compilers)
Transpilers(Source-to-Source Compilers)
Shivang Bajaniya
 
Zsh shell-for-humans
Zsh shell-for-humansZsh shell-for-humans
Zsh shell-for-humans
Juan De Bravo
 
Classification of Compilers
Classification of CompilersClassification of Compilers
Classification of Compilers
Sarmad Ali
 
Learning C++ - Pointers in c++ 2
Learning C++ - Pointers in c++ 2Learning C++ - Pointers in c++ 2
Learning C++ - Pointers in c++ 2
Ali Aminian
 
Computer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and EllipseComputer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and Ellipse
2013901097
 
06 clipping
06 clipping06 clipping
06 clipping
IMPECTRON
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Shweta Patil
 
Mid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer GraphicsMid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer Graphics
Drishti Bhalla
 
Cohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithmCohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithm
Shilpa Hait
 
14 file handling
14 file handling14 file handling
14 file handlingAPU
 
Circle & curve clipping algorithm
Circle & curve clipping algorithmCircle & curve clipping algorithm
Circle & curve clipping algorithm
Mohamed El-Serngawy
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformationUdayan Gupta
 
Files in c++
Files in c++Files in c++
Files in c++
Selvin Josy Bai Somu
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
Rajat Busheheri
 

Viewers also liked (20)

Transpilers(Source-to-Source Compilers)
Transpilers(Source-to-Source Compilers)Transpilers(Source-to-Source Compilers)
Transpilers(Source-to-Source Compilers)
 
The interpreter
The interpreterThe interpreter
The interpreter
 
Complier designer
Complier designerComplier designer
Complier designer
 
Zsh shell-for-humans
Zsh shell-for-humansZsh shell-for-humans
Zsh shell-for-humans
 
Classification of Compilers
Classification of CompilersClassification of Compilers
Classification of Compilers
 
Learning C++ - Pointers in c++ 2
Learning C++ - Pointers in c++ 2Learning C++ - Pointers in c++ 2
Learning C++ - Pointers in c++ 2
 
Anti aliasing
Anti aliasingAnti aliasing
Anti aliasing
 
Computer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and EllipseComputer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and Ellipse
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
06 clipping
06 clipping06 clipping
06 clipping
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Mid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer GraphicsMid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer Graphics
 
Cohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithmCohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithm
 
Clipping
ClippingClipping
Clipping
 
14 file handling
14 file handling14 file handling
14 file handling
 
Circle & curve clipping algorithm
Circle & curve clipping algorithmCircle & curve clipping algorithm
Circle & curve clipping algorithm
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformation
 
Files in c++
Files in c++Files in c++
Files in c++
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Curve clipping
Curve clippingCurve clipping
Curve clipping
 

Similar to Source-to-Source Compiler

Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
Keerty Smile
 
Introduction to compiler development
Introduction to compiler developmentIntroduction to compiler development
Introduction to compiler development
DeepOad
 
Source vs object code
Source vs object codeSource vs object code
Source vs object code
Sana Ullah
 
Chapter1.pdf
Chapter1.pdfChapter1.pdf
Chapter1.pdf
tharwatabdulhmed
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
Learnbay Datascience
 
COMPUTER ORGANIZATION.pptxbkobuujghuujjj
COMPUTER ORGANIZATION.pptxbkobuujghuujjjCOMPUTER ORGANIZATION.pptxbkobuujghuujjj
COMPUTER ORGANIZATION.pptxbkobuujghuujjj
AnujyotiDe
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl TranslatorCma Mohd
 
basics of compiler design
basics of compiler designbasics of compiler design
basics of compiler design
Preeti Katiyar
 
Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdf
DrIsikoIsaac
 
Chapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxChapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptx
dawod yimer
 
Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
abdulbaki3
 
Csharp tp
Csharp tpCsharp tp
Csharp tp
vishal kedia
 
unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdf
DrIsikoIsaac
 
CD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxCD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptx
ZiyadMohammed17
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introduction
mengistu23
 
4_5802928814682016556.pptx
4_5802928814682016556.pptx4_5802928814682016556.pptx
4_5802928814682016556.pptx
AshenafiGirma5
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
Akhil Kaushik
 
Lect-01.ppt
Lect-01.pptLect-01.ppt
Lect-01.ppt
KamranAli649587
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
Md Hossen
 
Language translators
Language translatorsLanguage translators
Language translatorsAditya Sharat
 

Similar to Source-to-Source Compiler (20)

Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
 
Introduction to compiler development
Introduction to compiler developmentIntroduction to compiler development
Introduction to compiler development
 
Source vs object code
Source vs object codeSource vs object code
Source vs object code
 
Chapter1.pdf
Chapter1.pdfChapter1.pdf
Chapter1.pdf
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
COMPUTER ORGANIZATION.pptxbkobuujghuujjj
COMPUTER ORGANIZATION.pptxbkobuujghuujjjCOMPUTER ORGANIZATION.pptxbkobuujghuujjj
COMPUTER ORGANIZATION.pptxbkobuujghuujjj
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl Translator
 
basics of compiler design
basics of compiler designbasics of compiler design
basics of compiler design
 
Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdf
 
Chapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxChapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptx
 
Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
 
Csharp tp
Csharp tpCsharp tp
Csharp tp
 
unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdf
 
CD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxCD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptx
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introduction
 
4_5802928814682016556.pptx
4_5802928814682016556.pptx4_5802928814682016556.pptx
4_5802928814682016556.pptx
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
 
Lect-01.ppt
Lect-01.pptLect-01.ppt
Lect-01.ppt
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
 
Language translators
Language translatorsLanguage translators
Language translators
 

More from Mintoo Jakhmola

Backing Up and Retreiving files (by Mintoo Jakhmola
Backing Up and Retreiving files (by Mintoo JakhmolaBacking Up and Retreiving files (by Mintoo Jakhmola
Backing Up and Retreiving files (by Mintoo JakhmolaMintoo Jakhmola
 
Wireless Application Protocol (by Mintoo Jakhmola)
Wireless Application Protocol (by Mintoo Jakhmola)Wireless Application Protocol (by Mintoo Jakhmola)
Wireless Application Protocol (by Mintoo Jakhmola)Mintoo Jakhmola
 
Facel expression recognition
Facel expression recognitionFacel expression recognition
Facel expression recognition
Mintoo Jakhmola
 
Weak Slot and Filler Structure (by Mintoo Jakhmola LPU)
Weak Slot and Filler Structure (by Mintoo Jakhmola LPU)Weak Slot and Filler Structure (by Mintoo Jakhmola LPU)
Weak Slot and Filler Structure (by Mintoo Jakhmola LPU)Mintoo Jakhmola
 
Artificial intelligence (by Mintoo Jakhmola)
Artificial intelligence (by Mintoo Jakhmola)Artificial intelligence (by Mintoo Jakhmola)
Artificial intelligence (by Mintoo Jakhmola)Mintoo Jakhmola
 
Animation (by Mintoo Jakhmola)
Animation (by Mintoo Jakhmola)Animation (by Mintoo Jakhmola)
Animation (by Mintoo Jakhmola)Mintoo Jakhmola
 

More from Mintoo Jakhmola (7)

Linux Vs Unix
Linux Vs UnixLinux Vs Unix
Linux Vs Unix
 
Backing Up and Retreiving files (by Mintoo Jakhmola
Backing Up and Retreiving files (by Mintoo JakhmolaBacking Up and Retreiving files (by Mintoo Jakhmola
Backing Up and Retreiving files (by Mintoo Jakhmola
 
Wireless Application Protocol (by Mintoo Jakhmola)
Wireless Application Protocol (by Mintoo Jakhmola)Wireless Application Protocol (by Mintoo Jakhmola)
Wireless Application Protocol (by Mintoo Jakhmola)
 
Facel expression recognition
Facel expression recognitionFacel expression recognition
Facel expression recognition
 
Weak Slot and Filler Structure (by Mintoo Jakhmola LPU)
Weak Slot and Filler Structure (by Mintoo Jakhmola LPU)Weak Slot and Filler Structure (by Mintoo Jakhmola LPU)
Weak Slot and Filler Structure (by Mintoo Jakhmola LPU)
 
Artificial intelligence (by Mintoo Jakhmola)
Artificial intelligence (by Mintoo Jakhmola)Artificial intelligence (by Mintoo Jakhmola)
Artificial intelligence (by Mintoo Jakhmola)
 
Animation (by Mintoo Jakhmola)
Animation (by Mintoo Jakhmola)Animation (by Mintoo Jakhmola)
Animation (by Mintoo Jakhmola)
 

Recently uploaded

Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 

Recently uploaded (20)

Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 

Source-to-Source Compiler

  • 1. Topic: SOURCE TO SOURCE COMPILER Course Title: SYSTEM SOFTWARE Course Code: CAP 607 SUBMITTED TO: SUBMITTED BY: Mr. SANJAY SOOD MINTOO JAKHMOLA REG. NO.: 11009054 ROLL NO.: B20 SECTION: D1006
  • 2. INTRODUCTION A compiler, in the broadest sense, is just a tool that converts from a language (or a way of expressing some knowledge) into another. Most people see compilers as tools that have source code as input and produce binary files as output. Source-to-source compilers have as input source code and produce source code as output. It is assumed that the output can be used as well as the input of another compiler (or even the same!). It is also known as transcompiler (or transpiler) and it is also a type of compiler that takes the source code of a programming language as its input and outputs the source code in another programming language. For example, it may perform a translation of a program from Pascal to C. DEFINITION "transpiler": A program which reads code in language A and converts it into code for language B. The transpiler converts between languages at the same level. Examples: (C++ -> C, Pascal -> C).
  • 3. DIFFERENCE BETWEEN COMPILER AND TRANSCOMPILER A compiler translates source code to machine code that can be understood by the CPU hardware. A transpiler translates source code to another form of source code that can be understood by another compiler. Or The difference between a compiler and a transpiler is that the compiler usually converts from a high to a low level language (C -> Assembler, Java -> Bytecode) while the transpiler converts between languages at (roughly) the same level. Examples: (C++ -> C, Pascal -> C). SOURCE MACHINE COMPILER CODE CODE COMPILER WORKING
  • 4. SOURCE SOURCE TRANSPILER CODE CODE TRANSPILER WORKING Why A Source-To-Source Compiler Is Useful One might wonder why a source-to-source compiler is useful if they are generating again source code and not a binary ready to run like a "full" compiler would. Well, it turns that compilers are complex tools. Complex tools because they have to deal with several processes including, but not limiting to: parsing the input, checking the semantics, implement these semantics, finding out opportunities of optimization under the semantics, generating binary code, etc. So, that is why the source-to-source compiler is useful. A source-to-source compiler performs a parsing phase but the generated AST must be much more
  • 5. detailed than the one of a binary generating compiler. The reason is that the output of the source-to-source compiler must be valid as an input for another compiler. SOURCE-TO-SOURCE COMPILER EXAMPLE 1. ROSE: It is an open source compiler infrastructure to build source-to- source program transformation and analysis tools for large-scale Fortran 77/95/2003, C, C++, OpenMP, and UPC applications. 2. DMS Software Reengineering Toolkit: It is a source-to-source program transformation tool. It can be used for translating from one computer language to another, for compiling domain-specific languages to a general purpose language, or for carrying out optimizations or massive modifications within a specific language. 3. OpenMP: In this implementation is source-to-source, meaning that it converts the input program, in Fortran source, which contains OpenMP directives into an output program, also in Fortran source. The output program explicitly creates and synchronizes parallel threads to implement parallelism, as indicated by the OpenMP directives in the input program. 4. Cetus: It is a compiler infrastructure for the source-to-source transformation of software programs. It currently supports ANSI C. Since its creation in 2004, it has grown to over 80,000 lines of Java code, has been made available publicly on the web, and has become a basis for several research projects.