Hey, I have been looking for help on this matter for some time now and hopefully I can find it here. I would like to create my own computer programming language - just for fun. I have a very good knowledge of C++ and so that is the language I would like to create my programming language in.

However, obviously I don't want to rush this and don't intend to start coding any time soon because I do not understand all of the theory behind creating a language (I understand the basics though) - this is what I need help with.

I intend for my language to be interpreted but I do not want it to be a, for want of a better phrase, "wrapper" for another language, e.g. parses code into C++ and then compile the C++ code.

I understand the basic theory of interpreted programming languages, however not the more advanced concepts. My knowledge pretty much stops at the keywords being parsed :P

Could someone perhaps help me, by reccomending a book, a tutorial etc?

Many thanks,
$witch3d

Recommended Answers

All 7 Replies

So writing your language inside a text file and using C++ to read it
and interpret it and compile it not an option?

I am sorry if I have made a mistake in my initial post/caused confusion but what do you mean by your message?

You said that you wanted to create your own language. I suggested
that you create your own language inside a text file, and prase it using
C++ and compile it.

If you wan't to create it from scratch, then you probably need to learn
assembly or some other low level language.

I see what you mean. Well ideally I would like to create my own language from scratch - however, I will also consider you idea as an alternative. Thank you for your advice, and I will learn assembly language.

I also found a great E-Book called: "Compilers - Principles, Techniques and Tools Second Edition" which is a rather large read but still really useful.

Again, thank you for your suggestions and I am still open to ideas if anyone else has any.

commented: I doubt your e-book is a legit copy, it is still in print -3

Assembler will really slow down your development process. It takes much longer to write most programmes in assembler than a higher-level language. If you know C-whatever, code in that language.

Computer languages are best kept simple so a simple programme can process them:
0)Create a syntax
1)Check syntax or the source file is meaningless.
2)Parse the syntactic elements onto a stack or data structure.
3)Unwind the stack/scan the structure to execute the programme applying operations to data/variables.

If you can do these three steps in one pass, you go to the head of the class. For a beginner, perhaps three passes is the way to go.

Then, there is the question of whether we need another language or should we look for killer apps or better ways to use the languages we have now... :-) It is amazing what we can do now. Will another language solve any problem? If I were contemplating a new language it would be something for automating generation of software or getting clusters of computers to work together. I am not sure an interpreter can do that. If it could, a compiled language could do the job ten times faster.

Thank you for your input, you definitely cleared a few things up for me :)

Would the three steps you have described to me be the same for an interpreted and compiled language - or do the three steps represent an interpreted language?

I was writing for an interpreter. For a compiler, instead of executing the programme, code would be produced.

I was thinking about interpreters recently. I had a database transaction which was taking a long time. I thought I could make it a bit faster using a compiled language. Nope. Because the database transaction was taking some time, it was the biggest part of the work. Changing to a compiled language made almost no effect. I had to figure out the fastest database transaction to optimize things.

It used to be that compilers were considered to produce code ten times faster than an interpreter but you can develop and debug interpreted code twice as fast. Maybe we need languages for which there are both compilers and interpreters to get the best out of both worlds.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.