LLgen.1 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. .\" $Id$
  2. .TH LLGEN 1 "$Revision$"
  3. .ad
  4. .SH NAME
  5. LLgen, an extended LL(1) parser generator
  6. .SH SYNOPSIS
  7. LLgen [ \-vxwa ] [ \-j[\fInum\fP] ] [ \-l\fInum\fP ] [ \-h\fInum\fP ] file ...
  8. .SH DESCRIPTION
  9. \fILLgen\fP
  10. converts a context-free grammar into a set of
  11. functions which form a recursive descent parser with no backtrack.
  12. The grammar may be ambiguous;
  13. ambiguities can be broken by user specifications.
  14. .PP
  15. \fILLgen\fP
  16. reads each
  17. \fIfile\fP
  18. in sequence.
  19. Together, these files must constitute a context-free grammar.
  20. For each file,
  21. \fILLgen\fP
  22. generates an output file, which must be compiled by the
  23. C-compiler.
  24. In addition, it generates the files
  25. \fILpars.c\fP
  26. and
  27. \fILpars.h.\fP
  28. \fILpars.h\fP
  29. contains the
  30. \fIdefine\fP
  31. statements that associate the
  32. \fILLgen\fP-assigned `token-codes' with user declared `token-names'.
  33. This allows other source files, for instance the source file
  34. containing the lexical analyzer,
  35. to access the token-codes by
  36. using the token-names.
  37. \fILpars.c\fP
  38. contains the error recovery routines and tables. It must also
  39. be compiled by the C-compiler.
  40. .PP
  41. \fILLgen\fP
  42. will only update those output files that differ from their previous
  43. version.
  44. This allows
  45. \fILLgen\fP
  46. to be used with
  47. \fImake\fP
  48. (1) convieniently.
  49. .PP
  50. To obtain a working program, the user must also supply a
  51. lexical analyzer, as well as
  52. \fImain\fP
  53. and
  54. \fILLmessage\fP,
  55. an error reporting routine;
  56. \fILex\fP
  57. (1) is a useful program for creating lexical analysers usable
  58. by
  59. \fILLgen\fP.
  60. .PP
  61. \fILLgen\fP accepts the following flags:
  62. .IP \fB\-v\fP
  63. create a file called
  64. \fILL.output\fP,
  65. which contains a description of the conflicts that
  66. were not resolved.
  67. If the flag is given more than once,
  68. \fILLgen\fP
  69. will be more "verbose".
  70. If it is given three times, a complete description of the
  71. grammar will be supplied.
  72. .IP \fB\-x\fP
  73. the sets that are computed are extended with the nonterminal
  74. symbols and these extended sets are also included in the
  75. \fILL.output\fP
  76. file.
  77. .IP \fB\-w\fP
  78. no warnings are given.
  79. .IP \fB\-a\fP
  80. Produce ANSI C function headers and prototypes.
  81. .IP \fB\-j\fP[\fInum\fP]
  82. when this flag is given, \fILLgen\fP will generate dense switches,
  83. so that the compiler can generate a jump table for it. This will only be
  84. done for switches that have density between
  85. \fIlow_percentage\fP and \fIhigh_percentage\fP, as explained below.
  86. Usually, compilers generate a jumptable when the density of the switch
  87. is above a certain threshold. When jump tables are to be used more often,
  88. \fIhigh_percentage\fP must be set to this threshold, and \fIlow_percentage\fP
  89. must be set to a minimum threshold. There is a time-space trade-off here.
  90. .I num
  91. is the minimum number of cases in a switch for the \fB\-j\fP option to be
  92. effective. The default value (if
  93. .I num
  94. is not given) is 8.
  95. .IP \fB\-l\fP\fInum\fP
  96. The \fIlow_percentage\fP, as described above. Default value is 10.
  97. .IP \fB\-h\fP\fInum\fP
  98. The \fIhigh_percentage\fP, as described above. Default value is 30.
  99. .SH FILES
  100. LL.output verbose output file
  101. .br
  102. Lpars.c the error recovery routines
  103. .br
  104. Lpars.h defines for token names
  105. .SH "SEE ALSO"
  106. \fIlex\fP(1)
  107. .br
  108. \fImake\fP(1)
  109. .br
  110. \fILLgen, an Extended LL(1) Parser Generator\fP
  111. by C.J.H. Jacobs.
  112. .SH DIAGNOSTICS
  113. Are intended to be self-explanatory. They are reported
  114. on standard error. A more detailed report is found in the
  115. \fILL.output\fP
  116. file.
  117. .SH AUTHOR
  118. Ceriel J. H. Jacobs