view 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
line wrap: on
line source

.TH baum 1 "2008-03-01" "baum 0.4"
.SH NAME
baum \- an esoteric programming language



.SH SYNOPSIS
.B baum
[\-v]\ <file>



.SH DESCRIPTION
.B baum
is an interpreter for the baum programming language which is an experiment to create an esoteric programming language.

Source code is a representation of a tree in which every node is a command or data.

baum is only an experiment and the functionality is (currently) very restricted.




.SH OPTIONS

.TP
.BI \-v
Verbose output (All verbose output goes to stderr)

.TP
.BI \-\-help
Print usage information

.TP
.BI \-\-version
Print version information






.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.

Empty lines and everything vom the hash symbol (`#') to the end of the line is ignored.

.B An example that echoes (and returns) `42':

.nf
# comment
print(0)
	sum(0)  #comment
		number(40)
		number(2)
.fi


.SH NODES

.TP
.B create
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.

.TP
.B if
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.

.TP
.B number
Executes it's leftmost son. Returns the internal value.

.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).

.TP
.B sum
Executes all of it's sons. Returns the sum of their return values.

.TP
.B times
Copies everything below the node and pastes it as last brother(s). Returns 0 always.

.TP
.B while
Executes it's second son as long the first son returns a logical true (not `0'). Requires two sons. Returns 0 always;







.SH ERRORS

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.

.TP
.BI 1
common error

.TP
.BI 3
no or more than one source file given

.TP
.BI 4
invalid node

.TP
.BI 5
indention over more than one level

.TP
.BI 6
node name too long, or no value given

.TP
.BI 7
a node has not the required amount of sons

.TP
.BI 10
unable to open input file, unable to allocate memory, or something similar

.TP
.BI 126
invalid command line options



.SH BUGS
Please report if you find some.


.SH CREDITS
Ju developed the idea of
.B baum
with me in a conversation. Actually it was his idea to use the tree as basic structure.



.SH AUTHOR
markus schnalke <meillo@marmaro.de> and julian forster