Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 28th, 2005, 8:44 AM   #31
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
The first thing you need to do before attempting to write your own language is to learn what a language is and does. As someone mentioned in another thread, you aren't going to design a new and better carburetor if all you've ever done is put gas in your car. I mean, think. Get real.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Oct 28th, 2005, 9:01 AM   #32
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
@coldDeath - Could you elaborate on this for me? "Fedora has been f*cked with by Redhat."

You can do anything you put your mind to, however, the point at which you start and the knowledge you have that you are basing your foundation on is what makes or breaks your attempt.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Oct 28th, 2005, 10:15 AM   #33
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
Ask the guys over at #programmingforums who tried to help me with it. We found about 10 bad things with it.
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote
Old Nov 16th, 2005, 6:06 AM   #34
SittingDuck
Programmer
 
SittingDuck's Avatar
 
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 4 SittingDuck is on a distinguished road
I'm writing my own compiler, too.

One way to do it is to compile it into assembly language. Alternatively, like what I am doing, create machine code directly. For x86, there is a massive document available somewhere at intel.com that describes instruction formats and all the instructions, etc. Ask me if you want a link and I'll try to find it for you.
SittingDuck is offline   Reply With Quote
Old Nov 16th, 2005, 7:50 AM   #35
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
http://www.intel.com/design/pentium4.../index_new.htm
Is this what you mean?
By the way, check out cross-compiling.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Nov 16th, 2005, 12:31 PM   #36
SittingDuck
Programmer
 
SittingDuck's Avatar
 
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 4 SittingDuck is on a distinguished road
Yes, the title's correct, but I got the instruction set reference as one document.
SittingDuck is offline   Reply With Quote
Old Nov 16th, 2005, 6:04 PM   #37
Kaja Fumei
Hobbyist Programmer
 
Join Date: Oct 2005
Posts: 134
Rep Power: 4 Kaja Fumei is on a distinguished road
Quote:
Originally Posted by SittingDuck
Yes, the title's correct, but I got the instruction set reference as one document.
You can order the manuals in book form for free from Intel's website. I have them. They're great. Didn't even have to pay shipping.

I agree with the recommendation to make a simple interpreter first. But look up tutorials and source code for making simple four-function calculator programs. Believe it or not, they're a good first step for beginners.
Kaja Fumei is offline   Reply With Quote
Old Nov 18th, 2005, 12:24 PM   #38
lectricpharaoh
SEXY SHOELESS GOD OF WAR!
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,188
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by aznchong91
BTW, I am actually not planning to make any really powerful language, just a simple one designed to make small apps. For me, this is both a learning experience, and also (hopefully, if I can get this to work) part of my Personal Project (for school, you don't need to know about that). So would this mean a compiler would be more suitable?
Just one for small apps, eh? Well, you should know that many of the most 'simple' operations, such as getting input from the user, can be tricky.

Then there's the simple matter of parsing the source code. You need to be able to break it down into tokens (individual 'words' of code), check those for basic errors (such as misspellings and such), and create some kind of representation that can be converted to either executable code, or some interim format (such as source code for another compiler or assembler).

If you're actually set on this, I'd recommend writing some basic scripting language instead. Lots of people create custom script languages for their programs. Games which have script-driven AI and events are one example, and 3D modelling programs which have a modelling language are another. With very few exceptions, these sorts of things are interpreted, and of those that are 'compiled', they are often compiled down to some bytecode that is not actually an executable image.
Quote:
Originally Posted by aznchong91
Anyway, back to the compiler. Was I right in saying that you run the compiler and make a .asm file from the code and then assemble it for the .exe? Could I do that?
This is not necessarily the case, but it is indeed how some tools operate. For example, GCC uses C source files as input, and generates assembly source files as output, and then feeds those to an assembler to generate the object code, which is then fed to a linker to generate the final executable.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote
Old Nov 19th, 2005, 8:46 PM   #39
teencoder
Hobbyist Programmer
 
teencoder's Avatar
 
Join Date: Jul 2005
Posts: 158
Rep Power: 0 teencoder is an unknown quantity at this point
Listen just because you want to and think you might able doesn't mean you can just jump right in to it. I to want to write my own language and make my own OS. I realize however I have to build up. I still can't get Direct X to work there is no way I could make a programming language. You don't have to write your compiler in assembly in fact the visual languages are written in C++. Just work your way up. If it's about the effort write a cool game in java that should be enough effort.
__________________
Geeks may not be cool now but in the long run they prosper.
teencoder is offline   Reply With Quote
Old Dec 4th, 2005, 6:24 AM   #40
SittingDuck
Programmer
 
SittingDuck's Avatar
 
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 4 SittingDuck is on a distinguished road
http://webster.cs.ucr.edu/AsmTools/RollYourOwn/

From here you can download a load of PDFs that form a "compiler theory documentation". Read it! It's a bit long, but it's what I've been looking for. The author's page is:
http://www.scifac.ru.ac.za/compilers/

Yes, the source must be broken down into tokens. But then these tokens must be parsed into syntactical structures. Usually a syntax tree is made. The syntax tree is then checked (semantic checker), mostly this comprises type checking. From this tree intermediate code is generated (optional for small compilers but v. useful), optimized and converted to the code of the target machine.

I'm learning a lot!
SittingDuck is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:23 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC