亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
蜜臀av一区二区| 久久国产夜色精品鲁鲁99| 欧美一区二区视频观看视频| 国产凹凸在线观看一区二区| 亚洲国产精品自拍| 国产精品全国免费观看高清| 91麻豆精品国产91久久久久久| 成人18视频日本| 国产一区二区三区在线观看精品 | 亚洲欧美自拍偷拍| 久久久亚洲高清| 欧美成人乱码一区二区三区| 欧美高清视频www夜色资源网| 色综合欧美在线视频区| 国产91精品久久久久久久网曝门| 日韩中文字幕麻豆| 日韩二区三区在线观看| 亚洲午夜久久久久中文字幕久| 日韩精品一级二级 | 日韩欧美一区二区三区在线| 91网站最新网址| 91免费看`日韩一区二区| 成人黄色网址在线观看| 99久久婷婷国产综合精品| 成人小视频在线观看| 成人美女视频在线观看18| 成人av资源站| 色哟哟国产精品免费观看| 91性感美女视频| 欧美怡红院视频| 51精品秘密在线观看| 久久综合色播五月| 国产乱色国产精品免费视频| 日本乱人伦一区| 日本一区二区久久| 亚洲一区日韩精品中文字幕| 欧美男男青年gay1069videost| 欧美电影免费观看高清完整版在线观看| 国产风韵犹存在线视精品| 欧美视频你懂的| 亚洲愉拍自拍另类高清精品| 欧美a一区二区| 99精品黄色片免费大全| 91精品免费在线| 亚洲视频免费看| 久久97超碰色| 欧美日韩小视频| 国产日韩av一区二区| 亚洲狠狠爱一区二区三区| 粉嫩高潮美女一区二区三区| 欧美一级在线观看| 午夜欧美大尺度福利影院在线看| 成人黄色国产精品网站大全在线免费观看| 欧美日本精品一区二区三区| 亚洲视频在线一区观看| 国产综合久久久久久鬼色 | 日韩毛片视频在线看| 日精品一区二区| 在线观看三级视频欧美| 国精产品一区一区三区mba视频| 欧美综合一区二区三区| 国产精品高潮久久久久无| 国产一区二区在线观看免费 | 中文一区二区完整视频在线观看| 免费精品99久久国产综合精品| 精品视频免费看| 天堂一区二区在线| 91福利国产成人精品照片| 亚洲视频精选在线| 一本大道综合伊人精品热热| 国产精品久久久久久久久图文区| 成人永久aaa| 亚洲裸体在线观看| 日本精品免费观看高清观看| 亚洲三级免费电影| 欧美日韩一区不卡| 日韩电影在线观看一区| 国产精品伦理一区二区| 精品国产露脸精彩对白| 欧美亚洲动漫精品| 97se狠狠狠综合亚洲狠狠| 水野朝阳av一区二区三区| 久久婷婷成人综合色| 91蜜桃免费观看视频| 免费看欧美女人艹b| 国产精品久久久久久久裸模 | 亚洲激情在线激情| 精品免费一区二区三区| 国产成人在线免费观看| 亚洲va在线va天堂| 久久免费电影网| 欧美精品xxxxbbbb| 99久精品国产| 国产一本一道久久香蕉| 亚洲精品一卡二卡| 在线播放中文字幕一区| 欧美日韩高清一区| 成人免费观看av| av影院午夜一区| 欧美极品aⅴ影院| 日韩精品一区二区三区中文不卡 | 亚洲免费av高清| 国产精品久久免费看| 欧美国产亚洲另类动漫| 精品国产成人系列| 狠狠色狠狠色综合日日91app| 国产东北露脸精品视频| 欧美性大战久久| 免费在线视频一区| xvideos.蜜桃一区二区| 91老师片黄在线观看| 亚洲综合丝袜美腿| 欧美老肥妇做.爰bbww视频| 欧美肥妇free| 韩国在线一区二区| 在线视频国内一区二区| 综合激情网...| 一本一本大道香蕉久在线精品| 中文字幕亚洲一区二区va在线| 国产传媒欧美日韩成人| 国产精品福利一区二区| 91激情五月电影| 中文无字幕一区二区三区| 欧美日韩久久久一区| 国产老女人精品毛片久久| 亚洲综合免费观看高清完整版| 精品国产乱码久久久久久影片| 91视频www| 久久99精品久久久久婷婷| 亚洲精品ww久久久久久p站| 久久奇米777| 欧美精品 国产精品| 99国产欧美另类久久久精品| 久久99国产精品尤物| 欧美va亚洲va在线观看蝴蝶网| 久久不见久久见中文字幕免费| 综合久久一区二区三区| 日韩精品一区二区三区在线播放| 99re成人精品视频| 国产乱子轮精品视频| 亚洲高清一区二区三区| 国产色产综合色产在线视频| 8x8x8国产精品| 9i在线看片成人免费| 久久激情五月婷婷| 亚洲一级在线观看| 国产精品欧美一区喷水| 精品国产1区2区3区| 欧美二区在线观看| 日本丶国产丶欧美色综合| 国产成人精品免费网站| 裸体一区二区三区| 亚洲国产乱码最新视频 | 成人黄色777网| 欧美日韩一区三区| 中文字幕色av一区二区三区| 亚洲成人免费在线| 91亚洲资源网| 国产精品卡一卡二| 日本va欧美va精品| 欧美中文一区二区三区| 国产精品每日更新在线播放网址| 久久精品久久99精品久久| 日本精品一级二级| 亚洲免费观看高清在线观看| 国产黄色91视频| 亚洲精品高清视频在线观看| 国产馆精品极品| 欧美成人一区二区三区片免费| 亚洲最大成人网4388xx| 91国产成人在线| 亚洲免费大片在线观看| 日韩女优毛片在线| 精品一区二区三区欧美| 欧美高清在线视频| 在线播放视频一区| 亚洲v中文字幕| 欧美日韩日日夜夜| 国产精品电影一区二区三区| 国产一区二区导航在线播放| 久久蜜桃av一区二区天堂| 国产精品1区2区3区| 欧美高清在线视频| 精品精品国产高清a毛片牛牛 | 国产精品一区二区黑丝| 国产呦精品一区二区三区网站| 久久99国产精品免费| 国产精品九色蝌蚪自拍| 久久久精品中文字幕麻豆发布| 91免费观看在线| 高清不卡一区二区| 色噜噜狠狠成人中文综合| 在线观看国产一区二区| 欧美日精品一区视频| 波多野结衣视频一区| 亚洲美女视频在线观看| 亚洲伊人色欲综合网| 午夜日韩在线电影| 久久国产精品一区二区| 激情六月婷婷久久|