Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Writing a new programming language

Author
Message
Halo Man
19
Years of Service
User Offline
Joined: 5th Nov 2005
Location:
Posted: 8th Dec 2005 00:30 Edited at: 9th Apr 2006 21:11
You may lock this. My question has been answered. Thanks everyone

Chicago Rush Website: http://chicagorush.servegame.com/
Killswitch
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: School damnit!! Let me go!! PLEASE!!!
Posted: 8th Dec 2005 00:47
I'm actually doing the very same thing right now. I'm programming my language in PureBasic, and the source is freely downloadable. One of the first things you should know is that you don't actually have to write a compiler. You can write an interpreter which 'reads' and understands the code someone has written then does exactly as its told.

'Game Scripting Mastery' is a book many people have recommended, I haven't got it yet (it's fairly pricey if you're skint) but I plan to *christmas prezzie anyone?*.

Something that I've learnt through my experience is that actually implimenting commands is the least of your worries. Firstly you should work out how the whole infrastructure of your compiler, or interpreter is going to work. This includes:

1) Reading/Writing variables. (Structured Arrays)
2) Maths (RPN - Reverse Polish Notation)
3) Syntax (BASIC, ASM-like, C-like, Java-like, hybrid, new)
4) 'Reading' the code (Tokenising)

Secondly you should start small and work up. Try and write a program which can read to and write to variables. Then expand that by including some expression solving capabilities. From there head onto commands.

Here's some posts that might help:

http://forum.thegamecreators.com/?m=forum_view&t=64793&b=2
http://forum.thegamecreators.com/?m=forum_view&t=55568&b=20

(They're both mine, but they should help you too!)

~It's a common mistake to make, the rules of the English langauge do not apply to insanity~
Halo Man
19
Years of Service
User Offline
Joined: 5th Nov 2005
Location:
Posted: 8th Dec 2005 01:27 Edited at: 18th Oct 2006 02:25
Ok thanks! and good luck on your project 1
Halo Man
19
Years of Service
User Offline
Joined: 5th Nov 2005
Location:
Posted: 8th Dec 2005 14:35
Does anyone know how i would start?


Current Project: --
Lines of Code: --
Killswitch
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: School damnit!! Let me go!! PLEASE!!!
Posted: 8th Dec 2005 18:04 Edited at: 8th Dec 2005 18:05
You don't need to use machine code to write a compiler. You can write a compiler in any language, but it has to be capable of producing machine code. You can then use a third party ASM compiler to produce a .exe.

Again an interpreter could be easier in many ways!

A good place to start would be working how how you are going to read and write to variables. Here's how I do it:



That's the system I used to use, I've now ditched it for a stack based system (which uses a lot less memory) but I used to use this system. The very fist thing you should do is write a load of functions for creating variables, destroying them, changing their value and making sure you write the correct type of information to each variable. When that's all in place start developing on a system to create these variables when they come up in your programming language.

Edit:

Also, there's no need to double post

~It's a common mistake to make, the rules of the English langauge do not apply to insanity~
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 8th Dec 2005 19:49
I got Game Scripting Mastery off Amazon market place for £20. Fantastic book A must read on the subject for beginners.

Halo Man
19
Years of Service
User Offline
Joined: 5th Nov 2005
Location:
Posted: 8th Dec 2005 23:37 Edited at: 9th Dec 2005 02:32
Quote: "You can write a compiler in any language, but it has to be capable of producing machine code."


Would Visual Basic 5 count?


Current Project: --
Lines of Code: --
Killswitch
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: School damnit!! Let me go!! PLEASE!!!
Posted: 9th Dec 2005 08:39
Let me rephrase that:

You can write a compiler in any programming language. It doesn't matter. But in order for your program to be a compiler it must produce machine code based on the code your proccessing. You can then use a free, third party compiler to turn the machine code into a .exe. Actually, that's a bit of a lie. You don't nessicarly have to produce machine code, you could produce C code (for example) and then compile that with a free compiler.

It all depends on your aproach.

Your languages code > Your compiler > Another languages code > Free Compiler > .exe

~It's a common mistake to make, the rules of the English langauge do not apply to insanity~
Halo Man
19
Years of Service
User Offline
Joined: 5th Nov 2005
Location:
Posted: 10th Dec 2005 00:41 Edited at: 18th Oct 2006 02:26
Oh, ok!

So I can make my code translate into C++, where a C++ compiler will make the .exe


Wouldnt that be using the C++ language instead of my own though?
unless i don't understand what you are saying.
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 10th Dec 2005 01:16 Edited at: 10th Dec 2005 01:18
Quote: "Wouldnt that be using the C++ language instead of my own though?"

Yep. But, notice why he said that...

Quote: "and then compile that with a free compiler"

Free compilers abound. Thing is, you couldn't sell your product and distribute a compiler with it. If it were a free product, nobody would care.

A project like this is too big to take on without a lot of experience and knowledge. You'll likely end up frustrated.

Any time I start a project, I ask myself - Why am I making this? Is it a fun game? Useful application? Good learning experience?

Your project will probably take you 1000s of hours to finish, be full of bugs (DBP still has bugs), and people won't use it because better languages exist.

Just wait until you know more. Something that might interest you is writing DLLs for DBP. Things like collision and multiplayer are always needed. And, one day, if you decide to make your programming languages, you'll have DLLs waiting in queue for it.

Quote: "Sorry if it sounds like i'm way over my head, but I do have alot of time to put into it"

Or make the greatest game ever, if you have the time. But, don't spend that time fruitlessly.

Good luck.

Halo Man
19
Years of Service
User Offline
Joined: 5th Nov 2005
Location:
Posted: 10th Dec 2005 03:00 Edited at: 10th Dec 2005 03:01
If you want mods, you can lock this.


Login to post a reply

Server time is: 2024-11-16 05:24:38
Your offset time is: 2024-11-16 05:24:38