Public Domain C/C++ Compiler
Posted: Sun Nov 26, 2017 12:38 pm
Source code:
http://sourceforge.net/projects/c-compiler/files/
COMPILER-2017-11-08start.zip
Theory-only:
http://devel.archefire.org/forum/viewtopic.php?t=2359
Source-code-only:
http://devel.archefire.org/forum/viewtopic.php?t=2362
Repetitive code reading for functional mental redundancy of rare/heavy ideas:
http://devel.archefire.org/forum/viewtopic.php?t=2367
The plan of this project is writing a C/C++ compiler that can at least be compiled with MinGW or Open Watcom. We can only use the language that those compilers can understand in common.
The resulting compiler needs to be able to understand old and new versions of the language, needs to be able to understand idioms from all versions of Visual C++, Turbo C++, Borland C++, Open Watcom, and GCC mainly.
The goal is that we can easily port software with a compiler that is capable of compiling recent software under old platforms like DOS and Windows 98. That's why the compiler itself is written only in the simple C/C++ that the current Open Watcom understands, which should run under Windows 9x. GCC is used just as a control measure to make sure that the code will still compile under newer platforms with GCC-based compiles. No fancy code should be present in the compiler even if it becomes fully capable of understanding such code. This is to make it possible to always be able to compile it directly in old platforms and in exchange have a modern and capable compiler.
______________________________________________
______________________________________________
______________________________________________
______________________________________________
I'm starting this project. So far the code is only able to open a file and record the start/end offsets of each line, and also to count the number of lines present in the given source file.
Usage:
The code should also compile under Linux.
Currently what I need to do next is to parse the source code to detect comments, strings and end-of-instruction/end-of-parameter characters like ; and , ... This is to be able to support extremely long lines being able to load only up to the point where an instruction starts and ends (line, column). After that I will start by implementing the tasks that the preprocessor should perform.
If somebody wants to help me, just say so. The code is freely available so we will all learn. You can see what I've done and the explanations of what each part do and how to add them to a compiler. You can help me by telling me how to implement things and maybe implementing functions so I can review them to fully adapt them to the compiler.
It also has to be able to understand inline assembly for AS, GAS, TASM, MASM, NASM, MASM, and also that for other architectures. For x86, all assembly code should be internally converted to NASM syntax.
We will add support for keywords from 0 keywords as we try to compile more and more existing code. Thus our compiler will be no more than a collection of compiling capabilities developed and grouped on demand in the same program as the demands of using more C/C++ code appear over time.
http://sourceforge.net/projects/c-compiler/files/
COMPILER-2017-11-08start.zip
Theory-only:
http://devel.archefire.org/forum/viewtopic.php?t=2359
Source-code-only:
http://devel.archefire.org/forum/viewtopic.php?t=2362
Repetitive code reading for functional mental redundancy of rare/heavy ideas:
http://devel.archefire.org/forum/viewtopic.php?t=2367
The plan of this project is writing a C/C++ compiler that can at least be compiled with MinGW or Open Watcom. We can only use the language that those compilers can understand in common.
The resulting compiler needs to be able to understand old and new versions of the language, needs to be able to understand idioms from all versions of Visual C++, Turbo C++, Borland C++, Open Watcom, and GCC mainly.
The goal is that we can easily port software with a compiler that is capable of compiling recent software under old platforms like DOS and Windows 98. That's why the compiler itself is written only in the simple C/C++ that the current Open Watcom understands, which should run under Windows 9x. GCC is used just as a control measure to make sure that the code will still compile under newer platforms with GCC-based compiles. No fancy code should be present in the compiler even if it becomes fully capable of understanding such code. This is to make it possible to always be able to compile it directly in old platforms and in exchange have a modern and capable compiler.
______________________________________________
______________________________________________
______________________________________________
______________________________________________
I'm starting this project. So far the code is only able to open a file and record the start/end offsets of each line, and also to count the number of lines present in the given source file.
Usage:
Code: Select all
C source.c
The code should also compile under Linux.
Currently what I need to do next is to parse the source code to detect comments, strings and end-of-instruction/end-of-parameter characters like ; and , ... This is to be able to support extremely long lines being able to load only up to the point where an instruction starts and ends (line, column). After that I will start by implementing the tasks that the preprocessor should perform.
If somebody wants to help me, just say so. The code is freely available so we will all learn. You can see what I've done and the explanations of what each part do and how to add them to a compiler. You can help me by telling me how to implement things and maybe implementing functions so I can review them to fully adapt them to the compiler.
It also has to be able to understand inline assembly for AS, GAS, TASM, MASM, NASM, MASM, and also that for other architectures. For x86, all assembly code should be internally converted to NASM syntax.
We will add support for keywords from 0 keywords as we try to compile more and more existing code. Thus our compiler will be no more than a collection of compiling capabilities developed and grouped on demand in the same program as the demands of using more C/C++ code appear over time.