README 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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://tfdec1.fys.kuleuven.ac.be/~michael/fpc/fpc.html
  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
  58. <[email protected]>
  59. Albert Graef <[email protected]>
  60. May 1998. Merges the Turbo and Free Pascal versions into a single package.
  61. Contents of the Package
  62. ======== == === =======
  63. The TP Lex and Yacc programs consist of 23 modules with about 11000 lines of
  64. code. A short description of each of the source modules is given below.
  65. LEX PAS TP Lex main program
  66. LEXBASE PAS base module (global declarations)
  67. LEXDFA PAS DFA construction algorithm
  68. LEXLIB PAS TP Lex library unit
  69. LEXLIST PAS listing operations
  70. LEXMSGS PAS messages and error handling
  71. LEXOPT PAS DFA optimization algorithm
  72. LEXPOS PAS operations to construct the position table
  73. LEXRULES PAS parser for TP Lex grammar rules
  74. LEXTABLE PAS internal tables used by the TP Lex program
  75. YACC PAS TP Yacc parser and main program
  76. YACC Y TP Yacc source for YACC.PAS
  77. YACCBASE PAS base module (global declarations)
  78. YACCCLOS PAS closure and first set construction algorithms
  79. YACCLIB PAS TP Yacc library unit
  80. YACCLOOK PAS LALR lookahead computation algorithm
  81. YACCLR0 PAS LR(0) set construction algorithm
  82. YACCMSGS PAS messages and error handling
  83. YACCPARS PAS parse table construction
  84. YACCSEM PAS semantic routines of the TP Yacc parser
  85. YACCTABL PAS internal tables used by the TP Yacc program
  86. YYLEX COD code template for the lexical analyzer routine
  87. YYPARSE COD code template for the LALR parser routine
  88. Besides this, the package also contains the following docs:
  89. COPYING GNU General Public License
  90. README this file
  91. TPLY DOC ASCII version of the manual
  92. TPLY TEX TeX version of the manual
  93. Furthermore, the EXAMPLE subdir contains various sample TP Lex and Yacc
  94. programs, such as a (Standard) Pascal parser and a complete TPLY cross
  95. referencing utility named `yref'. (NB: Many of these examples still do not
  96. work properly with Free Pascal, apparently due to some incompatibilities in
  97. the Free Pascal runtime library concerning the handling of standard
  98. input/output. Programs operating on "real" files seem to be unaffected. I hope
  99. that this will be fixed in a future release of the Free Pascal RTL.)
  100. Installation
  101. ============
  102. The items to be installed are the executables of TP Lex and Yacc (compiled
  103. from the lex.pas and yacc.pas programs), the Lex and Yacc code templates
  104. (*.cod files), and the LexLib and YaccLib library units (compiled from
  105. lexlib.pas and yacclib.pas).
  106. For the Free Pascal/Linux version, a Makefile is provided. To install, issue
  107. the command `make' (maybe you have to edit the Makefile before this to reflect
  108. your setup) and then `make install'. Note that in the Linux version the
  109. executables will be named `plex' and `pyacc' to avoid name clashes with the
  110. corresponding UNIX utilities.
  111. For the Turbo/Borland/Free Pascal versions under DOS and Windows, several DOS
  112. batch files are provided:
  113. MAKEDOS.BAT - makes a real mode executable. Compiles with
  114. Turbo Pascal 6.0 to Borland Pascal 7.0.
  115. MAKEDPMI.BAT - makes a dos protected mode executable. Needs
  116. Borland Pascal 7.0.
  117. MAKEBPW.BAT - makes a 16-bit Windows executable. Needs
  118. Borland Pascal 7.0 or Borland Pascal for Windows.
  119. MAKED16.BAT - makes a 16-bit Windows executable.
  120. Needs Delphi 1.X.
  121. MAKED32.BAT - makes a 32-bit Windows NT or Windows 95 console
  122. application. Needs Delphi 2.X.
  123. MAKEFPC.BAT - makes a 32 bit executable. Needs the Free Pascal
  124. compiler.
  125. These will compile the programs lex.pas and yacc.pas, as well as the units
  126. lexlib.pas and yacclib.pas. To install, copy the executables lex.exe and
  127. yacc.exe along with the code templates yylex.cod and yyparse.cod to a place
  128. somewhere on your DOS path. Furthermore, copy the compiled lexlib and yacclib
  129. units to a directory which is searched for unit files by your compiler.
  130. (NB1: I currently have no means to check whether these batch files work except
  131. for the makedos and makefpc files. If you have problems with any of the other
  132. files, please let me know.)
  133. (NB2: The type of compiler used to compile TP Lex and Yacc affects the sizes
  134. of internal tables of these programs. If you want to be able to compile large
  135. grammars, you should therefore compile TP Lex/Yacc using one of the 32 bit
  136. compilers like BP 7.0 or Free Pascal. Note that the Pascal output generated by
  137. TP Lex and Yacc is independent of the type of compiler with which the programs
  138. were compiled. Thus the generated code can be used with any of the supported
  139. compilers, regardless of the type of compiler used to compile the TP Lex and
  140. Yacc programs themselves. You only have to compile the LexLib and YaccLib
  141. units separately for each type of compiler which will be used to compile TP
  142. Lex/Yacc generated programs.)
  143. To complete the installation, you might also wish to install the contents of
  144. the example subdir in a directory of your choice.
  145. As soon as the installation is finished, you can perform a quick bootstrap
  146. test with the command `yacc yacc.y test.pas' (or `pyacc yacc.y test.pas' for
  147. the Free Pascal/Linux version). You can then compare the distributed
  148. `yacc.pas' against the generated `test.pas' with the DOS command `fc' or the
  149. UNIX `diff' command. The two files should not differ.
  150. That's it! Hope you enjoy using this package.
  151. ----
  152. Dr. Albert Gr"af
  153. Dept. of Musicinformatics, Johannes Gutenberg-University Mainz, Germany
  154. Email: [email protected], [email protected]
  155. WWW: http://www.musikwissenschaft.uni-mainz.de/~ag