Try   HackMD

Vectorization: opt-in

If people want to make their own builtins, they can

  • Define their own functions directly in CGR bytecode
  • Use CGR as a library (wouldn't be able to take advantage of the runtime though)
  • Make a plugin (Lua perhaps?)

The VM will have a program stack, where all operations will be done, as well as numbered variables, a la JVM.

Data types:

  • All-in-one number type covering rational complex numbers (that might be hard to implement, fall back to floating-point complex if anything)
  • Strings
  • Strict lists - constant access
  • Lazy lists - should be interchangeable with strict lists

Opcodes (alphabetically ordered please)

  • add - TODO
  • goto [target: num] - Unconditional jump to target
  • isinst [type: num], x: any -> x, bool - pushes true if x is type, false otherwise. Does not pop x
  • switch [value: num, target: num]* [default: num]?, x: num -> () - tries to match num to every value. For the first value that matches, the intepreter will jump to the corresponding target. If no value matches, it jumps to default.
  • typeof, x: any -> x, num - pushes the type ID of x. Does not pop x