Java Compiler - Load Method
Posted
by Brian
on Stack Overflow
See other posts from Stack Overflow
or by Brian
Published on 2010-04-24T02:41:49Z
Indexed on
2010/04/24
2:53 UTC
Read the original article
Hit count: 293
java
So I have been working on a java project where the goal is to create a virtual computer. So I am basically done but with one problem. I have created a compiler which translates a txt document with assembly code in it and my compiler has created a new-file with this code written as machine executable ints. But now I need to write a load method that reads these ints and runs the program but I am having difficulty doing this. Any help is much appreciated....also this is not homework if you are thinking this. The project was simply to make a compiler and now I am trying to complete it for my own interest. Thanks.
Here is what I have so far for load:
public void load(String filename)
{
FileInputStream fs = new FileInputStream(filename);
DataInputStream dos = new DataInputStream(fs);
dos.readInt();
© Stack Overflow or respective owner