954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

create a simple programming language

Hello all..

is it possible to create my own simple programming language in c++?
complete with the compiler,editor and the libraries..
just a basic model where i can write simple instructions,save it with my own extension
and run atleast a few simple algorithms..

Redhaze46
Newbie Poster
12 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

>is it possible to create my own simple programming language in c++?
Of course it's possible. But it's harder than you probably think.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

how hard?

Redhaze46
Newbie Poster
12 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 
how hard?

Try making a parser first and then you'll start to see the 'how hard'.

gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
 

i have no clue where or how to start, any idea would be immensely helpful..

Redhaze46
Newbie Poster
12 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

For a start, try reading about Lexers, Parsers.

Lex and Yacc by John R Levine.

Also, since you are planning on building a compiler too, try reading this book:
Compiler Design by Aho, Ullman, Sethi

myk45
Posting Whiz
319 posts since Sep 2010
Reputation Points: 57
Solved Threads: 40
 
i have no clue where or how to start, any idea would be immensely helpful..

If I was doing this 'but I'm not' I would investigate here http://epaperpress.com/lexandyacc/

gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
 

You might want to do an easier alternative.

For example, say you write a code in a text file like so :

//code.txt
START_PROGRAM
  print "hello world"
END_PROGRAM

That file contains your new programming language code. Now you can use C++ to read in the file, and parse it accordingly and do proper stuff.

firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You