Mercurial > baum
annotate baum.1 @ 52:201b4603671a
documented "if" and "while" in the man page; new error code 7
author | meillo@marmaro.de |
---|---|
date | Sun, 02 Mar 2008 16:26:06 +0100 |
parents | 7d7abe88e71b |
children | 6279e5b14d9e |
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 | 2 .SH NAME |
3 baum \- an esoteric programming language | |
4 | |
5 | |
6 | |
7 .SH SYNOPSIS | |
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 | 10 |
11 | |
12 | |
13 .SH DESCRIPTION | |
14 .B baum | |
15 is an interpreter for the baum programming language which is an experiment to create an esoteric programming language. | |
16 | |
17 Source code is a representation of a tree in which every node is a command or data. | |
18 | |
19 baum is only an experiment and the functionality is (currently) very restricted. | |
20 | |
21 | |
22 | |
23 | |
24 .SH OPTIONS | |
25 | |
26 .TP | |
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 | 29 |
30 .TP | |
31 .BI \-\-help | |
32 Print usage information | |
33 | |
34 .TP | |
35 .BI \-\-version | |
36 Print version information | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
48 | 43 .SH CONCEPT |
44 | |
45 baum programs are represented as nodes in a tree structure. Nodes are of specific kind and contain a value. | |
46 | |
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. | |
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. | |
50 | |
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. | |
52 | |
53 Nodes can modify the tree, but should do this only on it's brothers or better only through it's rightmost brother. | |
54 | |
55 | |
56 | |
18 | 57 .SH SOURCE CODE |
58 | |
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. | |
60 | |
61 Empty lines and everything vom the hash symbol (`#') to the end of the line is ignored. | |
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 | 64 |
65 .nf | |
66 # comment | |
67 print(0) | |
68 sum(0) #comment | |
69 number(40) | |
70 number(2) | |
71 .fi | |
72 | |
73 | |
48 | 74 .SH NODES |
18 | 75 |
48 | 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 | 79 |
48 | 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 | 85 .B number |
86 Executes it's leftmost son. Returns the internal value. | |
18 | 87 |
48 | 88 .TP |
89 .B print | |
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 | 91 |
48 | 92 .TP |
93 .B sum | |
94 Executes all of it's sons. Returns the sum of their return values. | |
18 | 95 |
48 | 96 .TP |
97 .B times | |
98 Copies everything below the node and pastes it as last brother(s). Returns 0 always. | |
18 | 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 | 105 |
106 | |
107 | |
18 | 108 |
109 | |
110 .SH ERRORS | |
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 | 114 .TP |
115 .BI 1 | |
116 common error | |
117 | |
118 .TP | |
119 .BI 3 | |
120 no or more than one source file given | |
121 | |
122 .TP | |
123 .BI 4 | |
124 invalid node | |
125 | |
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 |
42
233ac9bea4f1
switched exit code 127 to 126 (because shell returns 127 if command not found)
meillo@marmaro.de
parents:
37
diff
changeset
|
139 .BI 126 |
18 | 140 invalid command line options |
141 | |
142 | |
143 | |
144 .SH BUGS | |
145 Please report if you find some. | |
146 | |
147 | |
148 .SH CREDITS | |
149 Ju developed the idea of | |
150 .B baum | |
151 with me in a conversation. Actually it was his idea to use the tree as basic structure. | |
152 | |
153 | |
154 | |
155 .SH AUTHOR | |
156 markus schnalke <meillo@marmaro.de> and julian forster |