Also my research code on writing a symbolic evaluator + compiler for 
computation graphs in Nim macros (extensible for JIT compilation):

  * 
[https://github.com/numforge/laser/tree/master/laser/lux_compiler](https://github.com/numforge/laser/tree/master/laser/lux_compiler)



And the experiments I did before jumping the gun, with about 12 steps of 
growing complexity:

  * 
[https://github.com/mratsim/compute-graph-optim](https://github.com/mratsim/compute-graph-optim)



For message passing between multiple threads you can use Nim channels or my 
research project on a new Nim multi-threading runtime:

  * 
[https://github.com/nim-lang/Nim/blob/devel/lib/system/channels.nim](https://github.com/nim-lang/Nim/blob/devel/lib/system/channels.nim)
  * 
[https://github.com/mratsim/weave/blob/master/e04_channel_based_work_stealing/channel.nim](https://github.com/mratsim/weave/blob/master/e04_channel_based_work_stealing/channel.nim)
 . Note that it's a raw translation of C code, and also those channels are used 
by the multithreading scheduler while usually a scheduler uses shared memory 
and user code uses channels.



For async channels you can have a look here: 
[https://github.com/status-im/nim-chronos/pull/45](https://github.com/status-im/nim-chronos/pull/45)

Regarding bytecode interpretations:

  * Research into state-of-the-art: 
[https://github.com/status-im/nimbus/wiki/Interpreter-optimization-resources](https://github.com/status-im/nimbus/wiki/Interpreter-optimization-resources).
 THis includes 4 different VMs engine in Nim at the bottom with benchmarjs
  * implementation of Ethereum VM: 
[https://github.com/status-im/nimbus/tree/master/nimbus/vm](https://github.com/status-im/nimbus/tree/master/nimbus/vm)
  * a simple Chip-8 VM: 
[https://github.com/mratsim/chirp8](https://github.com/mratsim/chirp8)
  * an (unfinished) example of describing opcodes via macros for 6502: 
[https://github.com/mratsim/glyph/blob/master/glyph/snes/opcodes.nim](https://github.com/mratsim/glyph/blob/master/glyph/snes/opcodes.nim)


Reply via email to