From: Paulo K. <pau...@gm...> - 2010-10-24 03:47:08
|
Greetings, I have been working on a university project that intends to generate source code from a specification of software in Z notation. My first goal was to simply print the predicate as it was in the specification in LaTeX that I get with the method getPred() from a object of the class net.sourceforge.czt.z.ast.ZSchText after a call to the method visitTerm(net.sourceforge.czt.util.Visitor visitor, net.sourceforge.czt.base.ast.Term term of the class net.sourceforge.czt.base.visitor.VisitorUtils. After that I have managed to attain some values that i could print from the class net.sourceforge.czt.z.impl.RefExprImpl using a object Term as base, containing a single schema, after analyzing the structure of the AST. Using that object I was able to retrieve most of the predicate by doing some interpretation of how it is generated but for a few predicates there were some parts missing. For instance in the schema: \begin{schema}{Remind} \Xi BirthdayBook \\ today?: DATE \\ cards!: \power NAME \where cards! = \{ n: known | birthday(n) = today? \} \end{schema} I got the structure: net.sourceforge.czt.z.impl.MemPredImpl net.sourceforge.czt.z.base.impl.ListTermImpl net.sourceforge.czt.z.impl.RefExprImpl cards! net.sourceforge.czt.z.impl.SetExprImpl net.sourceforge.czt.z.impl.ZExprListImpl net.sourceforge.czt.z.impl.SetCompExprImpl net.sourceforge.czt.z.impl.MemPredImpl net.sourceforge.czt.base.impl.ListTermImpl net.sourceforge.czt.z.impl.ApplExprImpl net.sourceforge.czt.z.impl.RefExprImpl birthday net.sourceforge.czt.z.impl.RefExprImpl n net.sourceforge.czt.z.impl.SetExprImpl net.sourceforge.czt.z.impl.ZExprListImpl net.sourceforge.czt.z.impl.RefExprImpl today? true true I have used indentation to show the children of each as I have used recursion to print that structure. As it shows I wasn't able to retrieve the part "n: known |" of the predicate. I have tried using some print methods from the package such as the net.sourceforge.czt.print.z.PrintUtils.printLatex(term, writer, manager) but I could only print the whole specification and wasn't able to print a predicate from a single schema. Any help is really appreciated. Thanks in advance. Regards, Paulo. |