Is this a real interpreter??

Hello. I am writing an assembler intended to be interpreted by a software. The software reads a file, break it into lines, separate commands, identify opcodes and check arguments and implement an assembler function that does that function internally inside the body of program as a C++ code later compiled and called with the arguments taken from scripts. This app doesn't compile into binary code. Can be this considered a simple interpreter?? Please let me know if you know places where to write interpreters. This is an app that I am making by myself without prior experience with real source. Thanks for your help. I am very happy with this forum.
implement an assembler function that does that function internally inside the body of program as a C++ code later compiled and called with the arguments
Are you saying that the output of your assembler is C++ code? That would be more appropriately called a code generator.

I am writing an assembler intended to be interpreted by a software.
Taht sounds more like your assembler is creating byte code to be interpreted later.

So what exactly is the output of your "assembler?" Can you give an example of a couple input ("assembly") instructions and the output that your program creates?
i only do this: The assembler just calls c++ real functions that modify its behaviour based in the arguments passed by the file.

Example.

mov eax, ecx.

This calls internally a mov function.

int mov(int to, int from)
to = from;

This is the way that i do to resolve arguments and a mov function.
in programming terms, an interpreter is a tool that reads source file(s) and executes them *as it goes*. They typically do not have a ton of look-ahead capability, they just go to the starting point (eg main line 1 in c++ terms) and try to execute that, and then the next statement, etc. If there is an error in a subroutine, it typically executes until it hits the bad statement and stops there, unlike a compiled language where it error checks it before it renders running code. Basic, python, javascript are examples.

If your program is not doing the above, it is 'something else'.

Java is an extremely complicated study, using a mix of ideas from both approaches, if you want to get in deep water.
Last edited on
mov eax, ecx.

This calls internally a mov function.

int mov(int to, int from)
to = from;

Yes, that's an interpreter.
Thanks for your answers.
Topic archived. No new replies allowed.