-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkbf.1
111 lines (111 loc) · 3.51 KB
/
kbf.1
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.\" $OpenBSD: Exp $
.\"
.\" Copyright (c) 2015 Tristan Le Guern <[email protected]>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: November 09 2016 $
.Dt KBF 1 URM
.Os
.Sh NAME
.Nm kbf
.Nd Brainfuck interpreter written in Korn shell
.Sh SYNOPSIS
.Nm
.Op Fl dsD
.Op Fl c Cm size
.Op Fl o Cm optimisation
.Op Fl t Cm size
.Op Fl O Cm level
.Ar file[.b]
.Sh DESCRIPTION
The
.Nm
utility interprets the Brainfuck programming language. It only
recognises the 8 classics operators: + \- < > [ ] , .
.Pp
It is not allowed to move beyond the limitation of the tape, but it is allowed to increment beyond the cells upper limit and to decrement a zero cell. In these cases the value will wrap, depending on the option
.Fl c .
.Pp
The output operator '\&.' prints the value 10 as a newline.
.Pp
The arguments are as follows:
.Bl -tag -width Ds
.It Fl d
Enable debug mode. This will print the executed instruction, the cell
number and the cell value.
.It Fl s
Print information about the programme after execution. This include the
number of cell used, the number of instruction executed and a dump of
the memory tape.
.It Fl D
Print the intermediary representation of the programme and quit.
.It Fl c
Allow to choose the size of the cells, in bits. Accepted values are 8,
16, 24, 32s, 32u and 64s. The values 32s and 64s uses
signed integers while 8, 16, 24 and 32u are unsigned. The default is 24, as
it will work with all the shells.
.It Fl o
Select a specific optimisation to apply, it is possible to use this option
multiple times. The allowed values are :
.Bl -tag -compact
.It strip-comments
Remove every comments, spaces and new lines in the programme.
.It strip-null-operations
Remove null actions, like a substraction following an addition.
.It optimised-operands
Replace some some simple but costly constructions with faster operators.
Currently implemented are the clear loop [-], the next-zero [>] and
previous-zero [<].
.It run-length-encoding
Compress consecutive, similar operators for faster execution.
.El
.It Fl t
Allow to choose the size of the tape. The default is 1000.
.It Fl O
Allow to choose the optimisation level. Accepted values are 0, 1,
2, 3 and 4. The default is 1.
.Bl -tag -compact
.It 0
Disable all optimisation.
.It 1
Toggle strip-comments.
.It 2
Also toggle strip-null-operations.
.It 3
Also toggle optimised-operands.
.It 4
Also toggle run-length-encoding.
.El
.El
.\" The following requests should be uncommented and used where appropriate.
.\" .Sh ENVIRONMENT
.\" For sections 1, 6, 7, and 8 only.
.Sh EXIT STATUS
.Ex -std
.\" For sections 1, 6, and 8 only.
.\" .Sh EXAMPLES
.\" .Sh DIAGNOSTICS
.\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only.
.Sh SEE ALSO
.Xr ksh 1 ,
.Xr kbf 3
.\" .Sh STANDARDS
.\" .Sh HISTORY
.Sh AUTHORS
The
.Nm
utility was written by
.An Tristan Le Guern Aq Mt [email protected] .
.\" .Sh CAVEATS
.\" .Sh BUGS