Prettyprint Grammar

-- prettyprint : Agrammar : metagrammar -- 
Grammar prettyprint:

option

   suffix='.pgram'
   bobsoptions = '25, 32, 34'
   combegin    = '(*'
   comEnd      = '*)'
   stringChar  = '\''
   

rule

   
   <PrettyPrint>   ::= 'PrettyPrintScheme' <SchemeName:nameDecl>
                       'for' <GrammarName:nameDecl> ':' <ProductionList>;
   <ProductionList>::* <Production> ';' ;
   
   <Production>    ::| <Constructor> | <ListProd> ;
   <Constructor>   ::= <ProductionName:nameAppl> '=' <Stream:ItemList>;
   <ListProd>      ::= <ProductionName:nameAppl> '=' '(' <ListSpec> ')';
   
   <ItemList>      ::* <Item>;
   <Item>          ::| <Terminal> | <NonTerm> | <Break> | <Block>
                    | <CommentPlace>;
   
   <Terminal>      ::| <DefaultTerm> | <AltTerm> ;
   <DefaultTerm>   ::= 'T' ':' <TerminalNo:const>;
   <AltTerm>       ::= <AlternativeTerminal:String> ;
   
   <NonTerm>       ::= 'N' ':' <NonTerminalNo:const>;
   
   <Break>         ::| <DefaultBreak> | <AltBreak> ;
   <DefaultBreak>  ::= '$$';
   <AltBreak>      ::= '$' <Space:const> ',' <Indention:const>;
   
   <Block>         ::= '[' <BlockType> <ItemList> ']';

   (* comments must only be specified after terminals! *)
   <CommentPlace>  ::= '*';
   
   <ListSpec>      ::= <Beginning:ItemList>
                       '{' <BlockType> <Separator:ItemList> '}'
                      <Ending:ItemLIst> ;
                                 
   <BlockType>     ::| <Consistent> | <InConsistent> ;
   <Consistent>    ::= 'c';
   <InConsistent>  ::= 'i'
   

Attribute

   <Constructor> : 1
   <ListProd>    : 1
   <DefaultTerm> : 2
   <AltTerm>     : 2
   <NonTerm>     : 2
   <ListSpec>    : 2


Prettyprint Grammar
© 1990-2004 Mjølner Informatics
[Modified: Monday January 4th 1999 at 12:22]