![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#31 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#32 |
|
Programming Guru
![]() ![]() ![]() |
@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." |
|
|
|
|
|
#33 |
|
Expert Programmer
|
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.
|
|
|
|
|
|
#34 |
|
Programmer
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 3
![]() |
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. |
|
|
|
|
|
#35 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
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 |
|
|
|
|
|
#36 |
|
Programmer
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 3
![]() |
Yes, the title's correct, but I got the instruction set reference as one document.
|
|
|
|
|
|
#37 | |
|
Hobbyist Programmer
Join Date: Oct 2005
Posts: 134
Rep Power: 3
![]() |
Quote:
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. |
|
|
|
|
|
|
#38 | ||
|
Caffeinated Neural Net
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 895
Rep Power: 4
![]() |
Quote:
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:
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp |
||
|
|
|
|
|
#39 |
|
Hobbyist Programmer
Join Date: Jul 2005
Posts: 158
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#40 |
|
Programmer
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 3
![]() |
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! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|