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

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

?? pat5c.htm

?? java設計范式.rar
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
<HTML><HEAD>	<TITLE>Interpreter</TITLE><SCRIPT>function setFocus() {		if ((navigator.appName != "Netscape") && (parseFloat(navigator.appVersion) == 2)) {	return;	} else {	self.focus();	}}</SCRIPT></HEAD><BODY   BGCOLOR         = #FFFFFFonLoad="setFocus()";><A NAME="top"></A><A NAME="Interpreter"></A><A NAME="intent"></A><H2><A HREF="#motivation"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Motivation"></A> Intent</H2> <A NAME="auto1000"></A><P>Given a language, define a represention for its grammar along with aninterpreter that uses the representation to interpret sentences in thelanguage.</P><A NAME="motivation"></A><H2><A HREF="#applicability"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Applicability"></A> Motivation</H2> <A NAME="auto1001"></A><P>If a particular kind of problem occurs often enough, then it might beworthwhile to express instances of the problem as sentences in asimple language.  Then you can build an interpreter that solves theproblem by interpreting these sentences.</P><A NAME="pattern-matching"></A><A NAME="regexp"></A><P>For example, searching for strings that match a pattern is a commonproblem.  Regular expressions are a standard language for specifyingpatterns of strings.  Rather than building custom algorithms to matcheach pattern against strings, search algorithms could interpret aregular expression that specifies a set of strings to match.</P><A NAME="auto1002"></A><P>The Interpreter pattern describes how to define a grammar for simplelanguages, represent sentences in the language, and interpret thesesentences.  In this example, the pattern describes how to define agrammar for regular expressions, represent a particular regularexpression, and how to interpret that regular expression.</P><A NAME="auto1003"></A><P>Suppose the following grammar defines the regular expressions:</P><A NAME="auto1004"></A><PRE>    expression ::= literal | alternation | sequence | repetition |                   '(' expression ')'    alternation ::= expression  '|' expression    sequence ::= expression '&amp;' expression    repetition ::= expression '*'    literal ::= 'a' | 'b' | 'c' | ... { 'a' | 'b' | 'c' | ... }*</PRE><A NAME="auto1005"></A><P>The symbol <CODE>expression</CODE> is the start symbol, and <CODE>literal</CODE>is a terminal symbol defining simple words.</P><A NAME="auto1006"></A><P>The Interpreter pattern uses a class to represent each grammar rule.Symbols on the right-hand side of the rule are instance variables ofthese classes.  The grammar above is represented by five classes: anabstract class RegularExpression and its four subclassesLiteralExpression, AlternationExpression, SequenceExpression, andRepetitionExpression.  The last three classes define variables thathold subexpressions.</P><A NAME="abssynclass"></A><A NAME="244co"></A><P ALIGN=CENTER><IMG SRC="Pictures/inter043.gif"></P><A NAME="abssyntree"></A><P>Every regular expression defined by this grammar is represented by anabstract syntax tree made up of instances of these classes. Forexample, the abstract syntax tree</P><A NAME="abssync"></A><P ALIGN=CENTER><IMG SRC="Pictures/inter042.gif"></P><A NAME="auto1007"></A><P>represents the regular expression</P><A NAME="auto1008"></A><PRE>    raining &amp; (dogs | cats) *</PRE><A NAME="auto1009"></A><P>We can create an interpreter for these regular expressions by definingthe Interpret operation on each subclass of RegularExpression.Interpret takes as an argument the context in which to interpret theexpression.  The context contains the input string and information onhow much of it has been matched so far.  Each subclass ofRegularExpression implements Interpret to match the next part of theinput string based on the current context.  For example,</P><UL><A NAME="auto1010"></A><LI>LiteralExpression will check if the input matches the literal itdefines,</LI><A NAME="auto1011"></A><P></P><A NAME="auto1012"></A><LI>AlternationExpression will check if the input matches any of itsalternatives,</LI><A NAME="auto1013"></A><P></P><A NAME="auto1014"></A><LI>RepetitionExpression will check if the input has multiple copies ofexpression it repeats,</LI></UL><A NAME="auto1015"></A><P>and so on.</P><A NAME="applicability"></A><H2><A HREF="#structure"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Structure"></A> Applicability</H2> <A NAME="auto1016"></A><P>Use the Interpreter pattern when there is a language to interpret, andyou can represent statements in the language as abstract syntax trees.The Interpreter pattern works best when</P><UL><A NAME="auto1017"></A><LI>the grammar is simple. For complex grammars, the class hierarchy forthe grammar becomes large and unmanageable.  Tools such as parsergenerators are a better alternative in such cases.  They can interpretexpressions without building abstract syntax trees, which can savespace and possibly time.</LI><A NAME="auto1018"></A><P></P><A NAME="auto1019"></A><LI>efficiency is not a critical concern.  The most efficient interpretersare usually <EM>not</EM> implemented by interpreting parse trees directlybut by first translating them into another form.  For example, regularexpressions are often transformed into state machines.  But even then,the <EM>translator</EM> can be implemented by the Interpreter pattern, sothe pattern is still applicable.</LI></UL><A NAME="structure"></A><H2><A HREF="#participants"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Participants"></A> Structure</H2> <P ALIGN=CENTER><IMG SRC="Pictures/inter041.gif"></P><A NAME="participants"></A><H2><A HREF="#collaborations"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Collaborations"></A> Participants</H2><UL><A NAME="auto1020"></A><LI><B>AbstractExpression</B> (RegularExpression)</LI><A NAME="auto1021"></A><P></P>    <UL>    <A NAME="auto1022"></A><LI>declares an abstract Interpret operation that is common to    all nodes in the abstract syntax tree.</LI>    </UL><A NAME="auto1023"></A><P></P><A NAME="terminal-symbol"></A><A NAME="terminal-expr"></A><LI><B>TerminalExpression</B> (LiteralExpression)</LI><A NAME="auto1024"></A><P></P>    <UL>    <A NAME="auto1025"></A><LI>implements an Interpret operation associated with terminal    symbols in the grammar.</LI>    <A NAME="auto1026"></A><P><!-- extra space --></P>    <A NAME="auto1027"></A><LI>an instance is required for every terminal symbol in a    sentence.</LI>    </UL><A NAME="auto1028"></A><P></P><A NAME="auto1029"></A><LI><B>NonterminalExpression</B> (AlternationExpression,RepetitionExpression, SequenceExpressions)</LI><A NAME="auto1030"></A><P></P>    <UL>    <A NAME="auto1031"></A><LI>one such class is required for every rule <I>R</I> ::=    <I>R</I><SUB>1</SUB> <I>R</I><SUB>2</SUB> ... <I>R</I><SUB>n</SUB></I>    in the grammar.</LI>    <A NAME="auto1032"></A><P><!-- extra space --></P>    <A NAME="auto1033"></A><LI>maintains instance variables of type AbstractExpression    for each of the symbols <I>R</I><SUB>1</SUB> through    <I>R</I><SUB>n</SUB>.</LI>    <A NAME="auto1034"></A><P><!-- extra space --></P>    <A NAME="auto1035"></A><LI>implements an Interpret operation for    nonterminal symbols in the grammar. Interpret typically calls itself    recursively on the variables representing <I>R</I><SUB>1</SUB> through    <I>R</I><SUB>n</SUB>.</LI>    </UL><A NAME="auto1036"></A><P></P><A NAME="auto1037"></A><LI><B>Context</B></LI><A NAME="auto1038"></A><P></P>    <UL>    <A NAME="auto1039"></A><LI>contains information that's global to the interpreter.</LI>    </UL><A NAME="auto1040"></A><P></P><A NAME="auto1041"></A><LI><B>Client</B></LI><A NAME="auto1042"></A><P></P>    <UL>    <A NAME="auto1043"></A><LI>builds (or is given) an abstract syntax tree representing a    particular sentence in the language that the grammar defines.  The    abstract syntax tree is assembled from instances of the    NonterminalExpression and TerminalExpression classes.</LI>    <A NAME="auto1044"></A><P><!-- extra space --></P>    <A NAME="auto1045"></A><LI>invokes the Interpret operation.</LI>    </UL></UL><A NAME="collaborations"></A><H2><A HREF="#consequences"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Consequences"></A> Collaborations</H2><UL><A NAME="auto1046"></A><LI>The client builds (or is given) the sentence as an abstract syntaxtree of NonterminalExpression and TerminalExpression instances.  Thenthe client initializes the context and invokes the Interpretoperation.</LI><A NAME="auto1047"></A><P></P><A NAME="auto1048"></A><LI>Each NonterminalExpression node defines Interpret in terms ofInterpret on each subexpression.  The Interpret operation of eachTerminalExpression defines the base case in the recursion.</LI><A NAME="auto1049"></A><P></P><A NAME="auto1050"></A><LI>The Interpret operations at each node use the context tostore and access the state of the interpreter.</LI></UL><A NAME="consequences"></A><H2><A HREF="#implementation"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Implementation"></A> Consequences</H2> <A NAME="auto1051"></A><P>The Interpreter pattern has the following benefits and liabilities:</P><OL><A NAME="auto1052"></A><LI><EM>It's easy to change and extend the grammar.</EM>Because the pattern uses classes to represent grammar rules, you canuse inheritance to change or extend the grammar.  Existing expressionscan be modified incrementally, and new expressions can be defined asvariations on old ones.</LI><A NAME="auto1053"></A><P></P><A NAME="parser-247"></A><LI><EM>Implementing the grammar is easy, too.</EM>Classes defining nodes in the abstract syntax tree have similarimplementations.  These classes are easy to write, and often theirgeneration can be automated with a compiler or parser generator.</LI><A NAME="auto1054"></A><P></P>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
狠狠色综合播放一区二区| 亚洲综合一二三区| 精品久久久久久久久久久院品网 | 精品国产91洋老外米糕| 3d成人h动漫网站入口| 色欧美片视频在线观看| 成人福利视频在线看| 成人免费精品视频| 懂色av中文一区二区三区 | 欧美电影精品一区二区| 欧美丝袜自拍制服另类| 欧美影视一区在线| 国产成人在线色| 国产精品18久久久| 风间由美性色一区二区三区| 亚洲自拍偷拍九九九| 五月天一区二区三区| 亚洲成人免费影院| 亚洲日本丝袜连裤袜办公室| 一区二区三区在线观看欧美| 亚洲天堂久久久久久久| 18成人在线视频| 午夜精品在线视频一区| 五月天一区二区三区| 青青青伊人色综合久久| 国产成人99久久亚洲综合精品| 国产黄色精品网站| 91美女福利视频| 日韩欧美成人激情| 中文字幕 久热精品 视频在线| 国产精品素人一区二区| 午夜视频一区二区| 国产资源精品在线观看| www.日本不卡| 色欧美片视频在线观看| 欧美久久久久免费| 26uuu精品一区二区| 国产性做久久久久久| 亚洲伦理在线精品| 奇米色一区二区| 日韩电影在线观看电影| 成人aa视频在线观看| 欧美日韩一区二区在线观看视频| 日韩一区二区免费在线电影| 亚洲欧美综合色| 日日夜夜免费精品| 成人免费视频网站在线观看| 91精品欧美综合在线观看最新| 国产免费久久精品| 亚洲午夜久久久久久久久久久| 国产麻豆精品久久一二三| 一本久道久久综合中文字幕 | 欧美乱妇20p| 国产精品成人网| 毛片av一区二区| 一本一道综合狠狠老| 欧美巨大另类极品videosbest| 久久久久久久久久久黄色| 亚洲超丰满肉感bbw| 久久精品国产精品青草| 欧美久久久久久久久中文字幕| 国产精品久久777777| 亚洲综合免费观看高清完整版| www.在线欧美| 久久亚洲影视婷婷| 三级影片在线观看欧美日韩一区二区 | 日本国产一区二区| 久久久99久久| 精品无人码麻豆乱码1区2区 | 日韩成人午夜精品| 欧美三级电影在线观看| 国产三级精品视频| 国产综合色在线视频区| 精品国精品国产| 麻豆精品精品国产自在97香蕉| 欧美视频在线一区| 国产精品成人免费| 国产白丝网站精品污在线入口| 日韩欧美久久一区| 国产精品乱码一区二区三区软件| 国产一区二区看久久| 日韩一级片网址| 日韩高清不卡一区二区三区| 91精品啪在线观看国产60岁| 亚洲图片欧美一区| 欧美日韩免费高清一区色橹橹| 亚洲成人黄色小说| 欧美日韩中字一区| 日韩国产精品久久| 欧美日韩中文一区| 爽爽淫人综合网网站| 欧美伦理电影网| 18成人在线观看| 欧美日韩国产成人在线免费| 亚洲影视在线观看| 91高清在线观看| 麻豆精品新av中文字幕| 精品国产一区二区三区忘忧草 | 国产精品一区二区在线播放| 日韩午夜激情电影| 九九视频精品免费| 亚洲国产成人午夜在线一区 | 国产精品色婷婷久久58| 色综合激情五月| 天天综合天天做天天综合| 91麻豆精品国产91久久久使用方法 | 美女视频黄久久| 精品国产乱子伦一区| 日韩一区二区三区精品视频| 久久这里只有精品首页| 国产精品午夜久久| 亚洲图片激情小说| 国产精品热久久久久夜色精品三区| 精品日韩在线一区| 亚洲裸体在线观看| 日韩精品成人一区二区三区| 久久国产精品99久久久久久老狼| 成人少妇影院yyyy| 国产精品一区二区免费不卡| 色视频成人在线观看免| 日本亚洲欧美天堂免费| 国产精品天干天干在观线| 成人黄色av网站在线| 成人免费视频在线观看| 久久久亚洲午夜电影| 在线观看视频一区二区| 久久国产精品区| 一区二区三区欧美日韩| 日韩精品中文字幕一区二区三区| 成人激情动漫在线观看| 日韩毛片视频在线看| 国产欧美一区二区精品仙草咪| 欧美视频在线观看一区二区| 久久国产尿小便嘘嘘| 国产亚洲精品bt天堂精选| 色综合天天综合网天天狠天天| 国产一区二三区| 韩国女主播成人在线观看| 亚洲444eee在线观看| 一区二区三区不卡在线观看 | 国产成人高清在线| 精品一区二区三区av| 日本一区中文字幕| 免费人成精品欧美精品| 午夜av一区二区三区| 亚洲国产毛片aaaaa无费看| 亚洲欧美一区二区不卡| 国产精品女主播在线观看| 亚洲国产精品av| 中文字幕亚洲不卡| 亚洲免费观看在线视频| 国产精品国产三级国产三级人妇| 国产精品免费免费| 国产精品久久久久久久岛一牛影视| 中文乱码免费一区二区| 国产精品久久久久婷婷| 亚洲免费成人av| 亚洲va韩国va欧美va| 日韩电影免费在线| 韩日av一区二区| 成人性视频免费网站| av在线一区二区| 欧美日韩在线精品一区二区三区激情 | 日韩中文字幕亚洲一区二区va在线 | 欧美激情中文不卡| 国产精品高潮呻吟| 亚洲精品你懂的| 男女激情视频一区| 粉嫩欧美一区二区三区高清影视| 91丨九色porny丨蝌蚪| 精品视频一区三区九区| 日韩丝袜美女视频| 国产亚洲精品资源在线26u| 亚洲色图另类专区| 亚洲一区成人在线| 日韩激情一区二区| 成人黄色软件下载| 这里只有精品99re| 中文字幕va一区二区三区| 亚洲国产综合色| 国产福利不卡视频| 欧美亚洲高清一区二区三区不卡| 欧美一区二区三区男人的天堂| 久久精品欧美一区二区三区麻豆| 亚洲视频一区在线观看| 久久se这里有精品| 色屁屁一区二区| 26uuu国产一区二区三区| 综合久久久久综合| 精品一区二区三区的国产在线播放| 99久久精品情趣| 91.com视频| 亚洲日本欧美天堂| 国产精品99久久久久久久女警 | 极品少妇一区二区三区精品视频| 91同城在线观看| 精品国产一区二区三区久久久蜜月| 国产精品不卡在线| 国模套图日韩精品一区二区| 色狠狠av一区二区三区|