rev |
line source |
meillo@59
|
1 .TH baum 1 "2008-06-24" "baum 0.5"
|
meillo@18
|
2 .SH NAME
|
meillo@18
|
3 baum \- an esoteric programming language
|
meillo@18
|
4
|
meillo@18
|
5
|
meillo@18
|
6
|
meillo@18
|
7 .SH SYNOPSIS
|
meillo@18
|
8 .B baum
|
meillo@31
|
9 [\-v]\ <file>
|
meillo@18
|
10
|
meillo@18
|
11
|
meillo@18
|
12
|
meillo@18
|
13 .SH DESCRIPTION
|
meillo@18
|
14 .B baum
|
meillo@18
|
15 is an interpreter for the baum programming language which is an experiment to create an esoteric programming language.
|
meillo@18
|
16
|
meillo@18
|
17 Source code is a representation of a tree in which every node is a command or data.
|
meillo@18
|
18
|
meillo@18
|
19 baum is only an experiment and the functionality is (currently) very restricted.
|
meillo@18
|
20
|
meillo@18
|
21
|
meillo@18
|
22
|
meillo@18
|
23
|
meillo@18
|
24 .SH OPTIONS
|
meillo@18
|
25
|
meillo@18
|
26 .TP
|
meillo@18
|
27 .BI \-v
|
meillo@42
|
28 Verbose output (All verbose output goes to stderr)
|
meillo@18
|
29
|
meillo@18
|
30 .TP
|
meillo@18
|
31 .BI \-\-help
|
meillo@18
|
32 Print usage information
|
meillo@18
|
33
|
meillo@18
|
34 .TP
|
meillo@18
|
35 .BI \-\-version
|
meillo@18
|
36 Print version information
|
meillo@18
|
37
|
meillo@18
|
38
|
meillo@18
|
39
|
meillo@18
|
40
|
meillo@18
|
41
|
meillo@18
|
42
|
meillo@48
|
43 .SH CONCEPT
|
meillo@48
|
44
|
meillo@48
|
45 baum programs are represented as nodes in a tree structure. Nodes are of specific kind and contain a value.
|
meillo@48
|
46
|
meillo@48
|
47 The tree is processed recursive starting at the root node. Every node controls it's sons and should only know them; while most nodes only use their leftmost son.
|
meillo@48
|
48
|
meillo@48
|
49 Each node returns a value to it's parent. (The root node returns an exit code to the shell.) The internal value of the node could be used in any useful way, but only inside the node.
|
meillo@48
|
50
|
meillo@48
|
51 All values in the language (return values, expected return values and in-node values) should be of the same type, so that every combination of nodes is possible.
|
meillo@48
|
52
|
meillo@48
|
53 Nodes can modify the tree, but should do this only on it's brothers or better only through it's rightmost brother.
|
meillo@48
|
54
|
meillo@48
|
55
|
meillo@48
|
56
|
meillo@18
|
57 .SH SOURCE CODE
|
meillo@18
|
58
|
meillo@18
|
59 Source code are plain text files with one node per line representing the tree. The indention controls in which level in the tree the node is. Indention can be made with SPACE or with TAB characters. Every character means one level.
|
meillo@18
|
60
|
meillo@18
|
61 Empty lines and everything vom the hash symbol (`#') to the end of the line is ignored.
|
meillo@18
|
62
|
meillo@37
|
63 .B An example that echoes (and returns) `42':
|
meillo@18
|
64
|
meillo@18
|
65 .nf
|
meillo@18
|
66 # comment
|
meillo@18
|
67 print(0)
|
meillo@18
|
68 sum(0) #comment
|
meillo@18
|
69 number(40)
|
meillo@18
|
70 number(2)
|
meillo@18
|
71 .fi
|
meillo@18
|
72
|
meillo@18
|
73
|
meillo@48
|
74 .SH NODES
|
meillo@18
|
75
|
meillo@48
|
76 .TP
|
meillo@51
|
77 .B create
|
meillo@51
|
78 Creates a new number node as last brother. The value of the new node is ether read from standard input (if the node has no son), or the return value of the first son. Returns 0 always.
|
meillo@18
|
79
|
meillo@48
|
80 .TP
|
meillo@52
|
81 .B if
|
meillo@52
|
82 Compares return value of first son and second son. The internal value defines how the comparation is done. 33 (`!') means not equal; 60 (`<') less than; 62 (`>') greater than; and everything else stands for equal. Requires two sons. Returns 1 for true and 0 for false.
|
meillo@52
|
83
|
meillo@52
|
84 .TP
|
meillo@48
|
85 .B number
|
meillo@48
|
86 Executes it's leftmost son. Returns the internal value.
|
meillo@18
|
87
|
meillo@48
|
88 .TP
|
meillo@48
|
89 .B print
|
meillo@48
|
90 Prints the return value of it's leftmost son. Ether as char (if the internal value is 99), or as number otherwise. Returns the return value of the leftmost son (passes through).
|
meillo@18
|
91
|
meillo@48
|
92 .TP
|
meillo@48
|
93 .B sum
|
meillo@48
|
94 Executes all of it's sons. Returns the sum of their return values.
|
meillo@18
|
95
|
meillo@48
|
96 .TP
|
meillo@48
|
97 .B times
|
meillo@48
|
98 Copies everything below the node and pastes it as last brother(s). Returns 0 always.
|
meillo@18
|
99
|
meillo@52
|
100 .TP
|
meillo@52
|
101 .B while
|
meillo@52
|
102 Executes it's second son as long the first son returns a logical true (not `0'). Requires two sons. Returns 0 always;
|
meillo@52
|
103
|
meillo@52
|
104
|
meillo@48
|
105
|
meillo@48
|
106
|
meillo@48
|
107
|
meillo@18
|
108
|
meillo@18
|
109
|
meillo@18
|
110 .SH ERRORS
|
meillo@18
|
111
|
meillo@43
|
112 You have to keep in mind, that valid programs that run successful can return exit codes different from zero too! Each program returns the return value of the root node to the shell. If you don't want your program doing this, just set a `number(0)' node as root, and put everything else below.
|
meillo@43
|
113
|
meillo@18
|
114 .TP
|
meillo@18
|
115 .BI 1
|
meillo@18
|
116 common error
|
meillo@18
|
117
|
meillo@18
|
118 .TP
|
meillo@18
|
119 .BI 3
|
meillo@18
|
120 no or more than one source file given
|
meillo@18
|
121
|
meillo@18
|
122 .TP
|
meillo@18
|
123 .BI 4
|
meillo@18
|
124 invalid node
|
meillo@18
|
125
|
meillo@18
|
126 .TP
|
meillo@31
|
127 .BI 5
|
meillo@31
|
128 indention over more than one level
|
meillo@31
|
129
|
meillo@31
|
130 .TP
|
meillo@33
|
131 .BI 6
|
meillo@33
|
132 node name too long, or no value given
|
meillo@33
|
133
|
meillo@33
|
134 .TP
|
meillo@52
|
135 .BI 7
|
meillo@52
|
136 a node has not the required amount of sons
|
meillo@52
|
137
|
meillo@52
|
138 .TP
|
meillo@55
|
139 .BI 10
|
meillo@55
|
140 unable to open input file, unable to allocate memory, or something similar
|
meillo@55
|
141
|
meillo@55
|
142 .TP
|
meillo@42
|
143 .BI 126
|
meillo@18
|
144 invalid command line options
|
meillo@18
|
145
|
meillo@18
|
146
|
meillo@18
|
147
|
meillo@18
|
148 .SH BUGS
|
meillo@18
|
149 Please report if you find some.
|
meillo@18
|
150
|
meillo@18
|
151
|
meillo@18
|
152 .SH CREDITS
|
meillo@18
|
153 Ju developed the idea of
|
meillo@18
|
154 .B baum
|
meillo@18
|
155 with me in a conversation. Actually it was his idea to use the tree as basic structure.
|
meillo@18
|
156
|
meillo@18
|
157
|
meillo@18
|
158
|
meillo@18
|
159 .SH AUTHOR
|
meillo@18
|
160 markus schnalke <meillo@marmaro.de> and julian forster
|