Make a 4-bit microprocessor emulator, speciciations:
16-bytes of addressable memory (0-15)
16 instructions (8x1-byte and 8x2-byte)
2 registers (R0, R1)
Think registers as "working memory" you read values in from memory, modify them, write them out to memory add the registers, subtract the registers etc etc.
Here are the commands:
0 = Halt
1 = Add (R0 = R0 + R1)
2 = Subtract (R0 = R0 - R1)
3 = Increment R0 (R0 = R0 + 1)
4 = Increment R1 (R1 = R1 + 1)
5 = Decrement R0 (R0 = R0 - 1)
6 = Decrement R1 (R1 = R1 - 1)
7 = Ring Bell
2-byte Instructions, value of the second byte is called <data>
8 = Print <data> (The numerical value of <data> is printed)
9 = Load value at address <data> into R0
10 = Load value at address <data> into R1
11 = Store R0 into address <data>
12 = Store R1 into address <data>
13 = Jump to address <data>
14 = Jump to address <data> if R0 == 0
15 = Jump to address <data> if R0 != 0
Example of a 1-byte instruction
Example of a 2-byte instruction
input 8 6
the 6 can be anything from 0-15
Shouldn't be too hard to do. 2 ints for the register0 and register1, a char array for each of the 16 possible instructions, just be careful with loops. You might want to track how many instructions are carried out and force terminate after a certain amount (like 10000 for example).
If you want to make a fun esoteric language, then build unto me a functional language that puts all functions into their own threads.
To allow for simultaneous processing, you'd have to be able to define layers of dependencies within the language so the interpreter can tell which functions can run alongside each other and which ones it needs to wait for before moving on. A basic idea is that all functions on the same line or within the same scope will run alongside each other, and the program will wait for them to finish before moving to the next line.
If you were to watch a graphical implementation of this executing in one process, it would not branch out like an elegant tree all at once. For each time the tree branches, it would finish the left half to completion before starting the right branch, so it'd look more like a weird wave going from left to right. If you were to split it amongst multiple processes, however, then you'd get the tree structure you'd expect.
So look at the else function inside the split function. It has a single parameter, which is the append function, and that has 3 parameters. All of these need to be evaluated before the append can happen, but, thanks to the wonders of scope, it's also safe to assume that evaluating one will not affect the other, so we can evaluate them all at the same time and wait for them all to finish before running the append function.
I'm fairly certain this is not something either Lisp or Scheme currently does, but I think it'd be neat if there was a language that did do such a thing.
Guys (and gals), he can't even write a BF interpreter. How can you expect him to write a 4 bit microprocessor, let alone the functional thread esolang. Granted, the 4 bit microprocessor is probably going to be easier than the BF interpreter, but it has more instructions and it's more complex.