We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,680 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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..

7
Contributors
9
Replies
2 Years
Discussion Span
8 Months Ago
Last Updated
11
Views
Question
Answered
Redhaze46
Newbie Poster
12 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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
Team Colleague
15,460 posts since Sep 2004
Reputation Points: 6,483
Solved Threads: 1,407
Skill Endorsements: 55

how hard?

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

how hard?

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

gerard4143
Nearly a Posting Maven
2,295 posts since Jan 2008
Reputation Points: 512
Solved Threads: 397
Skill Endorsements: 0

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
Skill Endorsements: 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 Pro in Training
417 posts since Sep 2010
Reputation Points: 60
Solved Threads: 50
Skill Endorsements: 0

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,295 posts since Jan 2008
Reputation Points: 512
Solved Threads: 397
Skill Endorsements: 0
Question Answered as of 2 Years Ago by gerard4143, Narue and myk45

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
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

how would this be done, the parsing of a text file

blueOkiris
Newbie Poster
1 post since Oct 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Would you start a new thread for your question.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0819 seconds using 2.67MB