|
-
Oct 2nd, 2004, 09:42 PM
#1
Thread Starter
Hyperactive Member
Creating a New Programming Language
Hello,
I want to create my own programming language. I had absolutely no idea where to post this, so I did here. The thing is, I'm going to do this on my own and this forum is about getting a team, so admins please move it to where you think. (I just couldn't decide where, heh.)
Please don't post about saying that I shouldn't do this because it's too hard. Obviously, I'm going to go very slow, and won't even go near graphic functions and things, at least for a long long time. I'll just do like print, etc, then keep getting more advanced. OK, enough about that, here's my question.
I was wondering if any of you know any good tutorials, resources, or just anything that would help. I've heard of Flex and Bison. It's something that like helps to create parsers and after that you can make your own, etc. Obviously, the whole project will take a while, so right now I'm just gathering resources and then will read them later. You can also post ideas like how I would construct this or something.
Mainly, I just want to know what programming language I will be working with to create this new programming language. I think C/C++ would work, wouldn't it? I don't think I'll go near ASM, and if it's required then I suppose this project won't work out, because I have absolutely no knowledge of ASM.
Alacritous
-
Oct 3rd, 2004, 07:59 PM
#2
Thread Starter
Hyperactive Member
-
Oct 4th, 2004, 03:00 AM
#3
-
Oct 4th, 2004, 03:40 AM
#4
Nothing mentioned about writing a new operating system (which wouldbe a thankless and pointless task) but rather about writing a new programming language
If this is a learning experience I suggest writing a new language to target the .NET platform - the CLR has a bunch of classes to make this easier and there are quite a few good examples around.
For example there is Ook# - a .NET langauge for orang-utans
-
Oct 4th, 2004, 03:40 PM
#5
Thread Starter
Hyperactive Member
Originally posted by Merrion
Nothing mentioned about writing a new operating system (which wouldbe a thankless and pointless task) but rather about writing a new programming language
Yeah, heh, at first I thought I was crazy. But I would never consider making an operating system. (although I did, along time ago when I thought VB6 could make one, LOL. At least now, I won't.)
I want to write it in C/C++... and not based upon .NET...
Like you said, it is for just learning... And like I said, I'm only going to get the very basics, like print and maybe variables, etc. I will start from the basics.
So, it's possible in C/C++ right?
Just wondering on ideas. Like where to start?
Thanks,
Alacritous
-
Oct 4th, 2004, 05:34 PM
#6
First you need to define the syntax of your new language.
For this have a read of the works of Chomsky on well formed grammars
Then you define your tokens (keywords, operators etc.) and write a parse and tokeniser.
Then you take your tokenised output and pass it to the compiler. You can create your onw if you wish but there are a number of open source C++ coded compilers.
Then you wonder why you did this in the first place...
-
Oct 4th, 2004, 05:49 PM
#7
Thread Starter
Hyperactive Member
Thanks! More info is great for google! (What, like 50 pages now? Not quite yet...)
Yeah, I've been (and still ) looking for articles and resources. I've read stuff about parsers, etc...
Originally posted by Merrion
For this have a read of the works of Chomsky on well formed grammars
Where can I find this?
Originally posted by Merrion
Then you wonder why you did this in the first place...
I know you meant it to be a little sarcastic and funny (or not?), but I'll answer serious anyway .
Well, before I even posted, I thought about it alot. I knew it would take a very long time, but I kept the "anything is possible" (flying, well...) quote in my head. I just need to follow my goals, etc.
Alacritous
Last edited by alacritous; Oct 4th, 2004 at 08:20 PM.
-
Oct 6th, 2004, 03:57 AM
#8
(You would probably do well to buy a book to help in creating your own language - I did it as a module in my university course and after 1 term we had a pretty stupidly basic language written...and I have forgotten much of that.)
OK - Syntaxes.
When you create a new language you need to create the syntax structure. This is a tight definition which specifies what statements are legal and how they fit together.
For example the syntax for an IF branch might look like:
Code:
IF_BRANCH ::=
IF logical_expression THEN
statements
[
ELSEIF logical_expression THEN
statements
]*
[
ELSE
statements
]
END IF
-
Oct 6th, 2004, 04:01 AM
#9
This says that an IF statement consists of
The keyword IF
followed by a logical expression
followed by the keyword THEN
followed by statements
Optionally followed by one or more groups of..
(
The keyword ELSEIF
followed by a logical expression
followed by the keyword THEN
followed by statements
)
Optionally followed by one only group of...
(
The keyword ELSE
followed by statements
)
followed by the keyword END IF
-
Oct 7th, 2004, 05:56 AM
#10
Fanatic Member
-
Oct 7th, 2004, 03:24 PM
#11
Thread Starter
Hyperactive Member
Not like this is a project log or anything, but the "project" will be on hold until I install Linux.
Thanks for your ideas and everything. Since I'm not so well at ASM (truth: I can only print like 1 letter, lol) I'll probably just convert "my language" into C++ and use an open source compiler. I'm still researching some things, but thanks alot!
About the Linux:
It is installed but there are some problems so if you can help me install linux go to the LinuxQuestions.org Post (start) or the second page, more recent, LinuxQuestions.org Second.
Alacritous
-
Oct 7th, 2004, 05:38 PM
#12
you go the hardest/most powerful way...
I disagree with this statement - you can not possibly write a better optimising compiler than that written by Intel .. and even the Borland and Microsoft ones are better than you will match.
-
Oct 7th, 2004, 06:10 PM
#13
Thread Starter
Hyperactive Member
It seems we all have different ideas...
This is probably sarcasim but, I probably won't make more than 10-15 functions/etc.
Alacritous
-
Oct 12th, 2004, 05:52 PM
#14
Thread Starter
Hyperactive Member
I'm still trying to install Linux (some problem or bug or something... going for the Fedora distribution)
But I just had some thoughts...
So, say I use some language (C , C++, VB6) and I scan through my new language, for example the following:
consay("saying a message in the console")
I program the langauge (C, C++, VB6) to look for the words consay and the syntax such as (, ", etc. Then, I write to a text file and translate the code I wrote into C (like printf instead of my consay). Then I pass the text file to an open source C compiler. Whala, my program...
Would this work? Also can I have your ideas?
Alacritous
-
Oct 16th, 2004, 12:31 PM
#15
PowerPoster
Pointing out the obviouse
Just a little note to all those who believe it is okay to write your own langauge based on c++.
That sounds like someone saying "I'm goona put a new body onto my rusty old car". The car now has a new body, still has the same engine, transmission, tires, axels, shafts, wires.....In the case the car was broken, a new body won't help.
Well C++ aint broken, why fix it?
Why create a new language based off of C++? Then you really didn't create a new language did you.
If you want to create your own language. Assemble is the way to go.
I do not know much about assemble, all I know is that you can code assemble in c++, I aint sure about any other way to compile assemble.
If you want to create your own langauge, start from scratch. If your langauge needs a c++ compiler to run, then it is a c++ language.
See, most all languages have a high-end and a low-end...some have a middle.
VB for example (i'm just guessing here)
high-end --> VB itself
low-end --> C++
all vb code is compiled and used as c++, or least links to c++ libs, and dll's
now for c++
high-end --> C/C++ itself
low-end --> Assemble
C++ code is directly translated into assemble code...You see the structure yet.
now for Assemble
high-end --> Assembly itself
low-end --> This is a hard one to say...But I guess binary, 0-1, voltage ammounts, straight instruction sets to the cpu...
The only thing lower than assemble would be the code on the chips on your motherboard.
Last edited by Halsafar; Oct 16th, 2004 at 12:38 PM.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
-
Oct 16th, 2004, 05:16 PM
#16
Thread Starter
Hyperactive Member
I understand...
I'm not trying to make the best programming language. It's just for experimenting and fun. Oh yes, and saying to newbies that are just learning to program, "hey, you can use my language" . Then after they figure out it only has 20 functions/subs/etc they ditch it.
I think that explains what I'm aiming for.
Alacritous
-
Nov 6th, 2004, 08:10 PM
#17
-
Nov 6th, 2004, 08:53 PM
#18
Thread Starter
Hyperactive Member
Originally posted by ice_531
Seems rather pointless, it won't help you further your programming knowledge anymore
Actually it would. If I transfer the "programming language" I wrote into C, it would be help me understand C, since I am actually learning it now. It just depends on how many commands I do. The more I do, the better I'll know C.
It's kind of like this: you learn better from teaching. Well if I teach the computer my langauge by transfering it from C, I'll learn C better.
Alacritous
-
Nov 6th, 2004, 10:13 PM
#19
Frenzied Member
Originally posted by alacritous
Actually it would. If I transfer the "programming language" I wrote into C, it would be help me understand C, since I am actually learning it now. It just depends on how many commands I do. The more I do, the better I'll know C.
It's kind of like this: you learn better from teaching. Well if I teach the computer my langauge by transfering it from C, I'll learn C better.
Alacritous
Then the whole point is to learn C better, in which case my other statement stands proven. "it will just be time consuming and useless"
:::`DISCLAIMER`:::
Do NOT take anything i have posted to be truthful in any way, shape or form.
Thank You!
--------------------------------
"Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
"Finaly I can look as gay as I want..." - NoteMe
Languages: VB6, BASIC, Java, C#. C++
-
Nov 6th, 2004, 10:17 PM
#20
Thread Starter
Hyperactive Member
Well whatever. I didn't do it just to learn C better, but owell. I'm going to do it, I guess. I've actually been so busy that I havn't done like anything. Once I get time, it shall start.
Alacritous
-
Nov 6th, 2004, 10:37 PM
#21
Frenzied Member
I don't mean to discourage you in any way, im just wondering why you want to do it lol
you must be held against your will by russians or something
:::`DISCLAIMER`:::
Do NOT take anything i have posted to be truthful in any way, shape or form.
Thank You!
--------------------------------
"Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
"Finaly I can look as gay as I want..." - NoteMe
Languages: VB6, BASIC, Java, C#. C++
-
Nov 16th, 2004, 10:16 AM
#22
I wonder how many charact
The most difficult part of creating a programming language is probably going to be building the compiler.
You can lay out your structure and syntax first.
But the most difficult hurdle will be this:
say you have:
Dim I As Number
Target I = 0 To 50
Print "HI"
Run Target
How do you go about converting that to even a low-level language such as C?
You have to keep references, allocate memory from the stack, manage scope, and more... I mean its really going to be a waste of your life no offense.
You want to do something really cool... build a biological computer that uses living cells for memory. Then you can be the first to build a programming language for that computer. Now, that would be something useful and a learning experience.
-
Nov 17th, 2004, 02:01 AM
#23
PowerPoster
I just read this whole thread and trust me, you are no where near a good enough programmar to even be thinking about creating your own language.
Graduate High School then get a PHD in Computer Science then sit down and think about writing a new language.
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Nov 17th, 2004, 05:00 PM
#24
Thread Starter
Hyperactive Member
All I'm doing is a few subs/functions. I convert "my language" into C and feed it through a C compiler. Very simple.
Now obviously I'm not good enough to actually make a compiler and all that crap in assembly or whatever, I'm fourteen years old!
Alacritous
-
Nov 21st, 2004, 11:35 PM
#25
Member
a big LOL!!!
sorry but I can't do anything else...
-
Nov 22nd, 2004, 09:18 PM
#26
Thread Starter
Hyperactive Member
Yeah and a LOL at all you people discourage me.
You know, you can do anything as long as you put your mind to it. I guess you guys don't realize it. Is there a problem with an interest in not just this, but anything? You guys should be ashamed of yourself.
You know what, maybe if I don't complete the project, but at least I learned a heck of a lot researching about it. I'm young, and I'll admit it, I'm 14, but anyway, I'm still wondering about my career and just want to experiment. I never said I'm an expert programmer looking to invent the next C/C++ or whatever language.
I'll say this right now, I probably won't complete it, because there really is no reason, but it sure was fun researching about it all.
Alacritous
-
Nov 23rd, 2004, 07:22 PM
#27
Member
Take it easy!
Come man! Take it easy!!!
I know, I thought the same things years ago. But let me tell u something: you will loose ur time.
Try to read manuals about C/C++ and try to learn it. Don't waste your time making unnecesary things. Use your time reading things about real programming languages.
But listen, I'm not trying to disturb you, just giving some tips about learning.
If you wanna continue, go ahead. And try to make your best. Some day I was 14 and I was thinking about making programing languages and operative systems, but you know... time teaches you lot of things and one of those: don't loose your time making unnecesary things. Use your time making things that doesn't exist or improve other created by others.
Sorry for my last message, it causes me laught. 
Have a nice day!
-
Nov 23rd, 2004, 07:41 PM
#28
Frenzied Member
lol "Looses time"
ie. Wastes time - American
:::`DISCLAIMER`:::
Do NOT take anything i have posted to be truthful in any way, shape or form.
Thank You!
--------------------------------
"Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
"Finaly I can look as gay as I want..." - NoteMe
Languages: VB6, BASIC, Java, C#. C++
-
Nov 23rd, 2004, 10:16 PM
#29
Member
Yeah lol!
Lol! Sorry for my broken english :P
-
Nov 24th, 2004, 10:51 PM
#30
Do you want to help with the l33t transl33tor class for the sandpaper project? it's in VB.
-
Nov 24th, 2004, 11:19 PM
#31
Frenzied Member
Originally posted by dglienna
Do you want to help with the l33t transl33tor class for the sandpaper project? it's in VB.
No. Don't corrupt his youthful mind with your the frogs nonsense sand materials!
:::`DISCLAIMER`:::
Do NOT take anything i have posted to be truthful in any way, shape or form.
Thank You!
--------------------------------
"Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
"Finaly I can look as gay as I want..." - NoteMe
Languages: VB6, BASIC, Java, C#. C++
-
Nov 28th, 2004, 10:19 PM
#32
Thread Starter
Hyperactive Member
Originally posted by dglienna
Do you want to help with the l33t transl33tor class for the sandpaper project? it's in VB.
Who, me?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|