Hello everyone! Recently I have been incredibly interested in language design/implementation. I have written multiple functioning language front ends (Lexer, Parser, some execution) and have decided a few things. My systems are getting ugly, there needs to be more abstraction I can't execute code in the parser -- it's just not a realistic way to go at the code.
So I thought I would try something new, a virtual machine with an intermediate language that could be generated. So I have created something, essentially a simple stack based assembly like language, example:

; hello world
push "Hello, world!"
print
; some math
push 12
push 3
add
print
; yields 15

This intermediate representation/language is tokenized, parsed, then is sent to a class to be executed directly. I see this being extremely innefficient, and future problems with different functionality. My main question I suppose is how actual process virtual machines are implemented (process virtual machines are things like the JVM).

So are systems like the JVM or Microsoft's CLR emulating any hardware? A processor maybe? Just parsing instructions? How are instructions implemented? I've seen what human readable instructions look like for the JVM but class files appear to be raw binary data, how is this accomplished? Does the JVM and similar systems have a built in assembler type system that takes the human readable instructions down and then the instructions are some how executed, how are they represented? These are all things I'm curious about and how to implement, thanks for any information.

Thanks again!

No ideas?

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.