https://github.com/harshpatel44/phases-of-compiler
These Repository shows the Compilation Stages of a C program with a User Interface
https://github.com/harshpatel44/phases-of-compiler
Last synced: 2 months ago
JSON representation
These Repository shows the Compilation Stages of a C program with a User Interface
- Host: GitHub
- URL: https://github.com/harshpatel44/phases-of-compiler
- Owner: Harshpatel44
- License: mit
- Created: 2018-01-25T17:05:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-30T05:28:02.000Z (about 5 years ago)
- Last Synced: 2025-01-24T15:41:49.274Z (4 months ago)
- Language: SWIG
- Size: 86.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Phases of C language compiler
These Repository shows the Compilation Stages of a C program with a User Interface.
How to use:
1. Enter the path of the C language file (.C) in Entry Box
2. Click on Pre-processing Button
3. Then Compilation , Assembly & finally Linking
4. As you Click , You will find the content
5. The Files of Preprocessing, Compiling , Assembly are also saved in the path
Program stages
The four stages for a C program to become an executable are the following:
1. Pre-processing
2. Compilation
3. Assembly
4. Linking
Working with explaination
1. Preprocessing
This is the first stage of compilation process where preprocessor directives (macros and header files are most common) are expanded. To perform this step gcc executes the following command internally.
[root@host ~]# cpp helloworld.c > helloworld.i
![]()
2. CompilationIn this phase compilation proper takes place. The compiler (ccl) translates helloworld.i into helloworld.s. File helloworld.s contains assembly code. You can explicitly tell gcc to translate helloworld.i to helloworld.s by executing the following command.
[root@host ~]# gcc -S helloworld.i
![]()
3. AssemblyHere, the assembler (as) translates helloworld.s into machine language instructions, and generates an object file helloworld.o. You can invoke the assembler at your own by executing the following command.
[root@host ~]# as helloworld.s -o helloworld.o
![]()
4. LinkingThis is the final stage in compilation of "Hello World!" program. This phase links object files to produce final executable file.