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

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

?? lemon.html

?? 嵌入式數(shù)據(jù)庫
?? HTML
?? 第 1 頁 / 共 3 頁
字號:
<p>Yacc and bison allow terminal symbols to have either alphanumericnames or to be individual characters included in single quotes, likethis: ')' or '$'.  Lemon does not allow this alternative form forterminal symbols.  With Lemon, all symbols, terminals and nonterminals,must have alphanumeric names.</p><h3>Grammar Rules</h3><p>The main component of a Lemon grammar file is a sequence of grammarrules.Each grammar rule consists of a nonterminal symbol followed bythe special symbol ``::='' and then a list of terminals and/or nonterminals.The rule is terminated by a period.The list of terminals and nonterminals on the right-hand side of therule can be empty.Rules can occur in any order, except that the left-hand side of thefirst rule is assumed to be the start symbol for the grammar (unlessspecified otherwise using the <tt>%start</tt> directive described below.)A typical sequence of grammar rules might look something like this:<pre>  expr ::= expr PLUS expr.  expr ::= expr TIMES expr.  expr ::= LPAREN expr RPAREN.  expr ::= VALUE.</pre></p><p>There is one non-terminal in this example, ``expr'', and fiveterminal symbols or tokens: ``PLUS'', ``TIMES'', ``LPAREN'',``RPAREN'' and ``VALUE''.</p><p>Like yacc and bison, Lemon allows the grammar to specify a blockof C code that will be executed whenever a grammar rule is reducedby the parser.In Lemon, this action is specified by putting the C code (containedwithin curly braces <tt>{...}</tt>) immediately after theperiod that closes the rule.For example:<pre>  expr ::= expr PLUS expr.   { printf("Doing an addition...\n"); }</pre></p><p>In order to be useful, grammar actions must normally be linked totheir associated grammar rules.In yacc and bison, this is accomplished by embedding a ``$$'' in theaction to stand for the value of the left-hand side of the rule andsymbols ``$1'', ``$2'', and so forth to stand for the value ofthe terminal or nonterminal at position 1, 2 and so forth on theright-hand side of the rule.This idea is very powerful, but it is also very error-prone.  Thesingle most common source of errors in a yacc or bison grammar isto miscount the number of symbols on the right-hand side of a grammarrule and say ``$7'' when you really mean ``$8''.</p><p>Lemon avoids the need to count grammar symbols by assigning symbolicnames to each symbol in a grammar rule and then using those symbolicnames in the action.In yacc or bison, one would write this:<pre>  expr -> expr PLUS expr  { $$ = $1 + $3; };</pre>But in Lemon, the same rule becomes the following:<pre>  expr(A) ::= expr(B) PLUS expr(C).  { A = B+C; }</pre>In the Lemon rule, any symbol in parentheses after a grammar rulesymbol becomes a place holder for that symbol in the grammar rule.This place holder can then be used in the associated C action tostand for the value of that symbol.<p><p>The Lemon notation for linking a grammar rule with its reduceaction is superior to yacc/bison on several counts.First, as mentioned above, the Lemon method avoids the need tocount grammar symbols.Secondly, if a terminal or nonterminal in a Lemon grammar ruleincludes a linking symbol in parentheses but that linking symbolis not actually used in the reduce action, then an error messageis generated.For example, the rule<pre>  expr(A) ::= expr(B) PLUS expr(C).  { A = B; }</pre>will generate an error because the linking symbol ``C'' is usedin the grammar rule but not in the reduce action.</p><p>The Lemon notation for linking grammar rules to reduce actionsalso facilitates the use of destructors for reclaiming memoryallocated by the values of terminals and nonterminals on theright-hand side of a rule.</p><h3>Precedence Rules</h3><p>Lemon resolves parsing ambiguities in exactly the same way asyacc and bison.  A shift-reduce conflict is resolved in favorof the shift, and a reduce-reduce conflict is resolved by reducingwhichever rule comes first in the grammar file.</p><p>Just like inyacc and bison, Lemon allows a measure of control over the resolution of paring conflicts using precedence rules.A precedence value can be assigned to any terminal symbolusing the %left, %right or %nonassoc directives.  Terminal symbolsmentioned in earlier directives have a lower precedence thatterminal symbols mentioned in later directives.  For example:</p><p><pre>   %left AND.   %left OR.   %nonassoc EQ NE GT GE LT LE.   %left PLUS MINUS.   %left TIMES DIVIDE MOD.   %right EXP NOT.</pre></p><p>In the preceding sequence of directives, the AND operator isdefined to have the lowest precedence.  The OR operator is oneprecedence level higher.  And so forth.  Hence, the grammar wouldattempt to group the ambiguous expression<pre>     a AND b OR c</pre>like this<pre>     a AND (b OR c).</pre>The associativity (left, right or nonassoc) is used to determinethe grouping when the precedence is the same.  AND is left-associativein our example, so<pre>     a AND b AND c</pre>is parsed like this<pre>     (a AND b) AND c.</pre>The EXP operator is right-associative, though, so<pre>     a EXP b EXP c</pre>is parsed like this<pre>     a EXP (b EXP c).</pre>The nonassoc precedence is used for non-associative operators.So<pre>     a EQ b EQ c</pre>is an error.</p><p>The precedence of non-terminals is transferred to rules as follows:The precedence of a grammar rule is equal to the precedence of theleft-most terminal symbol in the rule for which a precedence isdefined.  This is normally what you want, but in those cases whereyou want to precedence of a grammar rule to be something different,you can specify an alternative precedence symbol by putting thesymbol in square braces after the period at the end of the rule andbefore any C-code.  For example:</p><p><pre>   expr = MINUS expr.  [NOT]</pre></p><p>This rule has a precedence equal to that of the NOT symbol, not theMINUS symbol as would have been the case by default.</p><p>With the knowledge of how precedence is assigned to terminalsymbols and individualgrammar rules, we can now explain precisely how parsing conflictsare resolved in Lemon.  Shift-reduce conflicts are resolvedas follows:<ul><li> If either the token to be shifted or the rule to be reduced     lacks precedence information, then resolve in favor of the     shift, but report a parsing conflict.<li> If the precedence of the token to be shifted is greater than     the precedence of the rule to reduce, then resolve in favor     of the shift.  No parsing conflict is reported.<li> If the precedence of the token it be shifted is less than the     precedence of the rule to reduce, then resolve in favor of the     reduce action.  No parsing conflict is reported.<li> If the precedences are the same and the shift token is     right-associative, then resolve in favor of the shift.     No parsing conflict is reported.<li> If the precedences are the same the the shift token is     left-associative, then resolve in favor of the reduce.     No parsing conflict is reported.<li> Otherwise, resolve the conflict by doing the shift and     report the parsing conflict.</ul>Reduce-reduce conflicts are resolved this way:<ul><li> If either reduce rule      lacks precedence information, then resolve in favor of the     rule that appears first in the grammar and report a parsing     conflict.<li> If both rules have precedence and the precedence is different     then resolve the dispute in favor of the rule with the highest     precedence and do not report a conflict.<li> Otherwise, resolve the conflict by reducing by the rule that     appears first in the grammar and report a parsing conflict.</ul><h3>Special Directives</h3><p>The input grammar to Lemon consists of grammar rules and specialdirectives.  We've described all the grammar rules, so now we'lltalk about the special directives.</p><p>Directives in lemon can occur in any order.  You can put them beforethe grammar rules, or after the grammar rules, or in the mist of thegrammar rules.  It doesn't matter.  The relative order ofdirectives used to assign precedence to terminals is important, butother than that, the order of directives in Lemon is arbitrary.</p><p>Lemon supports the following special directives:<ul><li><tt>%code</tt><li><tt>%default_destructor</tt><li><tt>%default_type</tt><li><tt>%destructor</tt><li><tt>%extra_argument</tt><li><tt>%include</tt><li><tt>%left</tt><li><tt>%name</tt><li><tt>%nonassoc</tt><li><tt>%parse_accept</tt><li><tt>%parse_failure </tt><li><tt>%right</tt><li><tt>%stack_overflow</tt><li><tt>%stack_size</tt><li><tt>%start_symbol</tt><li><tt>%syntax_error</tt><li><tt>%token_destructor</tt><li><tt>%token_prefix</tt><li><tt>%token_type</tt><li><tt>%type</tt></ul>Each of these directives will be described separately in thefollowing sections:</p><h4>The <tt>%code</tt> directive</h4><p>The %code directive is used to specify addition C/C++ code thatis added to the end of the main output file.  This is similar tothe %include directive except that %include is inserted at thebeginning of the main output file.</p><p>%code is typically used to include some action routines or perhapsa tokenizer as part of the output file.</p><h4>The <tt>%default_destructor</tt> directive</h4><p>The %default_destructor directive specifies a destructor to use for non-terminals that do not have their own destructorspecified by a separate %destructor directive.  See the documentationon the %destructor directive below for additional information.</p><p>In some grammers, many different non-terminal symbols have thesame datatype and hence the same destructor.  This directive isa convenience way to specify the same destructor for all thosenon-terminals using a single statement.</p><h4>The <tt>%default_type</tt> directive</h4><p>The %default_type directive specifies the datatype of non-terminalsymbols that do no have their own datatype defined using a separate%type directive.  See the documentation on %type below for additioninformation.</p><h4>The <tt>%destructor</tt> directive</h4><p>The %destructor directive is used to specify a destructor fora non-terminal symbol.(See also the %token_destructor directive which is used tospecify a destructor for terminal symbols.)</p><p>A non-terminal's destructor is called to dispose of thenon-terminal's value whenever the non-terminal is popped fromthe stack.  This includes all of the following circumstances:<ul><li> When a rule reduces and the value of a non-terminal on     the right-hand side is not linked to C code.<li> When the stack is popped during error processing.<li> When the ParseFree() function runs.</ul>The destructor can do whatever it wants with the value ofthe non-terminal, but its design is to deallocate memoryor other resources held by that non-terminal.</p><p>Consider an example:<pre>   %type nt {void*}   %destructor nt { free($$); }   nt(A) ::= ID NUM.   { A = malloc( 100 ); }</pre>This example is a bit contrived but it serves to illustrate how

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
www日韩大片| 一区二区在线观看av| 亚洲欧美色一区| 久久国产精品免费| 色综合婷婷久久| 久久婷婷国产综合精品青草| 亚洲精品欧美综合四区| 国产成人精品一区二| 日韩一区二区在线看片| 亚洲国产精品一区二区尤物区| 成人免费视频视频| 久久久精品一品道一区| 奇米一区二区三区av| 欧美性生活久久| 亚洲久草在线视频| eeuss鲁一区二区三区| 国产三级欧美三级| 激情成人午夜视频| 精品欧美一区二区久久| 日韩精彩视频在线观看| 欧美三片在线视频观看| 亚洲一区视频在线观看视频| 成人精品小蝌蚪| 日本一二三不卡| 国产精品一区二区黑丝| 精品99999| 激情综合五月婷婷| www精品美女久久久tv| 免播放器亚洲一区| 日韩一区二区视频在线观看| 日韩福利视频导航| 欧美乱妇20p| 日韩不卡免费视频| 欧美一区二区三区白人| 日韩精品电影在线观看| 欧美一区二区高清| 国产在线精品视频| 国产欧美一区二区精品性色超碰| 国产高清成人在线| 国产精品国产馆在线真实露脸 | 国产日韩v精品一区二区| 韩国在线一区二区| 国产欧美一区二区在线| 成人午夜视频福利| 亚洲精品视频免费看| 欧美三级韩国三级日本三斤| 午夜影院久久久| 精品日韩一区二区| 成人在线视频首页| 亚洲欧美日韩久久| 在线不卡一区二区| 激情综合色综合久久| 国产精品日韩精品欧美在线| 91最新地址在线播放| 天天色天天操综合| 久久精品一区八戒影视| a级精品国产片在线观看| 亚洲一区二区av在线| 日韩一区二区三区高清免费看看| 国产精品一区二区不卡| 亚洲免费观看高清| 日韩一级免费一区| 成人国产精品免费观看动漫| 亚洲综合小说图片| 337p粉嫩大胆色噜噜噜噜亚洲| 成人午夜视频在线| 日产欧产美韩系列久久99| 国产夜色精品一区二区av| 一本大道av一区二区在线播放| 日韩av电影免费观看高清完整版 | 日韩精品一区二区三区蜜臀| 国产寡妇亲子伦一区二区| 亚洲综合另类小说| 久久蜜臀中文字幕| 欧美日韩情趣电影| 成人免费高清在线| 麻豆一区二区三| 一区二区视频在线| 精品福利在线导航| 欧美视频日韩视频| 成人黄色大片在线观看| 蜜桃av噜噜一区二区三区小说| 国产精品国产三级国产普通话三级| 69堂精品视频| 91在线观看地址| 国产伦精品一区二区三区免费| 亚洲自拍偷拍av| 国产精品久久久久婷婷二区次| 日韩手机在线导航| 欧美性猛交xxxxxxxx| av毛片久久久久**hd| 国产在线精品一区二区不卡了 | 91影院在线免费观看| 日本在线不卡视频| 一区二区三区精品| 国产日韩欧美综合一区| 欧美成人激情免费网| 欧美夫妻性生活| 欧美日韩在线播放| 色婷婷av一区二区三区gif| 成人精品gif动图一区| 国产一区免费电影| 激情五月播播久久久精品| 亚洲第一成年网| 亚洲自拍与偷拍| 亚洲精品久久久蜜桃| 中文字幕一区二区三区精华液| 精品99999| 久久综合99re88久久爱| 精品国产sm最大网站免费看| 日韩一区二区视频| 日韩欧美一级二级三级| 欧美一区二区三区婷婷月色| 欧美久久久久中文字幕| 3d动漫精品啪啪1区2区免费 | 国产mv日韩mv欧美| 国产黄色成人av| 岛国av在线一区| 成人动漫中文字幕| 99re66热这里只有精品3直播| 成人av手机在线观看| 99久久亚洲一区二区三区青草| 99这里只有精品| 91高清视频免费看| 欧美丰满一区二区免费视频| 欧美男男青年gay1069videost| 51午夜精品国产| 欧美大片一区二区| 国产欧美日韩在线| 亚洲精选在线视频| 亚洲二区视频在线| 七七婷婷婷婷精品国产| 韩国三级电影一区二区| 国产999精品久久久久久绿帽| 99久久久免费精品国产一区二区 | 日本乱人伦aⅴ精品| 日本韩国一区二区三区| 欧美日本不卡视频| 精品99一区二区三区| 国产精品的网站| 亚洲成人av中文| 国产麻豆精品theporn| 99国产精品久久久久久久久久| 欧美日韩国产乱码电影| 久久五月婷婷丁香社区| 亚洲欧美日韩成人高清在线一区| 亚欧色一区w666天堂| 国产黄色成人av| 欧美日韩一区二区三区在线| 精品国产免费人成在线观看| 国产精品国产三级国产aⅴ中文| 亚洲精品高清视频在线观看| 美女国产一区二区| 91亚洲精品一区二区乱码| 欧美一级国产精品| 亚洲精品午夜久久久| 蜜桃视频第一区免费观看| av成人免费在线| 欧美一区二区三区小说| 综合中文字幕亚洲| 免费看黄色91| 91官网在线免费观看| 久久久久久久久99精品| 日日夜夜免费精品| av午夜一区麻豆| 三级久久三级久久| 成人精品一区二区三区四区| 日韩亚洲欧美在线| 一区二区三区鲁丝不卡| 国产成人在线影院| 日韩欧美国产综合一区| 亚洲综合色网站| 成人久久18免费网站麻豆| 欧美一卡二卡在线观看| 亚洲国产精品麻豆| 97精品久久久久中文字幕 | 欧美日韩免费视频| 国产精品初高中害羞小美女文| 六月婷婷色综合| 4hu四虎永久在线影院成人| 亚洲免费在线看| av在线播放一区二区三区| 久久久久久久综合狠狠综合| 日韩专区中文字幕一区二区| 在线视频国产一区| 亚洲乱码中文字幕| 9久草视频在线视频精品| 久久久99精品免费观看不卡| 蜜桃一区二区三区在线观看| 欧美欧美欧美欧美首页| 亚洲图片有声小说| 欧美在线影院一区二区| 亚洲自拍偷拍网站| 在线免费观看成人短视频| 亚洲欧美偷拍卡通变态| eeuss鲁片一区二区三区在线看| 日本一区二区高清| aaa欧美色吧激情视频| 国产精品国产精品国产专区不蜜 | 青青草国产成人av片免费|