Console-based REPL Implementation - Use Jump table dispatch for execution - RLE preprocessing as optimization - Buffered output to minimize redraw - File loading support via run command - Add REPL commands: help, run, clear, reset, exit - Two implementation: bf_shell_interp.asm, bf_console_interp.asm This is my first contribution to KolibriOS for GSOC 2026 WASM runtime project preparation
24 lines
1.1 KiB
Brainfuck
24 lines
1.1 KiB
Brainfuck
[ yet another pi calculation program in bf
|
|
|
|
Just like for pi16.b the accuracy of the result depends on the cellsize:
|
|
|
|
- using 8 bit cells causes an overflow after 4 digits
|
|
- using 16 bit cells causes an overflow after 537 digits
|
|
- using 32 bit cells causes an overflow after several millions of digits
|
|
|
|
It's about ~38 times shorter than pi16.b, ~364 times faster and works with
|
|
not-wrapping (bignum) implementations.
|
|
|
|
by Felix Nawothnig (felix.nawothnig@t-online.de) ]
|
|
|
|
> +++++ +++++ +++++ (15 digits)
|
|
|
|
[<+>>>>>>>>++++++++++<<<<<<<-]>+++++[<+++++++++>-]+>>>>>>+[<<+++[>>[-<]<[>]<-]>>
|
|
[>+>]<[<]>]>[[->>>>+<<<<]>>>+++>-]<[<<<<]<<<<<<<<+[->>>>>>>>>>>>[<+[->>>>+<<<<]>
|
|
>>>>]<<<<[>>>>>[<<<<+>>>>-]<<<<<-[<<++++++++++>>-]>>>[<<[<+<<+>>>-]<[>+<-]<++<<+
|
|
>>>>>>-]<<[-]<<-<[->>+<-[>>>]>[[<+>-]>+>>]<<<<<]>[-]>+<<<-[>>+<<-]<]<<<<+>>>>>>>
|
|
>[-]>[<<<+>>>-]<<++++++++++<[->>+<-[>>>]>[[<+>-]>+>>]<<<<<]>[-]>+>[<<+<+>>>-]<<<
|
|
<+<+>>[-[-[-[-[-[-[-[-[-<->[-<+<->>]]]]]]]]]]<[+++++[<<<++++++++<++++++++>>>>-]<
|
|
<<<+<->>>>[>+<<<+++++++++<->>>-]<<<<<[>>+<<-]+<[->-<]>[>>.<<<<[+.[-]]>>-]>[>>.<<
|
|
-]>[-]>[-]>>>[>>[<<<<<<<<+>>>>>>>>-]<<-]]>>[-]<<<[-]<<<<<<<<]++++++++++.
|