It sounds like you may be using ADFs in a way for which they were not
intended. ECJ follows the Koza-style ADF mechanism, which is this:
A *caller* tree has in its function set an *ADF* node which can have
some N number of children. When the caller wishes to call the callee,
it evaluates these children, then passes their results to the ADF node,
which transfers them to the callee tree.
The *callee* tree is then evaluated. The callee tree has in its
function set N *ADFArgument* terminal nodes. Each of these ADFArgument
nodes, when evaluated, simply returns the value of one of those
arguments provided by the caller tree.
The callee then finishes evaluation, returning a value. Control reverts
to the caller tree, and this value is then returned by the ADF node in
the caller tree.
A variant called ADMs makes this a lazy process: the caller's children
are only evaluated (and repeatedly evaluated) whenever the ADFArgument
in the callee is evaluated.
It sounds like you're trying to use ADFArgument where you had meant to
use ADF, but it's not quite clear.
Eric B wrote:
> Hello, I couldn't find anything about this (important) subject in the archives.
> My problem is that I want to use an ADF with a single argument and that
> argument should not be a terminal but a function; i.e. a subtree. I'm sure
> ECJ has this functionality. However, I've been trying for half a day now
> without succes.
> The problem, as far as I understand it, is hardcoded into ECJ. More
> specifically in the class ADFArgument:
> // make sure we don't have any children...
> if (children.length!= 0)
> state.output.error("Incorrect number of children for ADF
> Argument terminal -- should be 0. Check the constraints.",base,def);
> These lines of code checks whether the argument has 0 children, i.e. it
> checks whether the argument is a terminal. I've tried removing these lines
> of code however I run into other problems.
> Anyone can help me?
> Best regards,