-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Hi,
First of all, thanks for all the efforts on providing these tools and their extensive documentation.
I am considering using GAL as a target language for my use case and I have been investigating what the generated GALs should look like. In this problem domain there are state variables whose value are dependent on the values of other variables in the state (I will refer to them as dependent variables). Thus, after (or at the end) of firing a transitions the variables that depend on variables that have been changed should be updated.
A dependency analysis can reveal which transitions require which dependent variables to be updated so that the code generation procedure can insert the code that updates the right variables at the end of each transition. For efficiency reasons this would be the right approach in the long run. However, initially I am considering generating the code for updating all dependent variables at the end of each transition.
Readability can be improved by generating the code for updating all dependent variables once, inside a labelled transition that is called at the end of every transition (essentially using it as a procedure). This works fine.
The problem is the initial state, in which the dependent variables should also be initialised properly. For obvious reasons, it is not possible to call the labelled transition after initialising all the state variables. For reasons less obvious to me, variables can only be initialised through expressions that do not refer to other variables. This is somewhat surprising to me because, if variables did depend on variables (and only variables), then it is possible to perform constant propagation and modify the initialisation of the dependent variables to a constant expression (and the system already appears to do constant propagation to simplify the program).
My problem thus boils down to having to perform the constant propagation on my side, before code generation. This is clearly not a show-stopper, but I though to write this message anyway because perhaps responses might clear some things up for me.
On the one hand I am curious as to way initialisation cannot involve references to other variables. On the other hand, I expect that the scenario I described, in which dependent values need to be updated after every transition, is very common, and perhaps some other solution is available that I have overseen.
Any insights would be very welcome.
Best,
Thomas