Skip to main content

Posts

Showing posts with the label c

Creating a New Programming Language and Compiler

Recently I have been looking into a special need to create my own programming language. I have also studied the history of different languages and success and issues they are struggling and stuck with. Here is my personal point of view on this: Creating a Purely new Programming Language The best available language is C\C++ for a cross platform development with different compilers and debuggers. If you are thinking of creating a remarkable new language, HOLD ON,          1- You need to create a compile to target X86, X64, and ARM etc          2- Compiler shall work on Windows, Linux and MAC etc...          3- You need to revisit the entire history of programming language in this case and you have to port all that stuff          4- You Need IDE, compiler          5- Debugger ...

Make file and including external file

Now in this section, we will create a folder to contain some extra files. 1- How to compile those files. 2- We will create a separate folder to contain the obj files. 3- We will create a separate folder to the output executable as well. Will create a folder called "api" inside the source folder: this folder will contain: mmath.h #ifndef _MMATH_H_ #define _MMATH_H_ double Add(int a, int b); #endif mmath.c #include "mmath.h" double Add(int a, int b) {     return a+b; } Let's update out main as well... main.c #include <stdio.h> #include "api/mmath.h" int main(int argc,char *argv[]) {     double res = Add(23,26);     printf("You see, u see this... I'm running\r\n");     printf("%f\r\n", res);     printf("Externals Executed\r\n");     return 0; } Now How to compile this? We need to include our custom header file as well while compiling and we also need ...