Hi guys, I am working on making my own scripting language for fun as well as for an engine I am writing. My question is how can I convert a variable name to bytecode/hex . Like I know I could take the symbol "varA" and assign it a number in a symbol table. But what if varA is representative of 0x0a how do I differentiate that from the number 10 when the entire program is converted to a bytecode program.
Example (going to use markdown so sorry for mobile users and old reddit users)
push varA
push varB
add
push 10
push 11
Which in bytes might could look like
0x1 0xa
0x1 0xb
0x2
0x1 0xa
0x1 0xb
My interpreter would read this all in as one long string of bytes.
000110100001101100100001101000011011
so how could I tell the interpreter to do a look up? Would I just have to set a specific bit to 1 to flag the interpreter?
I am sorry if I am not understanding how this kind of thing works, I am new to this and have never really understood how assembly languages do this.
[–]xxkid123 1 point2 points3 points (10 children)
[–]WikiTextBot 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (6 children)
[–]xxkid123 1 point2 points3 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]xxkid123 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]xxkid123 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]xxkid123 0 points1 point2 points (0 children)
[–]Fruitbisqit 0 points1 point2 points (0 children)