LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Writing a Compiler in Linux (https://www.linuxquestions.org/questions/linux-newbie-8/writing-a-compiler-in-linux-578134/)

raghuveerbabu 08-19-2007 12:18 AM

Writing a Compiler in Linux
 
Hi all,
I'm very much interested in writing a new compiler in Linux (Feisty Fawn Platform). I don't no how to start with. Can u please guide me?

reverse 08-19-2007 02:20 AM

Sure: a compiler for what? what programming knowledge do you posess?

baikonur 08-19-2007 02:23 AM

yeah, right...

if i hadn't seen questions like that before, i'd say you're a troll.
well, i'm a nice guy, start reading here:

guideme.itgo.com/atozofc/ch48.pdf

(since you obviously don't know how to use a search engine, i have little doubt that you'll be back here in no time asking stuff like "what is a linker" or "how do i use the stack". be prepared to get some real rude answers then.)

reverse 08-19-2007 02:33 AM

I don't think he's a troll, I just think he doesn't know what he's getting into, or rather trying to "write a compiler" for the wrong reasons.

raghuveerbabu 08-19-2007 03:48 AM

Compiler for programming lanuage
 
A compiler for my own programming language, for hobby. I knew C, C++, Java
and .NET.

Quote:

Originally Posted by reverse (Post 2863523)
Sure: a compiler for what? what programming knowledge do you posess?


brianL 08-19-2007 06:05 AM

Would this be of any use?

http://cocom.sourceforge.net/

archtoad6 08-22-2007 11:00 AM

Do you already have an interpreter?

ankit4u1 08-22-2007 12:31 PM

Ok. If you know C,C++...then you can use FLEX and BISON(also known and YACC(Yet another compiler compiler)) to write your own compiler !!

FLEX and BISON are usually included in all distros...do a google search on it...u'll get a lot of stuff

Hope this helps.

Ankit

sundialsvcs 08-22-2007 08:31 PM

Go for it!!
 
One of the most unique features of Linux is the sheer number of development tools that are available, in source-code form. This includes not only powerful tools such as Bison and YACC, but also an endless number of language systems including gcc itself.

I will openly encourage you to pursue your dreams of developing a language compiler or interpreter, having achieved that milestone more than once myself. You will find that this path has been well-trod a great many times. You will find that every one of the tools that you use every day, in your daily interactions with the Linux system (including "the Linux system" itself...) are open for your inspection.

It will .. blow .. your .. mind .. .. ..

nx5000 08-23-2007 03:24 AM

Have a look here:
http://www.ibm.com/developerworks/library/l-lexyac.html
Lex and yacc will help you for syntaxic/lexical/semantic parsing. Then you will need to generate (and link) binary machine code, dependent on the target.

I did a pascal compiler for MIPS and a compiler for a subset of C language that generated P-code (like java) running on a virtual machine written.. in C. It is completly useless but had a lot of fun creating my own "assembly" language.

Also blew my mind..

AnanthaP 08-23-2007 08:12 AM

For hobby or class project?

raghuveerbabu 08-23-2007 11:48 AM

Interpreter
 
No.. May i know why?

Quote:

Originally Posted by archtoad6 (Post 2866973)
Do you already have an interpreter?


raghuveerbabu 08-23-2007 11:50 AM

Thanks
 
Ya.. Thanks for ur info...

Quote:

Originally Posted by ankit4u1 (Post 2867051)
Ok. If you know C,C++...then you can use FLEX and BISON(also known and YACC(Yet another compiler compiler)) to write your own compiler !!

FLEX and BISON are usually included in all distros...do a google search on it...u'll get a lot of stuff

Hope this helps.

Ankit


raghuveerbabu 08-23-2007 11:51 AM

Thanks
 
Ya thank you for ur info...

Quote:

Originally Posted by sundialsvcs (Post 2867484)
One of the most unique features of Linux is the sheer number of development tools that are available, in source-code form. This includes not only powerful tools such as Bison and YACC, but also an endless number of language systems including gcc itself.

I will openly encourage you to pursue your dreams of developing a language compiler or interpreter, having achieved that milestone more than once myself. You will find that this path has been well-trod a great many times. You will find that every one of the tools that you use every day, in your daily interactions with the Linux system (including "the Linux system" itself...) are open for your inspection.

It will .. blow .. your .. mind .. .. ..


raghuveerbabu 08-23-2007 11:53 AM

Hobby
 
Just for hobby...

Quote:

Originally Posted by AnanthaP (Post 2867982)
For hobby or class project?



All times are GMT -5. The time now is 05:33 AM.