JastAdd
This is our old website.
Broken links can occur.
A new website is under construction.

FAQ

This list contains some frequently asked questions. If you do not find the answer to your question here, please take a look at the reference manual and if that does not help send your question to TorbjöEkman or use the forums.


 

How do I prevent out of memory exceptions when I try to build JastAddJ?

 

You need to increase the heap space used by ant since JastAdd is executed as a task within ant.

If you run ant from the command line you can use the following command: ANT_OPTS="-Xmx256M" ant. If that works you may then want to create a file ~/.ant/ant.conf containing the following string: ANT_OPTS="$ANT_OPTS -Xms256M -Xmx256M". This will give ant more memory each time it is executed.

If you run ant from within Eclipse you can increase the heap size by first selecting the build.xml file, and then Run as->Ant build ... from the context menu. Under the JRE tab you can add the following to VM arguments to prevent out-of-memory errors: -Xmx256M

There are also some detailed comments on running JastAdd from Eclipse here.

How should I interpret the XXX error message in JastAdd?

There is a more detailed description of various error messages available here.

Are there any guarantees that my rewrite system terminates?

The short answer is no: JastAdd does not perform any static analysis to ensure that the rewrite system is confluent and reaches a normal form. It is thus quite possible to write a set of rewrites that does not terminate. As an aid for the developer we provide a debug mode which throws a run-time error if a certain threshold is reached, i.e., a subtree has been rewritten too many times, e.g., 100. The error includes a trace of the triggered rewrites to help debugging the rewrite system.

Is there any help to debug my generated compiler?

The generated source files contains comments where the woven code comes from to link back to the .jrag and .ast files. It is usually a good start to use a normal Java debugger to try to pin-point the error. There is also a debug mode for JastAdd which can be enabled using the --debug command line switch or debug="true" in the Ant task. It incurs a run-time cost but checks the following properties during execution:

  • If a subtree is rewritten more than a certain threshold a run-time exception is thrown. This is to detect rewrite systems that are non-confluent.
  • If a fix-point computation for a circular attribute contains more than a certain iterations a run-time exception is thrown. This is to detect circular computations where a fix-point is not reached.
  • If a non-circular attribute is visited more than once a run-time exception is thrown.
  • If a node is attached to the tree and that node already is attached to another tree an exception is thrown. This is to detect situations which would turn the primary tree structure into a graph. Notice that it is still possible to create graph structures by adding edges using reference attributes.

How do I ensure that a circular attribute reaches a fixed-point?