Jump to content
  • Advertisement
Sign in to follow this  
Chad Smith

Create a Programming language

This topic is 4815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I have been interested in programming for a little bit now. So, I looked at C++ and am learning that and I am getting kind of far into it. Now, I see lots of new programmers come into this world but they leave fast cause they find a language that is simple to use and everything! Well, I am hoping to make a SIMPLE programming language. I mean simple as in really nothing advanced. Then, when I start desining(sorry, I am not very good at spelling)it I will make some simple stuff. Just to get people a simple language to start out with. Now, I here it is SIMPLE to design a language. Just write it down on a sheet of paper. Then, I here it is HARD to make the language, as you have to create a compiler(I think I herd that.)So, if someone could point me to a tutorial or some possible links that will get me going in the right direction. I am hoping to spend sometime developing it, before I actually start doing the compiler. I want the language to be thoght through very well. So, if someone could point me in the right direction, then that would rock! Thanks, Chad.

Share this post


Link to post
Share on other sites
Advertisement
Ok. Here is what I would recommend:

1) Develop simple expression evaluator.
2) Make it have variables, define functions, etc(see my website graphing calc applet)
3) Add code blocks
4) Read the dragon book
5) Go from there

Share this post


Link to post
Share on other sites
Read up on BNF and attribute grammars. It turns out it's somewhat trivial to write a parser if you formalize the language with BNF.

Share this post


Link to post
Share on other sites
http://mitpress.mit.edu/sicp/full-text/book/book.html

This will teach you how to write DSL's, domain-specific languages, which are easier to write than a whole new programming language.

If that's not what you want, I suggest a language that has minimal syntax: something like Forth or Lisp would appropriate. Their syntaxes are so dead simple that you shouldn't waste too much time writing it.

Share this post


Link to post
Share on other sites
Look into GCC front ends. You'll have to write a parser and a converter to GCC's internal formats but it'll handle the rest.

Share this post


Link to post
Share on other sites
Thanks everyone!

I will look into those links and look into some other stuff. Maybe if I like this idea of doing this I will try to spend a while in making my own REAL programming language that even people who know C++ or VB or something along those lines could pick up and enjoy also. But, I will just have to write this SIMPLE language first. I will look into it!


Chad

Share this post


Link to post
Share on other sites
Writing a compiler for a programming language is a large and difficult project. To prepare for the big project, start with something smaller -- like something that solves math expressions.

First, with no variables:
    > (4*2^2-4*2*3)/(2^2-3^2)
1.6
Then add variables:
    > z = (4x^2-4xy)/(x^2-y^2)
> x = 2
> y = 3
>
z = 1.6
Also, writing an interpreter for your language rather than a compiler would cut out a lot of work.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!