annotate baum.1 @ 58:f5f06d6f62b3

made Makefile much simpler (installs now to /usr/local)
author meillo@marmaro.de
date Wed, 25 Jun 2008 11:09:14 +0200
parents 6279e5b14d9e
children b7544f23673b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51
7d7abe88e71b "input" node is now "create" node and can handle more than user input now
meillo@marmaro.de
parents: 48
diff changeset
1 .TH baum 1 "2008-03-01" "baum 0.4"
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
2 .SH NAME
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
3 baum \- an esoteric programming language
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
4
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
5
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
6
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
7 .SH SYNOPSIS
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
8 .B baum
31
4e60d96265f0 removed -c option completely; updated man page; new error code 5
meillo@marmaro.de
parents: 18
diff changeset
9 [\-v]\ <file>
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
10
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
11
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
12
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
13 .SH DESCRIPTION
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
14 .B baum
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
15 is an interpreter for the baum programming language which is an experiment to create an esoteric programming language.
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
16
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
17 Source code is a representation of a tree in which every node is a command or data.
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
19 baum is only an experiment and the functionality is (currently) very restricted.
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
20
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
21
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
22
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
23
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
24 .SH OPTIONS
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
25
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
26 .TP
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
27 .BI \-v
42
233ac9bea4f1 switched exit code 127 to 126 (because shell returns 127 if command not found)
meillo@marmaro.de
parents: 37
diff changeset
28 Verbose output (All verbose output goes to stderr)
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
29
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
30 .TP
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
31 .BI \-\-help
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
32 Print usage information
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
33
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
34 .TP
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
35 .BI \-\-version
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
36 Print version information
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
37
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
38
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
39
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
40
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
41
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
42
48
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
43 .SH CONCEPT
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
44
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
45 baum programs are represented as nodes in a tree structure. Nodes are of specific kind and contain a value.
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
46
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
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.
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
48
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
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.
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
50
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
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.
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
52
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
53 Nodes can modify the tree, but should do this only on it's brothers or better only through it's rightmost brother.
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
54
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
55
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
56
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
57 .SH SOURCE CODE
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
58
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
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.
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
60
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
61 Empty lines and everything vom the hash symbol (`#') to the end of the line is ignored.
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
62
37
29172b6e802a switched to next version number, updated man page
meillo@marmaro.de
parents: 33
diff changeset
63 .B An example that echoes (and returns) `42':
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
64
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
65 .nf
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
66 # comment
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
67 print(0)
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
68 sum(0) #comment
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
69 number(40)
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
70 number(2)
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
71 .fi
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
72
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
73
48
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
74 .SH NODES
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
75
48
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
76 .TP
51
7d7abe88e71b "input" node is now "create" node and can handle more than user input now
meillo@marmaro.de
parents: 48
diff changeset
77 .B create
7d7abe88e71b "input" node is now "create" node and can handle more than user input now
meillo@marmaro.de
parents: 48
diff changeset
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.
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
79
48
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
80 .TP
52
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
81 .B if
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
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.
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
83
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
84 .TP
48
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
85 .B number
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
86 Executes it's leftmost son. Returns the internal value.
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
87
48
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
88 .TP
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
89 .B print
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
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).
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
91
48
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
92 .TP
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
93 .B sum
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
94 Executes all of it's sons. Returns the sum of their return values.
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
95
48
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
96 .TP
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
97 .B times
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
98 Copies everything below the node and pastes it as last brother(s). Returns 0 always.
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
99
52
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
100 .TP
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
101 .B while
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
102 Executes it's second son as long the first son returns a logical true (not `0'). Requires two sons. Returns 0 always;
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
103
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
104
48
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
105
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
106
f9fc4c4f9e3d documented nodes in man page
meillo@marmaro.de
parents: 45
diff changeset
107
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
108
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
109
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
110 .SH ERRORS
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
111
43
c7dca4a1dc37 added test programs; added another example program
meillo@marmaro.de
parents: 42
diff changeset
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.
c7dca4a1dc37 added test programs; added another example program
meillo@marmaro.de
parents: 42
diff changeset
113
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
114 .TP
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
115 .BI 1
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
116 common error
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
117
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
118 .TP
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
119 .BI 3
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
120 no or more than one source file given
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
121
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
122 .TP
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
123 .BI 4
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
124 invalid node
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
125
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
126 .TP
31
4e60d96265f0 removed -c option completely; updated man page; new error code 5
meillo@marmaro.de
parents: 18
diff changeset
127 .BI 5
4e60d96265f0 removed -c option completely; updated man page; new error code 5
meillo@marmaro.de
parents: 18
diff changeset
128 indention over more than one level
4e60d96265f0 removed -c option completely; updated man page; new error code 5
meillo@marmaro.de
parents: 18
diff changeset
129
4e60d96265f0 removed -c option completely; updated man page; new error code 5
meillo@marmaro.de
parents: 18
diff changeset
130 .TP
33
2e564bf8599c new error code 6; more readable printTree; cleanups
meillo@marmaro.de
parents: 31
diff changeset
131 .BI 6
2e564bf8599c new error code 6; more readable printTree; cleanups
meillo@marmaro.de
parents: 31
diff changeset
132 node name too long, or no value given
2e564bf8599c new error code 6; more readable printTree; cleanups
meillo@marmaro.de
parents: 31
diff changeset
133
2e564bf8599c new error code 6; more readable printTree; cleanups
meillo@marmaro.de
parents: 31
diff changeset
134 .TP
52
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
135 .BI 7
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
136 a node has not the required amount of sons
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
137
201b4603671a documented "if" and "while" in the man page; new error code 7
meillo@marmaro.de
parents: 51
diff changeset
138 .TP
55
6279e5b14d9e added error handling for fopen and malloc; code cleanups
meillo@marmaro.de
parents: 52
diff changeset
139 .BI 10
6279e5b14d9e added error handling for fopen and malloc; code cleanups
meillo@marmaro.de
parents: 52
diff changeset
140 unable to open input file, unable to allocate memory, or something similar
6279e5b14d9e added error handling for fopen and malloc; code cleanups
meillo@marmaro.de
parents: 52
diff changeset
141
6279e5b14d9e added error handling for fopen and malloc; code cleanups
meillo@marmaro.de
parents: 52
diff changeset
142 .TP
42
233ac9bea4f1 switched exit code 127 to 126 (because shell returns 127 if command not found)
meillo@marmaro.de
parents: 37
diff changeset
143 .BI 126
18
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
144 invalid command line options
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
145
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
146
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
147
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
148 .SH BUGS
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
149 Please report if you find some.
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
150
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
151
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
152 .SH CREDITS
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
153 Ju developed the idea of
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
154 .B baum
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
155 with me in a conversation. Actually it was his idea to use the tree as basic structure.
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
156
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
157
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
158
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
159 .SH AUTHOR
711aab4863cc added man page
meillo@marmaro.de
parents:
diff changeset
160 markus schnalke <meillo@marmaro.de> and julian forster