Hi,
How can i make c++ compiler under windows or Linux.

What do you mean by "make C++ compiler".
I hope for your sake that you are not going to write your own C++ compiler.
So assuming that you want a C++ compiler that works under Linux and Windows,
Windows -Visual C++, DevC++ (google and you will find links to download these )
Linux - GCC ( comes with many linux distributions )

What do you mean by "make C++ compiler".
I hope for your sake that you are not going to write your own C++ compiler.
So assuming that you want a C++ compiler that works under Linux and Windows,
Windows -Visual C++, DevC++ (google and you will find links to download these )
Linux - GCC ( comes with many linux distributions )

Yes, I want to write my own C++ compiler, I've seen some e-books on internet but those are not free!
URL Link: http://www.bigwebmaster.com/95.html

Yes, I want to write my own C++ compiler

Good luck :) Unless you have a Ph.D. in computer science and mathametics plan to spend the next 20 or so years writing it.

commented: GCC is 20 years old, with contributions from 1000's of people +9

Good luck Unless you have a Ph.D. in computer science and mathametics plan to spend the next 20 or so years writing it.

Writing a stable production quality compiler single handedly? yes I agree with these setiments. But, we shouldn't put the OP off too readily. Researching and creating a limited compiler that works on a subset of a chosen language is a very beneficial learning excercise for the computer engineer / software developer.

Really, there are enough compilers out there already.... Try something else, perhaps adding to a compilers library

>Researching and creating a limited compiler that works on a subset of a
>chosen language is a very beneficial learning excercise for the computer
>engineer / software developer.
Writing a compiler is a beneficial learning exercise, but not a C++ compiler. That's like saying that a hand made tool shed is a beneficial learning exercise, and then trying to build a skyscraper. There's levels of difficulty when it comes to compilers, and C++ is right at the top. Even if you restrict yourself to an extremely limited subset of the language, you still have to deal with complicated mess of the language grammar.

>How can i make c++ compiler under windows or Linux.
I'd start by looking at the code for an existing C++ compiler. GCC, for example. That should give you an idea of what's involved.

what are C compilers written in?

C?

Assembley?

what are C compilers written in?

C?

Assembley?

:D
which came first: the chicken or the egg!!

>what are C compilers written in?
C compilers tend to also be C++ compilers, and they're generally written primarily in C or C++.

:D
which came first: the chicken or the egg!!

In case of Borland's compilers, they're written mostly in Pascal.
And that includes their Pascal compilers...

They wrote a compiler stub that could compile a minimal subset of the intended language in machine code or Assembly, used that to compile a compiler that could do a bit more of the language, and so on until they had one that could compile the entire language specification.

When they had that they could use that compiler to compile compilers for other languages like C++ and C#.

Member Avatar for iamthwee

What is machine code written in logic gates?

Don't worry. u r not writing world's *FIRST* compiler. u can use VC++, Dev-C++, Borland, .Net, Java, or any other language that can process text and can call OS API's 2 write ur compiler.

Don't worry. u r not writing world's *FIRST* compiler. u can use VC++, Dev-C++, Borland, .Net, Java, or any other language that can process text and can call OS API's 2 write ur compiler.

Don't you think it is awkward to write reply for post over 2 years old where discussion died and problem is either solved or forgotten?

Don't you think it is awkward to write reply for post over 2 years old where discussion died and problem is either solved or forgotten?

I don't find anything wrong in it. May be someone in future will b helped by it. U don't know! And what is lost in the process?

Hello superiors.
Maybe, the the poster(one who started the thread) was talking about DSLs....like Groovy.

plz tell me how to creat comipler???

didn't you bother to read the thread???

what are C compilers written in?

C?

Assembley?

i think in c...

Quick and dirty explenation, no bs

1) Lexical Analysis, This part is basicly changing a string of characters into the first meaningfull chunks/words a compiler can read, also called Tokenizing which there are generally six types of Tokens. Identifiers which are basicly user and system defined Types and instances (x, y, hello). Keywords that are used to identify the most basic of types (int,char,float), Conditional branching (if then else, switch), and Looping (while,do while,for) or the creation of your own data structures (class, struct, union). Numbers (1,34.3,5.934e+23). Comments wich are words meant for humans and are skipped by a compiler (documentation,usage). Delimitors whitch contains list of stuff of signals the end of something ((),{},[],;,,). Symbols that are used for access or mathmatical operations (+-/?!~.::->) I suggest you look up finite state automata and Regex
2) Syntax Analysis, Basicly the Grammer identification part puts the Tokens into a tree like structure with the last operations to be done( neer the top and the first ops to be run at the bottom and Literals(numbers) and References(Variables) at the vary bottom (Think of like order of operations with +- to be done last and Times/Divide to be done first). For this i suggest looking up Abstract Syntax Trees, Pushstack Machines, and the Interpreter Pattern
3) durring these two phases a Stucture is filled with symbols a user defined such as types theve created and instances as well as what they are and what they contain called the Context. I suggest using Maps and Dictionaries for these.
4) Code Generation. Sorry but havn't gotten to this in my studies yet :( but the first two parts contain whats called the Front End of the compiler and interpreters usually skip the code generation parts and go straight to running the the internal structures created.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.