Page 3 of 3

Re:Making your own programming language...

Posted: Wed Jun 18, 2003 2:41 am
by Andrew_Baker
If you want to make the language just for practice, and not any particular practical reason, you could make a virtual machine. My Java textbook had a VM as a project throughout the whole book. Basically, you design a virtual computer and its instruction set and let it rip. This would probably fall into scripting languages instead of compiled languages, but if you just need some toy project to sharpen your axe, it would be very manageable, and you could write it in whatever language you wanted.

Re:Making your own programming language...

Posted: Wed Jun 18, 2003 10:20 am
by CrYpTiC
So it would be easier to learn languages inorder to make languages? What langauges do you suggest? Assembly? C++? Perl?

Re:Making your own programming language...

Posted: Wed Jun 18, 2003 9:38 pm
by Andrew_Baker
For raw power, I like C. For clarity, I prefer Python. For sheer arcane weirdness, I prefer AGI. :D

Re:Making your own programming language...

Posted: Thu Jun 19, 2003 5:13 am
by persep
Andrew_Baker which java textbook do you refer with the VM project?

Re:Making your own programming language...

Posted: Fri Jun 20, 2003 12:55 am
by Andrew_Baker
I just double-checked, and I couldn't find that project in any of my language texts. This leads me to wonder where I *did* see that project. It wasn't complicated or anything. All it did was accept data from a CLI or file, tokenize it, put it in a stack, and then used a few control structures (predominantly a switch statement for the tokens) to execute the script/code.

I DO know that a similar technique was demonstrated in Bjarne Stroustrop's The C++ Programming Language, but that was for a Reverse Polish Calculator. This exercise was very similar to the VM I originally referenced.

But now that's bugging me... Where DID I see that project?

Re:Making your own programming language...

Posted: Fri Jun 20, 2003 12:14 pm
by df

Re:Making your own programming language...

Posted: Mon Jun 23, 2003 10:51 am
by lacrymology
My advise would be to first read whatever you can get your hands on about:

Lex and Yacc

or

Flex and Bison

or

JavaCC

These tools allow you to worry about the grammar of your language first without having to worry about building your own scanner and parser. With a useable grammar you can have a basic parser up and verifying your language within (relatively) no time. If you want to then write your own parser, then you can go back and write it in any language that you'd like (Lex, Yacc, Flex, and Bison use C).

The point is, don't immerse yourself in programming assembly parsers right now... take it slowly and start from the grammar. Once you have a sensible solution there, then start worrying about the full blown implementation.

-m

CrYpTiC wrote: I've always been interested in making my own programming language, but... where would I start. If you wanted to make your own custom programming language, what would you use to make it? Another language? That's where I've always come to a slump...Any answers will help very much.