From: Petra M. <pe...@cs...> - 2005-03-01 03:55:39
|
Hi Leo, Leo Freitas wrote: > I noticed that there are 14 ant tasks associated to parser generation. > How many of those I need to be worried about? In other words, apart from > the Parser.xml > file, what other files do I need to change? Perhaps this is in direct > connection with the next question. You need all of them, but you won't need to edit all corresponding xml files. I added all required circus tasks to the build.xml file and commited it to CVS, so you don't have to worry about that. > 1) LaTeX Markup > > In Circus, there are environments for declaring new circus paragraphs as > \begin{circus}...\end{circus}, The CZT parser for LaTeX markup consists of a LaTex to Unicode converter followed by a Unicode scanner and parser. That's because the Z grammar given in the ISO Standard is defined for Unicode only. That means, you need to think about how a circus specification is supposed to look like in Unicode. Since Unicode characters are difficult to type (using an editor that doesn't support Unicode), all Unicode charcters used in Z (or OZ, TCOZ) got a name. These are defined in <CZT_HOME>/devtools/zchar.xml (or <CZT_HOME>/devtools/ozchar.xml, CZT_HOME>/devtools/tcozchar.xml). These XML files are used to generate the corresponding classes net.sourceforge.czt.z.util.{ZChar,ZString} net.sourceforge.czt.oz.util.{OzChar,OzString} net.sourceforge.czt.tcoz.util.{TcozChar,TcozString} So I guess we need to write a circuschar.xml file where Circus specific Unicode characters are listed. Tim might be able to help with this ... he has done that for Object Z. To define the \begin{circus} ... \end{circus} paragraphs, we need to modify the LaTeX to Unicode converter. It's in parser/templates/Latex2Unicode.xml. Next, the Unicode scanner needs to know about Circus. The Unicode scanner consists of the context-free scanner followed by other kinds of scanners. The context-free scanner is in parser/templates/ContextFreeScanner.xml. Just to get you started, I added all the stuff to the scanner and parser so that ---------------------------------------- \begin{zed} \vdash?~true \end{zed} \begin{circus} x : \nat \end{circus} ---------------------------------------- can now be parsed (with the Circus parser) and the resulting XML looks like <Spec Version="1.3" xmlns="http://czt.sourceforge.net/zml"> <ZSect> <Name>Specification</Name> <Parent> <Word>standard_toolkit</Word> </Parent> <LatexMarkupPara/> <ConjPara> <TruePred/> </ConjPara> <ns1:ChannelPara xmlns:ns1="http://czt.sourceforge.net/circus"> <VarDecl> <DeclName> <Word>x</Word> </DeclName> <RefExpr Mixfix="false"> <RefName> <Word><E2><84><95></Word> </RefName> </RefExpr> </VarDecl> </ns1:ChannelPara> </ZSect> </Spec> You can try that by calling "ant circus2zml" in the parser directory. Hope that gives you a bit of a start, Petra |