How do I pass extra parameters to AST constructors?

Monty Zukowski

You can't. ASTs define initialize() methods that take either an AST node or a Token object. The appropriate place is to make your own subclass of either Token or AST which can hold the data your want.

If you want to keep track of the file name that created this subtree (for handling C's #includes, for instance), the appropriate place is to attach that to the Token as the lexer creates it. Then create your own AST which can store that info and which sets it from the initialize(Token) method.