home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yay-1_0.zip / yay-1_0 / doc / yay10hlp.txt < prev    next >
Text File  |  1996-02-05  |  6KB  |  154 lines

  1. YAY - a LALR parser generator.
  2. Syntax:
  3.           yay sourcefile Parser=outfile [option]*
  4.  
  5.           (+|-)LR2 (-)            (+|-)Verbose (-)
  6.           (+|-)Warnings (+)       Description=file
  7.           Header=file             INSTallation=file
  8.           Language=C|C++ (C)      Parser=file
  9.  
  10. Examples:
  11.           yay cgram.y parse=myparse.c
  12.           c myparse.c
  13.  
  14.           yay ccgram.y lang=c++ pars=myparse.cpp
  15.  
  16. Options:
  17. sourcefile
  18.      is a file containing YAY input.
  19.  
  20. Language=C
  21.      produces parsing  tables in the C programming language.
  22.      This is the default.
  23.  
  24. Language=C++
  25.      produces  parsing   tables  in   the  C++   programming
  26.      language.   Note that YAY only produces the tables; the
  27.      routines  that  use  the  tables  to  parse  input  are
  28.      predefined.
  29.  
  30. +LR2
  31.      says that  the YAY  input describes an LALR(2) grammar.
  32.      Without +LR2,  YAY assumes that the grammar is LALR(1).
  33.      The manual describes modifications that need to be made
  34.      for LALR(2) grammars.
  35.  
  36. Description=file
  37.      translates the parsing tables into a format that humans
  38.      can read, and writes this output into the given file.
  39.  
  40. Header=file
  41.      writes  token   definitions   and   other   information
  42.      necessary for separate compilation, to the named file.
  43.  
  44. INSTallation=file
  45.      tells YAY  where to  find the  installation file.   The
  46.      installation  file   tells   where   various   software
  47.      components have  been installed.  For more information,
  48.      see the section on Installation Files below.
  49.      If you  do not  specify an  INSTallation= option on the
  50.      command line,  YAY checks  for an  environment variable
  51.      named YAY_INST  and uses  its value  as the name of the
  52.      installation file.   If  this environment variable does
  53.      not exist, YAY uses the default installation file.
  54.  
  55. Parser=file
  56.      writes the  resulting source  code for  the parser into
  57.      the named  file.   If this  option is omitted, YAY just
  58.      checks the syntax of your input.
  59.  
  60. +Verbose
  61.      produces verbose  output  --  everything  that  can  be
  62.      flagged is flagged.
  63.  
  64. -Warnings
  65.      suppresses  a  number  of  warning  messages  that  YAY
  66.      normally issues.
  67.  
  68. Description:
  69.     YAY converts  your context-free  grammar into a C or C++
  70. program that is written to the file specified by the Parser=
  71. option.
  72.  
  73.     If you  use the  Description= option,  YAY writes a full
  74. description of  the grammar to the specified file.  YAY only
  75. displays a brief message on the standard output, summarizing
  76. conflicts (and  other information  if you specify +Verbose).
  77. On the  other hand,  if you  do  not  use  the  Description=
  78. option, YAY  writes more  information  to  standard  output,
  79. including descriptions  of the states where conflicts occur.
  80. In this  case, YAY  actually provides additional information
  81. to help you identify the source of the conflicts; if you ask
  82. for a  description file,  YAY outputs  less information when
  83. reporting the  conflicts because  it assumes  you can  track
  84. down additional  information by  looking at  the description
  85. file.  For this reason, you can sometimes get a quicker idea
  86. of what  has gone  wrong if you do not ask for a description
  87. file.
  88.  
  89. C++ Parsers
  90.     In general,  you only  need to  use Language=C++  if you
  91. intend YYSTYPE  to contain  a C++  object with constructors.
  92. If you  intend to compile the parser with C++ but the %union
  93. statement does not have any elements that need constructors,
  94. it's best to use Language=C to get more efficient C code.
  95.  
  96.     If YYSTYPE does contain elements that need constructors,
  97. you need  to define an appropriate constructor-like function
  98. for the  YYSTYPE  type.    This  function  should  have  the
  99. prototype
  100.  
  101.           void name(YYSTYPE *p)
  102.  
  103. where "name"  can be  any valid  name.   In the declarations
  104. section of the grammar, you must then add the statement
  105.  
  106.           #define YYSTYPE_INIT name
  107.  
  108. where "name" is the name of the constructor-like function.
  109.  
  110.     With Language=C++,  the  %union  statement  generates  a
  111. structure type rather than a union, since C++ does not allow
  112. objects with constructors to belong to unions.
  113.  
  114.     In many  cases, the  same grammar  may be processed with
  115. either Language=C or Language=C++.
  116.  
  117. Installation Files:
  118.     An  installation   file  specifies   the  pathnames  for
  119. software and data files used by YAY.  Installation files are
  120. text files made up of comment lines and option lines.
  121.  
  122. Comment lines:
  123.      Any line  whose first  non-blank character is # will be
  124.      taken as  a comment.   Blank  lines are also considered
  125.      comments.
  126.  
  127. Option lines:
  128.      Option lines have the format
  129.  
  130.           Keyword=pathname
  131.  
  132.      In this  documentation, keywords  are written with some
  133.      letters in  upper case and some in lower case.  You may
  134.      abbreviate keywords  by omitting  any  or  all  of  the
  135.      letters shown in lower case.  The remaining letters may
  136.      be  entered   in  either   upper  or  lower  case;  the
  137.      documentation simply  uses upper  case  to  show  which
  138.      characters may not be omitted.
  139.  
  140.     In this  version of  YAY, there is only one valid option
  141. line:
  142.  
  143.           Library=pathname
  144.  
  145. The pathname  should be  the directory  containing  the  YAY
  146. parser template files (e.g. yyparse.c).
  147.  
  148. Notes:
  149.     If you  define YYALLOC,  the parser  allocates its state
  150. and value  stacks dynamically  via malloc  and free.    This
  151. shrinks your parser and helps prevent stack overflows.
  152.  
  153. Copyright 1995, Thinkage Ltd.
  154.