I want to try and create my own very basic language, with it's very basic compiler. All using Java.

For now, it will only need to enable to 'programmer' to print things to the screen.

I had an idea for how to do this, and what I wanted to know is: Will this be considered an actual 'compiler', an actual 'language', and an actual 'virtual machine'? (All very, very basic of course).

My idea was to create a program which will serve as the 'IDE' (editor and compiler), and another one which will serve as the 'virtual machine'.

This means that the IDE will not compile the written code to some existing machine code, like the Java Bytecode, but will actually compile to some kind of compiled code made up by me.

This compiled code will only be understandable by my 'virtual machine' program, and will only be able to run inside this program. The 'virtual machine' program, will use high-level Java operations in order to understand and execute the compiled code.

The 'virtual machine' program will be a Java program, running on the JVM.

My question is: Conceptually, is this considered a virtual machine, and 'machine code'? If not, is this still considered a 'programming language', even though it's compiled bytecode can only run inside a specific program?

1 Answer 1


Sure it is. Everything that introduces another level of interpretation into the computing stack is a virtual machine that a programmer can target. It may not become a very complete or successful one unless you put insane amounts of effort into it, but your claim to the technical term is valid.

"Machine code" is a more restricted term. Surprisingly, the convention is not to call code that runs on a virtual machine "machine code", but "byte code". "Machine code" is usually understood to mean code to be run on a physical microprocessor, i.e. a stream of its opcodes. Anything below that is micro code, and anything above is either "byte code" or just "code" (Java code, Python code, etc.)

  • Thanks for your answer. Even if my 'virtual machine' doesn't 'run constantly' like the JVM, but only when specifically executed, is it still considered a 'virtual machine'?
    – Aviv Cohn
    Mar 3, 2014 at 9:31
  • Also, my 'virtual machine' will use high-level Java operations (as it's written in Java), in order to understand and execute the bytecode. Is it still considered a virtual machine?
    – Aviv Cohn
    Mar 3, 2014 at 9:32
  • @Prog The JVM also runs only when explicitly executed. It's totally OK to have a very high-level byte code, often this is also beneficial for performance. For example the perl interpreter is actually a VM that operates on very coarse opcodes – any builtin function (like split or print) is an opcode of it's own. In Perl's case these opcodes are not bytecode, because they form a directed graph in memory instead of being a flat sequence of instructions. This mainly removes the need for decoding the bytecode, and makes incremental compilation easier.
    – amon
    Mar 3, 2014 at 10:52
  • @amon Does bytecode have to be of binary form, aka composed of only 1 and 0 sequences? Or can it include more kinds of numbers, and even words? Generally, my idea for my bytecode is to have it include the commands the program includes, in the appropriate order, but instead of having "print" written in it, it will have some number to represent it. Is this approach existent anywhere? Is it considered bytecode?
    – Aviv Cohn
    Mar 3, 2014 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.