README.txt 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. About this Package
  2. ===== ==== =======
  3. This is Version 4.1 of TPLY (Turbo Pascal Lex and Yacc), a compiler generator
  4. for Turbo Pascal and compatibles. The package contains two programs, TP Lex
  5. and Yacc, which are approximately compatible with the UNIX utilities Lex and
  6. Yacc, but are written in, and produce code for the Turbo Pascal programming
  7. language. The present version works with all recent flavours of Turbo/Borland
  8. Pascal, including Delphi, and with the Free Pascal Compiler, a GPL'ed Turbo
  9. Pascal-compatible compiler which currently runs on DOS and Linux (other ports
  10. are under development). Recent information about TPLY and the sources are
  11. available from the TPLY homepage:
  12. http://www.musikwissenschaft.uni-mainz.de/~ag/tply
  13. For information about the Free Pascal Compiler, please refer to:
  14. http://www.freepascal.org/
  15. The manual can be found in the files tply.tex (TeX version) and tply.doc
  16. (ASCII version) contained in the package. An extended version of the manual
  17. has also been published in the CCAI journal (A. Graef, TP Lex and Yacc: A
  18. compiler generator toolset for Turbo Pascal, Journal of Communication and
  19. Cognition - Artificial Intelligence (CCAI), 12(4), 1995, pp. 383-424).
  20. Furthermore, there is one book I know of which devotes three chapters to TP
  21. Lex/Yacc; unfortunately, it is written in French ;-) (Nino Silverio, Realiser
  22. un compilateur: Les outil Lex et Yacc, Editions Eyrolles, France, 1994, ISBN
  23. 2-212-08834-5).
  24. License
  25. =======
  26. Since version 4.0, TPLY and its derivatives are distributed under the GNU
  27. General Public License (Version 2 or later); see the file COPYING for details.
  28. Authors
  29. =======
  30. The original version of the TPLY package was written by Albert Graef
  31. <[email protected], [email protected]> for Turbo Pascal
  32. 4.0-6.0. Berend de Boer <[email protected]>, the current maintainer of the
  33. Turbo/Borland Pascal version, adapted TPLY to take advantage of the large
  34. memory models in Borland Pascal 7.0 and Delphi. Michael Van Canneyt
  35. <[email protected]>, who maintains the Linux version of
  36. the Free Pascal compiler, is the author of the Free Pascal port.
  37. History
  38. =======
  39. *** Version 2.0 Albert Graef <[email protected]>
  40. Around 1990. First public release.
  41. *** Version 3.0 Albert Graef <[email protected]>
  42. 1991. Lots of changes to make TPLY more compatible to UNIX Lex/Yacc. Moreover,
  43. all DFA and LALR parser construction algorithms were reimplemented from
  44. scratch in order to improve efficiency.
  45. *** Version 3.0a Albert Graef <[email protected]>
  46. May 1992. Bug fix release.
  47. *** Version 4.0 Berend de Boer <[email protected]>
  48. Oct 1996. This version differs with the previous release, 3.0a, that it
  49. compiles under Dos, DPMI, Windows, Delphi 16 and Delphi 32. The source is now
  50. maintained by Berend de Boer <[email protected]>.
  51. For the protected mode or win32 platforms Lex and Yacc also have significantly
  52. lager tables. The win32 in fact can have unlimited tables because you have 2GB
  53. to store things :-) The 16-bit DPMI platforms have tables extended as large as
  54. possible without changing basic Lex or Yacc sources.
  55. This version was ported to Free Pascal by Michael Van Canneyt
  56. <[email protected]> (April 1998).
  57. *** Version 4.1 Michael Van Canneyt <[email protected]>
  58. Albert Graef <[email protected]>
  59. May 1998. Merges the Turbo and Free Pascal versions into a single package.
  60. Contents of the Package
  61. ======== == === =======
  62. The TP Lex and Yacc programs consist of 23 modules with about 11000 lines of
  63. code. A short description of each of the source modules is given below.
  64. LEX PAS TP Lex main program
  65. LEXBASE PAS base module (global declarations)
  66. LEXDFA PAS DFA construction algorithm
  67. LEXLIB PAS TP Lex library unit
  68. LEXLIST PAS listing operations
  69. LEXMSGS PAS messages and error handling
  70. LEXOPT PAS DFA optimization algorithm
  71. LEXPOS PAS operations to construct the position table
  72. LEXRULES PAS parser for TP Lex grammar rules
  73. LEXTABLE PAS internal tables used by the TP Lex program
  74. YACC PAS TP Yacc parser and main program
  75. YACC Y TP Yacc source for YACC.PAS
  76. YACCBASE PAS base module (global declarations)
  77. YACCCLOS PAS closure and first set construction algorithms
  78. YACCLIB PAS TP Yacc library unit
  79. YACCLOOK PAS LALR lookahead computation algorithm
  80. YACCLR0 PAS LR(0) set construction algorithm
  81. YACCMSGS PAS messages and error handling
  82. YACCPARS PAS parse table construction
  83. YACCSEM PAS semantic routines of the TP Yacc parser
  84. YACCTABL PAS internal tables used by the TP Yacc program
  85. YYLEX COD code template for the lexical analyzer routine
  86. YYPARSE COD code template for the LALR parser routine
  87. Besides this, the package also contains the following docs:
  88. COPYING GNU General Public License
  89. README this file
  90. TPLY DOC ASCII version of the manual
  91. TPLY TEX TeX version of the manual
  92. Furthermore, the EXAMPLE subdir contains various sample TP Lex and Yacc
  93. programs, such as a (Standard) Pascal parser and a complete TPLY cross
  94. referencing utility named `yref'. (NB: Many of these examples still do not
  95. work properly with Free Pascal, apparently due to some incompatibilities in
  96. the Free Pascal runtime library concerning the handling of standard
  97. input/output. Programs operating on "real" files seem to be unaffected. I hope
  98. that this will be fixed in a future release of the Free Pascal RTL.)
  99. Installation
  100. ============
  101. The items to be installed are the executables of TP Lex and Yacc (compiled
  102. from the lex.pas and yacc.pas programs), the Lex and Yacc code templates
  103. (*.cod files), and the LexLib and YaccLib library units (compiled from
  104. lexlib.pas and yacclib.pas).
  105. The plex and pyacc programs will look for the *.cod files in the following locations:
  106. For unix-like operating systems:
  107. 1. Current directory.
  108. 2. Directory given by FPCDIR
  109. 3. Directory /usr/local/lib/fpc/lexyacc
  110. 4. Directory /usr/lib/fpc/lexyacc
  111. For other operating systems (dos/windows-like) :
  112. 1. Current directory.
  113. 2. Directory given by FPCDIR
  114. 3. Directory where the executable is located.
  115. For the Free Pascal/Linux version, a Makefile is provided. To install, issue
  116. the command `make' (maybe you have to edit the Makefile before this to reflect
  117. your setup) and then `make install'. Note that in the Linux version the
  118. executables will be named `plex' and `pyacc' to avoid name clashes with the
  119. corresponding UNIX utilities.
  120. For the Turbo/Borland/Free Pascal versions under DOS and Windows, several DOS
  121. batch files are provided:
  122. MAKEDOS.BAT - makes a real mode executable. Compiles with
  123. Turbo Pascal 6.0 to Borland Pascal 7.0.
  124. MAKEDPMI.BAT - makes a dos protected mode executable. Needs
  125. Borland Pascal 7.0.
  126. MAKEBPW.BAT - makes a 16-bit Windows executable. Needs
  127. Borland Pascal 7.0 or Borland Pascal for Windows.
  128. MAKED16.BAT - makes a 16-bit Windows executable.
  129. Needs Delphi 1.X.
  130. MAKED32.BAT - makes a 32-bit Windows NT or Windows 95 console
  131. application. Needs Delphi 2.X.
  132. MAKEFPC.BAT - makes a 32 bit executable. Needs the Free Pascal
  133. compiler.
  134. These will compile the programs lex.pas and yacc.pas, as well as the units
  135. lexlib.pas and yacclib.pas. To install, copy the executables lex.exe and
  136. yacc.exe along with the code templates yylex.cod and yyparse.cod to a place
  137. somewhere on your DOS path. Furthermore, copy the compiled lexlib and yacclib
  138. units to a directory which is searched for unit files by your compiler.
  139. (NB1: I currently have no means to check whether these batch files work except
  140. for the makedos and makefpc files. If you have problems with any of the other
  141. files, please let me know.)
  142. (NB2: The type of compiler used to compile TP Lex and Yacc affects the sizes
  143. of internal tables of these programs. If you want to be able to compile large
  144. grammars, you should therefore compile TP Lex/Yacc using one of the 32 bit
  145. compilers like BP 7.0 or Free Pascal. Note that the Pascal output generated by
  146. TP Lex and Yacc is independent of the type of compiler with which the programs
  147. were compiled. Thus the generated code can be used with any of the supported
  148. compilers, regardless of the type of compiler used to compile the TP Lex and
  149. Yacc programs themselves. You only have to compile the LexLib and YaccLib
  150. units separately for each type of compiler which will be used to compile TP
  151. Lex/Yacc generated programs.)
  152. To complete the installation, you might also wish to install the contents of
  153. the example subdir in a directory of your choice.
  154. As soon as the installation is finished, you can perform a quick bootstrap
  155. test with the command `yacc yacc.y test.pas' (or `pyacc yacc.y test.pas' for
  156. the Free Pascal/Linux version). You can then compare the distributed
  157. `yacc.pas' against the generated `test.pas' with the DOS command `fc' or the
  158. UNIX `diff' command. The two files should not differ.
  159. That's it! Hope you enjoy using this package.
  160. ----
  161. Dr. Albert Gr"af
  162. Dept. of Musicinformatics, Johannes Gutenberg-University Mainz, Germany
  163. Email: [email protected], [email protected]
  164. WWW: http://www.musikwissenschaft.uni-mainz.de/~ag