If a node has zero children, it is called a terminal, and if it has one or more children, it is called a function. Each node performs some computation and returns the result. This is not to say that nodes are limited to mathematical operations. They can do any operation you can think of, and they don't have to return anything. The types of children a node can take are also fixed.
Some nodes allow any kind or most kinds of return types.
Some nodes may only return one type. In general, a node, when given its return type, restricts the types of its children as well. Whether strong typing is in general better or worse than closure is a matter of debate, but it sure makes programs make a little more sense. Here's a groovy little diagram of the class hierarchy that JGProg uses. Take a look at the javadocs for each of these classes to find out how to define your own stuff.