-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathBrainf__k.txt
57 lines (42 loc) · 1.99 KB
/
Brainf__k.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
*vital/Interpreter/Brainf__k.txt* Brainf**k interpreter
Maintainer: ujihisa <ujihisa at gmail com>
==============================================================================
CONTENTS *Vital.Interpreter.Brainf__k-contents*
INTRODUCTION |Vital.Interpreter.Brainf__k-introduction|
INTERFACE |Vital.Interpreter.Brainf__k-interface|
FUNCTIONS |Vital.Interpreter.Brainf__k-functions|
==============================================================================
INTRODUCTION *Vital.Interpreter.Brainf__k-introduction*
*Vital.Interpreter.Brainf__k* provides 2 implementations of Brainf**k
interpreter in pure Vim script and in lua with using |if_lua|.
Brainf**k is a programming language http://en.wikipedia.org/wiki/Brainf**k
>
let s:B = s:V.import('Interpreter.Brainf__k')
let s:hello_world =
\ "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>."
echo s:B.run(s:hello_world)
<
This will print out "Hello World!". If you have |+lua|, you can also use
run_lua_parse_execute() instead of run(). Note that run() is just an alias of
run_vim_parse_execute().
>
" Only if you have if_lua
" This is much faster than the previous example.
let s:B = s:V.import('Interpreter.Brainf__k')
let s:hello_world =
\ "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>."
echo s:B.run_lua_parse_execute(s:hello_world)
<
==============================================================================
INTERFACE *Vital.Interpreter.Brainf__k-interface*
------------------------------------------------------------------------------
FUNCTIONS *Vital.Interpreter.Brainf__k-functions*
run({string}) *Vital.Interpreter.Brainf__k.run()*
Parse and execute the given brainf**k source code with using pure Vim
script implementation.
>
run('+[]') " infinite loop
<
TODO
==============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl