TapeScript is a interpreted programming language/very rough cpu emulator I built for fun
Feel free to make a PR if you wanna upgrade it
Name | Internal c++ Datatype | How to specify |
---|---|---|
INT | int | How to specify |
REGISTER | std::string | "(register name)" |
STRING | std::string | no explicit specification required |
MEM | int | use 0x prefix on whatever number |
OTHER | std::string/int | no explicit declaration required |
Instruction | Args | Usage |
---|---|---|
LOADA | INT/STRING | Load an integer into the A register either directly or from another register |
LOADB | INT/STRING | Load an integer into the B register either directly or from another register |
LOADC | INT/STRING | Load an integer into the C register either directly or from another register |
REGISTER/MEM/OTHER | Print data either from a register a memory address or directly print whatever is specified in the file | |
STORE | REGISTER | Store data from at the current StackPointer location |
SHIFTLEFT | N/A | Shift the StackPointer left (-1) |
SHIFTRIGHT | N/A | Shift the StackPointer right (+1) |
SET | REGISTER , REGISTER | Set data from any register to any other register |
ADD | REGISTER , REGISTER | Compute add operation of the data in the two specified registers and store in the "MathOp" register |
SUB | REGISTER , REGISTER | Compute subtract operation of the data in the two specified registers and store in the "MathOp" register |
JMP | LABEL | This will change the "InstructionPointer" register to the location of the specified label |
IF | REGISTER , REGISTER , (any instruction) | if the data in two specified registers is equal execute anything placed after the second register |
Does it do much?
No.
Is it useful?
No.
Does it work?
Mhmm kinda...
Why does a programming language have registers?
To be honest i have no idea
Ive now seen how amazing this code is how do i use it?
Simply clone the directory and run make i have only used standard g++ libs
and one linux lib
if you dont have the linux lib take it out and replace
main.cpp:103 system("clear")
and main.cpp:97 sleep(clockSpeed)
with your operating systems equivalent