baum
changeset 48:f9fc4c4f9e3d 0.3
documented nodes in man page
author | meillo@marmaro.de |
---|---|
date | Sun, 02 Mar 2008 11:04:52 +0100 |
parents | c31b5bb6d493 |
children | 00de718c8590 |
files | TODO actions.c baum.1 |
diffstat | 3 files changed, 33 insertions(+), 16 deletions(-) [+] |
line diff
1.1 --- a/TODO Sun Mar 02 10:34:09 2008 +0100 1.2 +++ b/TODO Sun Mar 02 11:04:52 2008 +0100 1.3 @@ -5,11 +5,3 @@ 1.4 nodes 1.5 loops (while) 1.6 if 1.7 - 1.8 - 1.9 -internal features 1.10 - deep copy 1.11 - 1.12 - 1.13 -documentation 1.14 - document the nodes
2.1 --- a/actions.c Sun Mar 02 10:34:09 2008 +0100 2.2 +++ b/actions.c Sun Mar 02 11:04:52 2008 +0100 2.3 @@ -74,13 +74,11 @@ 2.4 2.5 2.6 unsigned char action_input(struct Node* node) { 2.7 - /* reads a number which is treated as ASCII value */ 2.8 int input; 2.9 printf("input: "); 2.10 scanf("%d", &input); 2.11 input = input % 256; 2.12 insertLast(node, newNode("number", (char) input)); 2.13 - 2.14 return 0; 2.15 } 2.16
3.1 --- a/baum.1 Sun Mar 02 10:34:09 2008 +0100 3.2 +++ b/baum.1 Sun Mar 02 11:04:52 2008 +0100 3.3 @@ -40,6 +40,20 @@ 3.4 3.5 3.6 3.7 +.SH CONCEPT 3.8 + 3.9 +baum programs are represented as nodes in a tree structure. Nodes are of specific kind and contain a value. 3.10 + 3.11 +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. 3.12 + 3.13 +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. 3.14 + 3.15 +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. 3.16 + 3.17 +Nodes can modify the tree, but should do this only on it's brothers or better only through it's rightmost brother. 3.18 + 3.19 + 3.20 + 3.21 .SH SOURCE CODE 3.22 3.23 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. 3.24 @@ -57,18 +71,31 @@ 3.25 .fi 3.26 3.27 3.28 +.SH NODES 3.29 3.30 -.SH CONCEPT 3.31 +.TP 3.32 +.B input 3.33 +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. 3.34 3.35 -baum programs are represented as nodes in a tree structure. Nodes are of specific kind and contain a value. 3.36 +.TP 3.37 +.B number 3.38 +Executes it's leftmost son. Returns the internal value. 3.39 3.40 -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. 3.41 +.TP 3.42 +.B print 3.43 +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). 3.44 3.45 -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. 3.46 +.TP 3.47 +.B sum 3.48 +Executes all of it's sons. Returns the sum of their return values. 3.49 3.50 -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. 3.51 +.TP 3.52 +.B times 3.53 +Copies everything below the node and pastes it as last brother(s). Returns 0 always. 3.54 3.55 -Nodes can modify the tree, but should do this only on it's brothers or better only through it's rightmost brother. 3.56 + 3.57 + 3.58 + 3.59 3.60 3.61 .SH ERRORS