Damned if I do, damned if I don't (ordering generator phases)

1. I have a generator phase that imports external references making all of them internal to essentially statically link referenced modules in my language. The referenced modules are detected automatically by providing an interface that all concepts which might reference an external node implement and are then searched for.

2. I have a language extension that converts instances of a concept defined within it to a reference to a node defined in a module written in my language.

If I run 1 before I run 2 then the external reference generated in #2 isn't detected by #1. If I run 2 before I run 1 then any external references brought in that use the concept I mention in #2 don't get transformed and make it all the way through to the output where the textgen doesn't know what to do w/ them.

It seems like I need to alternate running them until all the dust settles. Is there a mechanism for doing this?

Another alternative I've considered is having the concept defined in #2 act as an external reference to the node it generates, but it'd need some way to then be told when it gets generated eventually it should use the copied version of this node instead of the proper one which seems like more work than should be necessary to me.

Any thoughts?
1 comment
Comment actions Permalink
In general copying external nodes into the current model during the generation phase is bad practice.. Anyway, you can specify using generator priorities that 1 should be executed together with 2. As a result all newly copied nodes should be transformed by 2. and all newly introduced links should be copied by 1.

Please sign in to leave a comment.