# HG changeset patch # User meillo@marmaro.de # Date 1204452292 -3600 # Node ID f9fc4c4f9e3d666dad2bd1efa627fb646334433c # Parent c31b5bb6d4934859970202d20471e258b3dc38f6 documented nodes in man page diff -r c31b5bb6d493 -r f9fc4c4f9e3d TODO --- a/TODO Sun Mar 02 10:34:09 2008 +0100 +++ b/TODO Sun Mar 02 11:04:52 2008 +0100 @@ -5,11 +5,3 @@ nodes loops (while) if - - -internal features - deep copy - - -documentation - document the nodes diff -r c31b5bb6d493 -r f9fc4c4f9e3d actions.c --- a/actions.c Sun Mar 02 10:34:09 2008 +0100 +++ b/actions.c Sun Mar 02 11:04:52 2008 +0100 @@ -74,13 +74,11 @@ unsigned char action_input(struct Node* node) { - /* reads a number which is treated as ASCII value */ int input; printf("input: "); scanf("%d", &input); input = input % 256; insertLast(node, newNode("number", (char) input)); - return 0; } diff -r c31b5bb6d493 -r f9fc4c4f9e3d baum.1 --- a/baum.1 Sun Mar 02 10:34:09 2008 +0100 +++ b/baum.1 Sun Mar 02 11:04:52 2008 +0100 @@ -40,6 +40,20 @@ +.SH CONCEPT + +baum programs are represented as nodes in a tree structure. Nodes are of specific kind and contain a value. + +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. + +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. + +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. + +Nodes can modify the tree, but should do this only on it's brothers or better only through it's rightmost brother. + + + .SH SOURCE CODE 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. @@ -57,18 +71,31 @@ .fi +.SH NODES -.SH CONCEPT +.TP +.B input +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. -baum programs are represented as nodes in a tree structure. Nodes are of specific kind and contain a value. +.TP +.B number +Executes it's leftmost son. Returns the internal value. -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. +.TP +.B print +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). -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. +.TP +.B sum +Executes all of it's sons. Returns the sum of their return values. -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. +.TP +.B times +Copies everything below the node and pastes it as last brother(s). Returns 0 always. -Nodes can modify the tree, but should do this only on it's brothers or better only through it's rightmost brother. + + + .SH ERRORS