4.3BSD/usr/contrib/icon/man/cat1/csgen.1




CSGEN(1)              Icon Program Library               CSGEN(1)



NNNNAAAAMMMMEEEE
     csgen - context-sensitive sentences

SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
     ccccssssggggeeeennnn [----tttt]

DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
     _C_s_g_e_n accepts a context sensitive production grammar from
     standard input and generates randomly selected sentences
     from the corresponding language.

     Uppercase letters stand for nonterminal symbols, ---->>>> indi-
     cates the lefthand side can be rewritten by the righthand
     side. Other characters are considered to be terminal sym-
     bols. Lines beginning with #### are considered to be comments
     and are ignored.  A line consisting of a nonterminal symbol
     followed by a colon and a nonnegative integer iiii is a genera-
     tion specification for _i instances of sentences for the
     language defined by the nonterminal (goal) symbol.  An exam-
     ple is:

          #   a(n)b(n)c(n)
          #   Salomaa, p. 11.  Attributed to M. Soittola.
          #
          X
          X->abc
          X->aYbc
          Yb->bY
          Yc->Zbcc
          bZ->Zb
          aZ->aaY
          aZ->aa
          X:10

     A positive integer followed by a colon can be prefixed to a
     production to replicate that production, making its selec-
     tion more likely. For example,

          3:X->abc

     is equivalent to

          X->abc
          X->abc
          X->abc


     The ----tttt option writes a trace of the derivations to standard
     error output.

LLLLIIIIMMMMIIIITTTTAAAATTTTIIIIOOOONNNNSSSS
     Nonterminal symbols can only be represented by single



Version 5.9    The University of Arizona - 6/28/83              1






CSGEN(1)              Icon Program Library               CSGEN(1)



     uppercase letters and there is no way to represent uppercase
     terminal symbols.

     There can be only one generation specification and it must
     appear as the last line of input.

     Generation of context-sensitive strings is a slow process.
     It may not terminate, either because of a loop in the
     rewriting rules of the grammar or because of the progressive
     accumulation of nonterminal symbols. _C_s_g_e_n, however, avoids
     deadlock, in which there are no possible rewrites for a
     string in the derivation.











































Version 5.9    The University of Arizona - 6/28/83              2






CSGEN(1)              Icon Program Library               CSGEN(1)



SSSSEEEEEEEE AAAALLLLSSSSOOOO
     Salomaa, Arto. _F_o_r_m_a_l _L_a_n_g_u_a_g_e_s, Academic Press, New York,
     1973.

AAAAUUUUTTTTHHHHOOOORRRR
     Ralph E. Griswold

















































Version 5.9    The University of Arizona - 6/28/83              3