Brainfuck, on chain, a slice at a time
Demo of p/moul/x/vm/bf (the machine) and p/moul/x/vm/vmkit (the host ABI, the fuel meter, the instance store). This realm holds no logic of its own.
A program here does not run to completion. It runs until its fuel slice is spent, then pauses: the realm keeps the snapshot and the next caller pays for the next slice. Realm code cannot pause itself, and a guest can.
Samples
Hello World: 385 guest ops, five tape cells. Finishes in one slice.
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.
Echo the input: Reads through Host.Input, which is what the naive interpreter could not do at all: it panicked on ,.
,[.,]
Heavy loop: About 111k guest ops. Give it 20000 fuel and it takes six slices, which is the point.
++++++++++[->++++++++++[->++++++++++[-]<]<]
Instances
No instances yet. Upload one of the samples above.
Limits
| limit | value |
|---|---|
| instances | 64 |
| source bytes | 65536 |
| input bytes | 1024 |
| output bytes | 4096 |
| fuel per slice | 5000000 |
| tape cells | 30000 |