Is this a good approach for first attempt to create my own language and compiler? I want to try to create my own very simple programming language and it's compiler or interpreter.

The programming language I use is Java.

My idea was to create a compiler which will compile source code of my created language to some kind of intermediate code (nothing binary or complex, just plain text), and then have another program (a kind of virtual machine or interpreter) which will execute this intermediate code in Java.

For example, the 'programmer' types: write "hi world". The compiler turns it to some intermediate code like w-hi world. The VM/interpreter program reads this intermediate code and executes System.out.println("hi world");

My question is:

Is this approach common with programmers who want to try to create a simple language for the first time? Is this a good way to start?

I searched this site and came across questions on this subject, but the answers were more complex and technical than what I'm looking for.
That sounds like a fine way to start, and you'll become familiar with the issues involved.

How's it going?

At a certain point, consider learning more about programming language implementation techniques from


a book like Compilers: Principles, Techniques, and Tools (2nd Edition)
open courseware for MIT's Computer Language Engineering course
a MOOC like Udacity's Programming Languages: Building a Web Browser
Stanford's Programming Languages course


It's also worth investigating libraries to use such as parser generators, although some people swear by the recursive descent parsing approach as easier to build, also good at generating helpful error messages.

Another tip: It's easier to implement a programming language in a language like Clojure than Java. (Clojure is a modern Lisp dialect that's hosted on Java.) E.g. your intermediate representation could be a list of Clojure forms. They handle reading &amp; writing as readable text, and you can construct &amp; interpret (eval) them quicker and easier than text.