Introduction
LEX and YACC are the Word Method Analysis Code Generation tool on UNIX / Linux, which can be used to write compilers and interpreses, and can also be used in other applications where the structured input is generated. Most versions of Lex and Yacc are generated C language programs, and a large number of documents in these two tools is also c. This series of articles attempts to introduce LEX and YACC applications in Delphi. This article assumes that you have the initial knowledge of Lex and Yacc. If you need to get started materials, you can see http://www-900.ibm.com/developerworks/cn/linux/sdk/lex/index.shtml "YACC and LEX Quick Start" Chinese version; if you need a comprehensive Lex and Yacc learning manual, introduce you O'Reilly "Lex and Yacc" (second edition Chinese version has been launched by Machinery Industry Press, available in http://www.china-pub.com.)
installation
To http://www.musikwissenschaft.uni-mainz.de/~ag/tply/tply.html can download TPLY4.1A.ZIP, this package contains the Turbo Pascal version of Lex and YACC source programs, documents, and examples. TPLY4.1A can be compiled in Linux, DOS, Win16, Win32 operating system platform and free Pascal, Turbo Pascal, Borland Pascal, Delphi, and other locale, in this article we mainly introduce the use of Delphi.
1. Download the package after decompression, we can see 6 batch files in the directory, where Maked32.bat is available for Delphi. You must ensure that the Delphi / bin directory is in the system search path to let the batch file find the Delphi Pascal Compiler DCC32.exe. Execute Maked32.bat to generate lex.exe, yacc.exe.
2. New Directory, copy Lex.exe, Yacc.exe, Yylex.cod, Yyparse.cod, LEXLIB.PAS, YACCLIB.PAS to the new directory, which constructs the minimum operating environment of Pascal Lex and Yacc. In the original directory, there is a detailed installation information in the ReadMe file, and the TPLY.DOC has a detailed instructions.