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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tply.tex

?? 編譯原理基礎(chǔ)
?? 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$"\\

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品美女一区二区| 538在线一区二区精品国产| 欧美亚洲另类激情小说| 欧美一三区三区四区免费在线看| 日韩片之四级片| 337p粉嫩大胆噜噜噜噜噜91av | 91麻豆文化传媒在线观看| 在线观看成人小视频| 久久婷婷成人综合色| 亚洲制服丝袜av| 国产99一区视频免费| 91精品国产麻豆国产自产在线| 国产精品久久久99| 日本不卡一区二区三区| 91在线免费看| 精品国产1区二区| 亚洲成在人线免费| 99视频一区二区三区| 欧美精品欧美精品系列| 亚洲激情校园春色| av中文字幕不卡| 久久久精品人体av艺术| 国产原创一区二区| 26uuu欧美| 韩国三级电影一区二区| 日韩亚洲欧美综合| 青草av.久久免费一区| 在线观看不卡视频| 亚洲综合在线电影| 一本色道a无线码一区v| 国产精品国产三级国产aⅴ原创 | 中文字幕高清不卡| 国产一区二区三区蝌蚪| 欧美成人午夜电影| 国产在线精品一区二区三区不卡| 欧美视频中文字幕| 亚洲一区影音先锋| 成人免费高清在线| 久久久影院官网| 国产一区二区三区香蕉| 久久精品人人做人人综合 | 喷水一区二区三区| 欧美浪妇xxxx高跟鞋交| 国产精品乱码久久久久久 | 一区二区三区在线视频免费观看| 不卡av电影在线播放| 国产精品国产三级国产| 成人免费视频视频在线观看免费| 国产精品国产三级国产普通话三级 | 欧美三级电影在线观看| 一区二区欧美精品| 欧美日韩在线播| 婷婷综合在线观看| 欧美在线免费观看亚洲| 亚洲国产日韩精品| 欧美老女人第四色| 国产盗摄精品一区二区三区在线| 国产亚洲女人久久久久毛片| 波波电影院一区二区三区| 亚洲一区二区三区国产| 欧美一区二区私人影院日本| 黄一区二区三区| 色婷婷综合久久久中文一区二区| 久久久久九九视频| 成人黄色综合网站| 三级在线观看一区二区| 久久午夜羞羞影院免费观看| 成人av第一页| 丝袜脚交一区二区| 日本一区二区视频在线观看| 欧美综合天天夜夜久久| 国内一区二区在线| 亚洲精品国产视频| 久久久久久久av麻豆果冻| 欧美手机在线视频| 成人一区二区三区在线观看| 日韩有码一区二区三区| 国产精品国产成人国产三级| 日韩三级免费观看| 日本乱人伦一区| 国产丶欧美丶日本不卡视频| 一区二区三区**美女毛片| 亚洲精品一区二区三区福利 | 91麻豆免费看| 国产精品久久久久久妇女6080| 在线免费观看日韩欧美| www.一区二区| 99精品在线观看视频| 国产精品综合视频| 国产精品白丝jk白祙喷水网站| 成人国产亚洲欧美成人综合网| 在线观看中文字幕不卡| 精品欧美久久久| 亚洲欧美一区二区三区极速播放| 亚洲午夜激情av| 国模一区二区三区白浆| 欧美性猛交一区二区三区精品| 欧美大胆一级视频| 一个色综合网站| 国产精品一二三| 欧美一二三在线| 亚洲伦理在线精品| 国产精品538一区二区在线| 精品视频在线视频| 亚洲色欲色欲www在线观看| 国产麻豆成人精品| 日韩午夜精品电影| 奇米色一区二区| 欧美日韩在线精品一区二区三区激情| 日韩欧美国产一二三区| 亚洲第一搞黄网站| 91久久线看在观草草青青| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 日韩视频一区在线观看| 亚洲一区二区不卡免费| 在线免费亚洲电影| 一二三区精品视频| 在线亚洲免费视频| 一区二区三区久久| 欧美日本一区二区在线观看| 国产精品午夜电影| 99精品国产99久久久久久白柏| 欧美一区二区三区四区在线观看 | 成人精品免费看| 国产欧美1区2区3区| 美女网站色91| 国产欧美一区二区三区在线老狼| 久久不见久久见中文字幕免费| 精品日韩欧美在线| 国产精品18久久久久久vr| 日本一区二区动态图| 99久久久精品免费观看国产蜜| 亚洲欧洲日产国产综合网| 欧美日韩视频不卡| 国产精品一级二级三级| 樱花草国产18久久久久| 欧美二区在线观看| 国产精品一二三在| 日韩在线一区二区| 国产午夜精品久久久久久久| 91黄色免费看| 国产尤物一区二区| 天天操天天干天天综合网| 久久网站最新地址| 欧美日韩国产欧美日美国产精品| 国产一区不卡在线| 亚洲国产美女搞黄色| 亚洲三级在线免费观看| 日韩欧美卡一卡二| 欧亚洲嫩模精品一区三区| 国产mv日韩mv欧美| 极品少妇一区二区三区精品视频| 一区二区三区不卡在线观看| 国产精品久久久久久久久免费樱桃| 欧美电视剧在线观看完整版| 欧美日本不卡视频| 欧美专区日韩专区| 日本电影亚洲天堂一区| 色综合久久综合中文综合网| 成人一区二区三区视频| 国产美女在线精品| 狠狠色丁香婷婷综合| 麻豆精品一区二区| 美国毛片一区二区三区| 日本亚洲视频在线| 一区二区三区av电影| 亚洲一区免费视频| 日日夜夜免费精品视频| 亚洲一区二区黄色| 午夜一区二区三区视频| 亚洲成a人片在线观看中文| 日韩中文字幕亚洲一区二区va在线 | 中文字幕中文在线不卡住| 国产精品区一区二区三区| 亚洲视频1区2区| 丝袜诱惑制服诱惑色一区在线观看| 日本免费新一区视频| 国产成人精品亚洲午夜麻豆| 成人免费看的视频| 欧美在线色视频| 欧美大胆一级视频| 日韩毛片视频在线看| 婷婷丁香激情综合| 三级欧美在线一区| 国产·精品毛片| 欧美在线观看一区二区| 欧美mv和日韩mv的网站| 中文字幕在线视频一区| 日韩电影在线免费看| 丁香六月综合激情| 欧美一级欧美三级| 亚洲免费观看高清完整版在线观看| 日本不卡不码高清免费观看| a在线欧美一区| 久久亚洲综合色一区二区三区| 亚洲第一在线综合网站| 成人av在线影院| 精品国产污污免费网站入口| 首页国产欧美久久| 欧美性生活大片视频|