Menu

About the 1.5.0 CZT Circus Parser

Help
2011-05-09
2013-03-06
  • Samuel Lincoln M Barrocas

    Hello, there

    I am currently using the newest released version of CZT Circus Parser, the 1.5.0 version. I am currently working with JCircus, a tool that translates Circus specifications into Java code. JCircus parses (using the CZT Circus Parser) specifications, generates the AST of the input specification, pre-processes the specification, and translates it to Java.

    I developed a solution for solving a translation issue which requires changes in the main action of a basic process. The problem is that when I change the main action of the basic process, the main action becomes invalid ("isMainActionValid() == false"). As a consequence, I can't make the AST to be accepted by JCircus' pre-processor. But I really need it to be valid. Does anybody know how to solve this problem? Or a clue for solving it?

    OBS: When I change the main action, I do not use the "setMainAction" method, because in the 1.5.0 version it doesn't exist. Instead of this, I get all the paragraphs of the basic process, search for the main action paragraph, and change the main action of this paragraph. The non-existence of a "setMainAction" method for 1.5.0 version is a little strange, considering that the CZT documentation for the "BasicProcess" class has a "setMainAction" method. (http://czt.sourceforge.net/corejava/apidocs/net/sourceforge/czt/circus/ast/BasicProcess.html)

     
  • Leo Freitas

    Leo Freitas - 2011-05-10

    Hi Samuel,

    Firstly something about versions. I would strongly encourage you to use the repository version of the parser, as this has many updates from the compiled version due to minor changes found by users specifying large case studies. The problem you report is one of documentation: it says there is no "setMainAction", which is true, yet it is possible to change it. Thank you for that. I will update the documentation on the next release.

    Regarding your question, could I ask what is it you are changing it to? The "isMainActionValid" is an invariant guaranteeing that only one main action exist, which is sensible, since Circus has no semantics for processes with multiple main actions.
    If your change is making it == false, you must be doing something wrong in the process.

    Regarding the way to change the main action, and the way to understand the AST overall, is to look into the Circus.XSD file for the underlying structure, and then to the Circus extensions of GNAST (.vm) files for AST-specific code. If you look carefully at "BasicProcess" complexType (Circus.XSD), you will see the structure an underlying basic process AST has with a few reasons. It's worth looking into ProcessSignature complex type as well.

    Because of intricacies of Circus (e.g., overlaps between Z, CSP, and extra Circus constructs), and in order to have the "minimum common tree" for the range of process available that is amenable for carrying along type checking information, various changes were needed (e.g., look at the SVN history for Circus.xsd for details). Some of them are not intuitive and have to do with type checking for process renaming / replication / hiding, which leads to complications that were beyond the original type system of Circus.

    If you really *MUST* change the structure of the AST, I strongly recommend you get to understand how processes (and basic processes within a compound process) is typechecked. Otherwise, you may end up with some AST that does not represent a valid/correct Circus process. It is possible, not through "setMainAction" but through changing the underlying
    list of "on-the-fly" process paragraphs, which the main action is one of then.

    Best,
    Leo

     
  • Samuel Lincoln M Barrocas

    Hi Leo

    "Regarding your question, could I ask what is it you are changing it to? The "isMainActionValid" is an invariant guaranteeing that only one main action exist, which is sensible, since Circus has no semantics for processes with multiple main actions. If your change is making it == false, you must be doing something wrong in the process."

    Yes, you're probably right. Probably the reason for the failure is something which is wrong in the process… During the change of the process to be changed, I have to copy a version of the main action of another process to the process to be changed, with it's name prefixed with "Previous". Thus, I add an action to a basic process called "Previous$$mainAction_…", or something like it. Maybe the "$$" is a kind of sub-sequence that identifies main actions.

    I am going to check it now, but I am quite confident that your clues will help me to fix this problem.

    Thank you very much

    Samuel

     

Log in to post a comment.