comparison baum.1 @ 48:f9fc4c4f9e3d 0.3

documented nodes in man page
author meillo@marmaro.de
date Sun, 02 Mar 2008 11:04:52 +0100
parents 0b82169d4129
children 7d7abe88e71b
comparison
equal deleted inserted replaced
47:c31b5bb6d493 48:f9fc4c4f9e3d
38 38
39 39
40 40
41 41
42 42
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
43 .SH SOURCE CODE 57 .SH SOURCE CODE
44 58
45 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. 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.
46 60
47 Empty lines and everything vom the hash symbol (`#') to the end of the line is ignored. 61 Empty lines and everything vom the hash symbol (`#') to the end of the line is ignored.
55 number(40) 69 number(40)
56 number(2) 70 number(2)
57 .fi 71 .fi
58 72
59 73
74 .SH NODES
60 75
61 .SH CONCEPT 76 .TP
77 .B input
78 Reads a number from standard input which is treated as ASCII value. It inserts a number node with this value as last brother. Returns 0 always.
62 79
63 baum programs are represented as nodes in a tree structure. Nodes are of specific kind and contain a value. 80 .TP
81 .B number
82 Executes it's leftmost son. Returns the internal value.
64 83
65 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. 84 .TP
85 .B print
86 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).
66 87
67 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. 88 .TP
89 .B sum
90 Executes all of it's sons. Returns the sum of their return values.
68 91
69 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. 92 .TP
93 .B times
94 Copies everything below the node and pastes it as last brother(s). Returns 0 always.
70 95
71 Nodes can modify the tree, but should do this only on it's brothers or better only through it's rightmost brother. 96
97
98
72 99
73 100
74 .SH ERRORS 101 .SH ERRORS
75 102
76 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. 103 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.