LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-19-2007, 01:18 AM   #1
raghuveerbabu
LQ Newbie
 
Registered: Aug 2007
Posts: 20

Rep: Reputation: 0
Smile 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?
 
Old 08-19-2007, 03:20 AM   #2
reverse
Member
 
Registered: Apr 2007
Distribution: Gentoo
Posts: 337

Rep: Reputation: 30
Sure: a compiler for what? what programming knowledge do you posess?
 
Old 08-19-2007, 03:23 AM   #3
baikonur
Member
 
Registered: Oct 2005
Location: germany
Distribution: debian
Posts: 255
Blog Entries: 5

Rep: Reputation: 30
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.)
 
Old 08-19-2007, 03:33 AM   #4
reverse
Member
 
Registered: Apr 2007
Distribution: Gentoo
Posts: 337

Rep: Reputation: 30
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.
 
Old 08-19-2007, 04:48 AM   #5
raghuveerbabu
LQ Newbie
 
Registered: Aug 2007
Posts: 20

Original Poster
Rep: Reputation: 0
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 View Post
Sure: a compiler for what? what programming knowledge do you posess?
 
Old 08-19-2007, 07:05 AM   #6
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
Would this be of any use?

http://cocom.sourceforge.net/
 
Old 08-22-2007, 12:00 PM   #7
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
Do you already have an interpreter?
 
Old 08-22-2007, 01:31 PM   #8
ankit4u1
Member
 
Registered: Apr 2006
Distribution: Red Hat, Fedora
Posts: 97

Rep: Reputation: 15
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
 
Old 08-22-2007, 09:31 PM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 7,482

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Thumbs up 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 .. .. ..
 
Old 08-23-2007, 04:24 AM   #10
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 55
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..

Last edited by nx5000; 08-23-2007 at 04:25 AM.
 
Old 08-23-2007, 09:12 AM   #11
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 813

Rep: Reputation: 195Reputation: 195
For hobby or class project?
 
Old 08-23-2007, 12:48 PM   #12
raghuveerbabu
LQ Newbie
 
Registered: Aug 2007
Posts: 20

Original Poster
Rep: Reputation: 0
Question Interpreter

No.. May i know why?

Quote:
Originally Posted by archtoad6 View Post
Do you already have an interpreter?
 
Old 08-23-2007, 12:50 PM   #13
raghuveerbabu
LQ Newbie
 
Registered: Aug 2007
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks

Ya.. Thanks for ur info...

Quote:
Originally Posted by ankit4u1 View Post
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
 
Old 08-23-2007, 12:51 PM   #14
raghuveerbabu
LQ Newbie
 
Registered: Aug 2007
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks

Ya thank you for ur info...

Quote:
Originally Posted by sundialsvcs View Post
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 .. .. ..
 
Old 08-23-2007, 12:53 PM   #15
raghuveerbabu
LQ Newbie
 
Registered: Aug 2007
Posts: 20

Original Poster
Rep: Reputation: 0
Hobby

Just for hobby...

Quote:
Originally Posted by AnanthaP View Post
For hobby or class project?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
checking for C compiler default output... configure: error: C compiler cannot create fiorejm Linux - Software 6 11-12-2009 01:35 PM
LXer: Democratization, Writing and Writing Code LXer Syndicated Linux News 0 11-22-2006 06:03 AM
Compiler/interpreter writing dub.wav Programming 6 09-15-2005 09:50 PM
writing a compiler h/w Programming 17 01-20-2004 02:23 PM


All times are GMT -5. The time now is 01:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration