亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tply.tex

?? 編譯原理基礎
?? TEX
?? 第 1 頁 / 共 5 頁
字號:

\documentstyle[twocolumn]{article}

\title{TP Lex and Yacc -- The Compiler Writer's Tools for Turbo Pascal\\
       Version 3.0 User Manual}

\author{Albert Graef\\
        Schillerstr. 18\\
        6509 Schornsheim\\
        \\
        ag@muwinfa.geschichte.uni-mainz.de}

\date{June 17, 1991}

\setlength{\topmargin}{0cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\evensidemargin}{0cm}
\setlength{\textwidth}{16cm}
\setlength{\textheight}{21cm}
%\setlength{\parindent}{0pt}
\parskip=4pt plus 1pt minus 1pt
\itemsep=0pt
\renewcommand{\baselinestretch}{1.1}
\unitlength=1mm
%\tolerance=500
%\parskip=0.1cm
\leftmargini 1.5em
\leftmarginii 1.5em \leftmarginiii 1.5em \leftmarginiv 1.5em \leftmarginv 1.5em
\leftmarginvi 1.5em

\begin{document}

\maketitle

\section{Introduction}

This document describes the TP Lex and Yacc compiler generator toolset.
These tools are designed especially to help you prepare compilers and
similar programs like text processing utilities and command language
interpreters with the Turbo Pascal (TM) programming language.

TP Lex and Yacc are Turbo Pascal adaptions of the well-known UNIX (TM)
utilities Lex and Yacc, which were written by M.E. Lesk and S.C. Johnson
at Bell Laboratories, and are used with the C programming language. TP Lex
and Yacc are intended to be approximately ``compatible'' with these programs.
However, they are an independent development of the author, based on the
techniques described in the famous ``dragon book'' of Aho, Sethi and Ullman
(Aho, Sethi, Ullman: {\em Compilers : principles, techniques and tools,\/}
Reading (Mass.), Addison-Wesley, 1986).

TP Lex and Yacc, like any other tools of this kind, are not intended for
novices or casual programmers; they require extensive programming experience
as well as a thorough understanding of the principles of parser design and
implementation to be put to work successfully. But if you are a seasoned
Turbo Pascal programmer with some background in compiler design and formal
language theory, you will almost certainly find TP Lex and Yacc to be a
powerful extension of your Turbo Pascal toolset.

This manual tells you how to get started with the TP Lex and Yacc programs
and provides a short description of these programs. Some knowledge about
the C versions of Lex and Yacc will be useful, although not strictly
necessary. For further reading, you may also refer to:

\begin{itemize}
   \item
      Aho, Sethi and Ullman: {\em Compilers : principles, techniques and
      tools.\/} Reading (Mass.), Addison-Wesley, 1986.
   \item
      Johnson, S.C.: {\em Yacc -- yet another compiler-compiler.\/} CSTR-32,
      Bell Telephone Laboratories, 1974.
   \item
      Lesk, M.E.: {\em Lex -- a lexical analyser generator.\/} CSTR-39, Bell
      Telephone Laboratories, 1975.
   \item
      Schreiner, Friedman: {\em Introduction to compiler construction with
      UNIX.\/} Prentice-Hall, 1985.
   \item
      The Unix Programmer's Manual, Sections `Lex' and `Yacc'.
\end{itemize}


\subsection*{Getting Started}

The TP Lex and Yacc programs run on IBM PC compatible computers with
MS-DOS 3.0 (or later) and Turbo Pascal compiler (Version 4.0 or later). Your
system should have at least 512 KB RAM; a hard disk is recommended, while
not strictly necessary.

To install TP Lex and Yacc on your system, simply copy the files on the
distribution disk to an appropriate directory on your hard disk. Then
put this directory on your DOS \verb"PATH" and Turbo Pascal's unit search path
(such that the Turbo Pascal compiler finds the TP Lex and Yacc library
units).

The library units (\verb".TPU" files) in the distribution are compiled with
Turbo Pascal 6.0. If you are using a different Turbo Pascal version,
you will have to recompile these units (sources are provided in the
corresponding \verb"LEXLIB.PAS" and \verb"YACCLIB.PAS" files).

Having installed TP Lex and Yacc on your system, you can now compile
your first TP Lex and Yacc program \verb"EXPR". \verb"EXPR" is a simple
desktop calculator program which consists of a lexical analyzer in the TP Lex
source file \verb"EXPRLEX.L" and the parser and main program in the TP Yacc
source file \verb"EXPR.Y". To compile these programs, issue the commands
\begin{quote}\begin{verbatim}
   lex exprlex
   yacc expr
\end{verbatim}\end{quote}

That's it! You now have the Turbo Pascal sources (\verb"EXPRLEX.PAS" and
\verb"EXPR.PAS") for the \verb"EXPR" program. Use the Turbo Pascal compiler
to compile these programs as follows:
\begin{quote}\begin{verbatim}
   tpc expr
\end{verbatim}\end{quote}

You can now execute the \verb"EXPR" program and type some expressions to see
it work (terminate the program with an empty line). There is a number of other
sample TP Lex and Yacc programs (\verb".L" and \verb".Y" files) on the
distribution disk, including a TP Yacc cross reference utility and a complete
parser for Standard Pascal.

The TP Lex and Yacc programs recognize some options which may be specified
anywhere on the command line. E.g.,
\begin{quote}\begin{verbatim}
   lex /o exprlex
\end{verbatim}\end{quote}
runs TP Lex with ``DFA optimization'' and
\begin{quote}\begin{verbatim}
   yacc /v expr
\end{verbatim}\end{quote}
runs TP Yacc in ``verbose'' mode (TP Yacc generates a readable description
of the generated parser).

The TP Lex and Yacc programs use the following default filename extensions:
\begin{itemize}
   \item \verb".L": TP Lex input files
   \item \verb".Y": TP Yacc input files
   \item \verb".PAS": TP Lex and Yacc output files
\end{itemize}

As usual, you may overwrite default filename extensions by explicitly
specifying suffixes.

If you ever forget how to run TP Lex and Yacc, you can issue the command
\begin{quote}\begin{verbatim}
   lex
\end{verbatim}\end{quote}
or
\begin{quote}\begin{verbatim}
   yacc
\end{verbatim}\end{quote}
without arguments to get a short summary of the command line syntax.

\section{TP Lex}

This section describes the TP Lex lexical analyzer generator.

\subsection*{Usage}

\begin{quote}\begin{verbatim}
LEX [options] lex-file[.L]
  [output-file[.PAS]]
\end{verbatim}\end{quote}

\subsection*{Options}

\begin{description}
   \item[\verb"/v"]
      ``Verbose:'' Lex generates a readable description of the generated
      lexical analyzer, written to lex-file with new extension \verb".LST".
   \item[\verb"/o"]
      ``Optimize:'' Lex optimizes DFA tables to produce a minimal DFA.
\end{description}

\subsection*{Description}

TP Lex is a program generator that is used to generate the Turbo Pascal
source code for a lexical analyzer subroutine from the specification
of an input language by a regular expression grammar.

TP Lex parses the source grammar contained in \verb"lex-file" (with default
suffix \verb".L") and writes the constructed lexical analyzer subroutine
to the specified \verb"output-file" (with default suffix \verb".PAS"); if no
output file is specified, output goes to \verb"lex-file" with new suffix
\verb".PAS." If any errors are found during compilation, error messages are
written to the list file (\verb"lex-file" with new suffix \verb".LST").

The generated output file contains a lexical analyzer routine, \verb"yylex",
implemented as:
\begin{quote}\begin{verbatim}
   function yylex : Integer;
\end{verbatim}\end{quote}

This routine has to be called by your main program to execute the lexical
analyzer. The return value of the \verb"yylex" routine usually denotes the
number of a token recognized by the lexical analyzer (see the \verb"return"
routine in the \verb"LexLib" unit). At end-of-file the \verb"yylex" routine
normally returns \verb"0".

The code template for the \verb"yylex" routine may be found in the
\verb"YYLEX.COD" file. This file is needed by TP Lex when it constructs the
output file. It must be present either in the current directory or in the
directory from which TP Lex was executed (TP Lex searches these directories in
the indicated order).

The TP Lex library (\verb"LexLib") unit is required by programs using
Lex-generated lexical analyzers; you will therefore have to put an appropriate
\verb"uses" clause into your program or unit that contains the lexical
analyzer routine. The \verb"LexLib" unit also provides various useful utility
routines; see the file \verb"LEXLIB.PAS" for further information.

\subsection*{Lex Source}

A TP Lex program consists of three sections separated with the \verb"%%"
delimiter:

\begin{quote}\begin{verbatim}
definitions
%%
rules
%%
auxiliary procedures
\end{verbatim}\end{quote}

All sections may be empty. The TP Lex language is line-oriented; definitions
and rules are separated by line breaks. There is no special notation for
comments, but (Turbo Pascal style) comments may be included as Turbo Pascal
fragments (see below).

The definitions section may contain the following elements:
\begin{itemize}
   \item
      regular definitions in the format:
      \begin{quote}\begin{verbatim}
   name   substitution
      \end{verbatim}\end{quote}
      which serve to abbreviate common subexpressions. The \verb"{name}"
      notation causes the corresponding substitution from the definitions
      section to be inserted into a regular expression. The name must be
      a legal identifier (letter followed by a sequence of letters and digits;
      the underscore counts as a letter; upper- and lowercase are distinct).
      Regular definitions must be non-recursive.
   \item
      start state definitions in the format:
      \begin{quote}\begin{verbatim}
   %start name ...
      \end{verbatim}\end{quote}
      which are used in specifying start conditions on rules (described
      below). The \verb"%start" keyword may also be abbreviated as \verb"%s"
      or \verb"%S".
   \item
      Turbo Pascal declarations enclosed between \verb"%{" and \verb"%}".
      These will be inserted into the output file (at global scope). Also,
      any line that does not look like a Lex definition (e.g., starts with
      blank or tab) will be treated as Turbo Pascal code. (In particular,
      this also allows you to include Turbo Pascal comments in your Lex
      program.)
\end{itemize}

The rules section of a TP Lex program contains the actual specification of
the lexical analyzer routine. It may be thought of as a big \verb"CASE"
statement discriminating over the different patterns to be matched and listing the
corresponding statements (actions) to be executed. Each rule consists of a
regular expression describing the strings to be matched in the input, and a
corresponding action, a Turbo Pascal statement to be executed when the
expression matches. Expression and statement are delimited with whitespace
(blanks and/or tabs). Thus the format of a Lex grammar rule is:

\begin{quote}\begin{verbatim}
   expression      statement;
\end{verbatim}\end{quote}

Note that the action must be a single Turbo Pascal statement terminated
with a semicolon (use \verb"begin ... end" for compound statements). The
statement may span multiple lines if the successor lines are indented with
at least one blank or tab. The action may also be replaced by the \verb"|"
character, indicating that the action for this rule is the same as that for
the next one.

The TP Lex library unit provides various variables and routines which are
useful in the programming of actions. In particular, the \verb"yytext" string
variable holds the text of the matched string, and the \verb"yyleng" Byte
variable its length.

Regular expressions are used to describe the strings to be matched in a
grammar rule. They are built from the usual constructs describing character
classes and sequences, and operators specifying repetitions and alternatives.
The precise format of regular expressions is described in the next section.

The rules section may also start with some Turbo Pascal declarations
(enclosed in \verb"%{ %}") which are treated as local declarations of the
actions routine.

Finally, the auxiliary procedures section may contain arbitrary Turbo
Pascal code (such as supporting routines or a main program) which is
simply tacked on to the end of the output file. The auxiliary procedures
section is optional.

\subsection*{Regular Expressions}

Table \ref{tab1} summarizes the format of the regular expressions
recognized by TP Lex (also compare Aho, Sethi, Ullman 1986, fig.\ 3.48).
$c$ stands for a single character, $s$ for a string, $r$ for a regular
expression, and $n,m$ for nonnegative integers.

\begin{table*}\centering
   \begin{tabular}{c|c|c}
      \hline\hline
      {\sc Expression}& {\sc Matches}& {\sc Example}\\
      \hline
      $c$& any non-operator character $c$& \verb"a"\\
      \verb"\"$c$& character $c$ literally& \verb"\*"\\
      \verb'"'$s$\verb'"'& string $s$ literally& \verb'"**"'\\
      \verb"."& any character but newline& \verb"a.*b"\\
      \verb"^"& beginning of line& \verb"^abc"\\
      \verb"$"& end of line& \verb"abc$"\\

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本高清成人免费播放| 理论电影国产精品| 欧美综合一区二区| 亚洲综合久久久| 欧美喷潮久久久xxxxx| 日本麻豆一区二区三区视频| 欧美精品三级日韩久久| 日本不卡一二三区黄网| 精品成人佐山爱一区二区| 国产成人午夜视频| 自拍偷拍欧美精品| 欧美日韩一卡二卡三卡| 捆绑调教一区二区三区| 欧美国产日韩精品免费观看| 91社区在线播放| 偷拍与自拍一区| 久久久欧美精品sm网站| 91在线丨porny丨国产| 视频一区二区国产| 久久久亚洲午夜电影| 91在线视频在线| 美美哒免费高清在线观看视频一区二区| 国产午夜精品在线观看| 欧美性感一类影片在线播放| 麻豆成人av在线| 国产精品国产精品国产专区不蜜 | 尤物视频一区二区| 911精品国产一区二区在线| 国产激情一区二区三区| 亚洲精品老司机| 精品国产乱子伦一区| 91在线国产福利| 免费成人在线影院| 亚洲欧美一区二区三区孕妇| 日韩欧美在线1卡| 91视频在线观看免费| 国产一区二区三区综合| 亚洲综合色噜噜狠狠| 久久婷婷成人综合色| 欧美影视一区在线| 成人avav影音| 久久精品国产一区二区三 | 丝袜美腿高跟呻吟高潮一区| 亚洲国产成人一区二区三区| 日韩午夜三级在线| 色欧美88888久久久久久影院| 国产一区二区三区免费播放| 午夜激情一区二区三区| 亚洲免费观看在线观看| 久久久精品tv| 日韩欧美aaaaaa| 欧美日韩国产三级| 欧美伊人久久久久久久久影院 | 久久午夜色播影院免费高清 | 日韩免费性生活视频播放| 91欧美激情一区二区三区成人| 精品一区二区三区日韩| 日欧美一区二区| 夜夜亚洲天天久久| 国产精品欧美综合在线| 久久久亚洲精品石原莉奈| 日韩网站在线看片你懂的| 欧美日韩国产影片| 在线精品观看国产| 色av成人天堂桃色av| 99精品视频在线免费观看| 国产精品一区免费在线观看| 久久精品国产在热久久| 日本强好片久久久久久aaa| 日韩国产在线观看一区| 午夜视频久久久久久| 亚洲bdsm女犯bdsm网站| 亚洲国产综合在线| 亚洲综合无码一区二区| 夜夜精品浪潮av一区二区三区| 一二三四社区欧美黄| 亚洲精品乱码久久久久久| 亚洲另类一区二区| 亚洲一区二区高清| 亚洲国产aⅴ成人精品无吗| 夜夜精品浪潮av一区二区三区| 一卡二卡三卡日韩欧美| 亚洲成人自拍偷拍| 日本特黄久久久高潮| 蜜桃精品在线观看| 国产寡妇亲子伦一区二区| 国产成人在线视频播放| 99热国产精品| 欧洲国产伦久久久久久久| 欧美三级电影在线观看| 欧美老人xxxx18| 日韩午夜精品视频| 国产视频亚洲色图| 亚洲色图制服诱惑 | 91麻豆精品国产自产在线观看一区| 欧美在线播放高清精品| 911国产精品| 欧美精品一区二区三区很污很色的 | 欧美一区二区三区影视| 精品国产网站在线观看| 欧美国产日韩一二三区| 一区二区三区影院| 日韩电影一区二区三区| 国产精品一区二区不卡| 色婷婷一区二区| 日韩三级电影网址| 国产精品久久一级| 亚洲成av人片在www色猫咪| 激情久久五月天| 91在线云播放| 欧美mv和日韩mv国产网站| 中文字幕中文字幕在线一区| 性做久久久久久久免费看| 国产精品夜夜爽| 欧美日韩视频一区二区| 2023国产一二三区日本精品2022| 国产精品久久久久久户外露出| 午夜视频在线观看一区二区三区 | 粉嫩高潮美女一区二区三区 | 精品久久久久久久久久久久久久久| 中文字幕乱码日本亚洲一区二区| 一区二区在线观看不卡| 久久精品国产**网站演员| 99久久免费精品| 精品国产制服丝袜高跟| 亚洲精品免费在线观看| 久久精品国产99久久6| 在线欧美小视频| 国产女人18水真多18精品一级做| 亚欧色一区w666天堂| www.日韩精品| 精品国产免费一区二区三区香蕉| 亚洲午夜精品久久久久久久久| 国产91精品免费| 精品久久人人做人人爰| 一区二区三区四区蜜桃| 国产a精品视频| 日韩一级免费观看| 亚洲h动漫在线| 一本大道久久精品懂色aⅴ| 国产情人综合久久777777| 日本不卡视频在线观看| 精品视频免费在线| 亚洲欧美日本韩国| 成人精品一区二区三区四区| 精品粉嫩超白一线天av| 热久久一区二区| 欧美色综合久久| 亚洲色图欧洲色图| 风间由美一区二区av101| 制服丝袜成人动漫| 亚洲国产欧美在线人成| 91福利国产成人精品照片| 国产精品久久国产精麻豆99网站| 国产九九视频一区二区三区| 91精品国产综合久久小美女| 亚洲五码中文字幕| 在线观看av一区二区| 亚洲精品视频自拍| 91小视频免费观看| 国产精品久久久久影院亚瑟| 国产福利一区二区| 国产亚洲制服色| 国产大片一区二区| 国产天堂亚洲国产碰碰| 国产精品综合在线视频| 国产亚洲一区字幕| 不卡区在线中文字幕| 亚洲国产精品t66y| jizzjizzjizz欧美| 国产精品热久久久久夜色精品三区| 成人深夜视频在线观看| 国产精品福利一区| 91老师国产黑色丝袜在线| 亚洲色图20p| 久久看人人爽人人| 国产老妇另类xxxxx| 国产欧美一区二区在线| 不卡的av网站| 亚洲乱码国产乱码精品精小说| 色狠狠色狠狠综合| 婷婷久久综合九色综合伊人色| 欧美一级欧美一级在线播放| 奇米影视在线99精品| 国产亚洲一区字幕| 色综合久久99| 丝袜脚交一区二区| 久久久精品黄色| 色偷偷一区二区三区| 日韩精品一级中文字幕精品视频免费观看| 欧美日韩在线播放三区四区| 免费成人av在线| 欧美国产乱子伦| 色婷婷综合久久久久中文| 日韩国产精品久久久久久亚洲| 精品国产91亚洲一区二区三区婷婷| 不卡av在线网| 婷婷久久综合九色综合伊人色| 久久免费视频一区| 色婷婷国产精品久久包臀|