Null in AST-Arguments

In some cases the specivication explicitly marks with a questionmark, that it is allowed to have arguments that are empty (for example Call[name, args?]). Can we assume for all other arguments that they will never be null? For example in BinaryExpression or ConditionalExpression, can we assume that operator/left/right or token/condition/… will never be null? If they can be null: How should our program react? Throw an error or just ignore it?

Yes, the factories will only be called in a way that ensures that correct expressions/statements (or error-expressions/statements) are built.

You can for instance assume that a binary expression always gets two non-null subexpressions.

If they are null, you are free to raise an error.

A conditional expression is the ternary operator cond ? consequence : alternative from an ungraded bonus.
It will always get all operands as non are optional.

But you probably meant the conditional if(cond) ... which possibly gets no alternative statement (meaning it gets passed null for the alternative).

Does that also mean that there will be no illigal operators in binary-/unaryExpressions, because it would be an incorrect expression? Or do we need to raise an error in that case?

Yes, the operator can also be assumed to be valid.
Otherwise, you can/should throw an exception like IllegalArgumentException (wrong argument to the factory) or IllegalStateException.

Again, the ASTFactory is only invoked as if by the parser. So if the parser never produces an invokation sequence, that does also not happen in our tests.

Of course, some things (like Conditional Expressions) are not part of the project.