0 Members and 1 Guest are viewing this topic.
...I am creating an interpreted programming language in C++...
The source will be interpreted directly for difficulty purposes (Creating a virtual machine etc.). EDIT: Meaning creating bytecode would be too hard.
While(A>0){B=B+1;C=C+2;};
TEST_GREATER(A,0); // Tests if arg1 is greater than arg2 and returns 1 if it is, 0 otherwise.IF_NOT_GOTO(ANS,+6); // If Not(ANS) is true, then GOTO the opcode 10 commands after this one (code after the while loop)INC(B,1); // Increment B and store result in ANSSETVAR(B,ANS); // Store the incremented value of B to the variable B, overwriting the old valueINC(C,2);SETVAR(C,ANS);GOTO(-6); // GOTO the opcode 6 opcodes before this one (The condition test)