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

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

?? lemon.html

?? 嵌入式數(shù)據(jù)庫
?? HTML
?? 第 1 頁 / 共 3 頁
字號:
destructors work.  The example shows a non-terminal named``nt'' that holds values of type ``void*''.  When the rule foran ``nt'' reduces, it sets the value of the non-terminal tospace obtained from malloc().  Later, when the nt non-terminalis popped from the stack, the destructor will fire and callfree() on this malloced space, thus avoiding a memory leak.(Note that the symbol ``$$'' in the destructor code is replacedby the value of the non-terminal.)</p><p>It is important to note that the value of a non-terminal is passedto the destructor whenever the non-terminal is removed from thestack, unless the non-terminal is used in a C-code action.  Ifthe non-terminal is used by C-code, then it is assumed that theC-code will take care of destroying it if it should reallybe destroyed.  More commonly, the value is used to build somelarger structure and we don't want to destroy it, which is whythe destructor is not called in this circumstance.</p><p>By appropriate use of destructors, it is possible tobuild a parser using Lemon that can be used within a long-runningprogram, such as a GUI, that will not leak memory or other resources.To do the same using yacc or bison is much more difficult.</p><h4>The <tt>%extra_argument</tt> directive</h4>The %extra_argument directive instructs Lemon to add a 4th parameterto the parameter list of the Parse() function it generates.  Lemondoesn't do anything itself with this extra argument, but it doesmake the argument available to C-code action routines, destructors,and so forth.  For example, if the grammar file contains:</p><p><pre>    %extra_argument { MyStruct *pAbc }</pre></p><p>Then the Parse() function generated will have an 4th parameterof type ``MyStruct*'' and all action routines will have access toa variable named ``pAbc'' that is the value of the 4th parameterin the most recent call to Parse().</p><h4>The <tt>%include</tt> directive</h4><p>The %include directive specifies C code that is included at thetop of the generated parser.  You can include any text you want --the Lemon parser generator copies it blindly.  If you have multiple%include directives in your grammar file the value of the last%include directive overwrites all the others.</p.<p>The %include directive is very handy for getting some extra #includepreprocessor statements at the beginning of the generated parser.For example:</p><p><pre>   %include {#include &lt;unistd.h&gt;}</pre></p><p>This might be needed, for example, if some of the C actions in thegrammar call functions that are prototyed in unistd.h.</p><h4>The <tt>%left</tt> directive</h4>The %left directive is used (along with the %right and%nonassoc directives) to declare precedences of terminalsymbols.  Every terminal symbol whose name appears aftera %left directive but before the next period (``.'') isgiven the same left-associative precedence value.  Subsequent%left directives have higher precedence.  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>Note the period that terminates each %left, %right or %nonassocdirective.</p><p>LALR(1) grammars can get into a situation where they requirea large amount of stack space if you make heavy use or right-associativeoperators.  For this reason, it is recommended that you use %leftrather than %right whenever possible.</p><h4>The <tt>%name</tt> directive</h4><p>By default, the functions generated by Lemon all begin with thefive-character string ``Parse''.  You can change this string to somethingdifferent using the %name directive.  For instance:</p><p><pre>   %name Abcde</pre></p><p>Putting this directive in the grammar file will cause Lemon to generatefunctions named<ul><li> AbcdeAlloc(),<li> AbcdeFree(),<li> AbcdeTrace(), and<li> Abcde().</ul>The %name directive allows you to generator two or more differentparsers and link them all into the same executable.</p><h4>The <tt>%nonassoc</tt> directive</h4><p>This directive is used to assign non-associative precedence toone or more terminal symbols.  See the section on precedence rulesor on the %left directive for additional information.</p><h4>The <tt>%parse_accept</tt> directive</h4><p>The %parse_accept directive specifies a block of C code that isexecuted whenever the parser accepts its input string.  To ``accept''an input string means that the parser was able to process all tokenswithout error.</p><p>For example:</p><p><pre>   %parse_accept {      printf("parsing complete!\n");   }</pre></p><h4>The <tt>%parse_failure</tt> directive</h4><p>The %parse_failure directive specifies a block of C code thatis executed whenever the parser fails complete.  This code is notexecuted until the parser has tried and failed to resolve an inputerror using is usual error recovery strategy.  The routine isonly invoked when parsing is unable to continue.</p><p><pre>   %parse_failure {     fprintf(stderr,"Giving up.  Parser is hopelessly lost...\n");   }</pre></p><h4>The <tt>%right</tt> directive</h4><p>This directive is used to assign right-associative precedence toone or more terminal symbols.  See the section on precedence rulesor on the %left directive for additional information.</p><h4>The <tt>%stack_overflow</tt> directive</h4><p>The %stack_overflow directive specifies a block of C code thatis executed if the parser's internal stack ever overflows.  Typicallythis just prints an error message.  After a stack overflow, the parserwill be unable to continue and must be reset.</p><p><pre>   %stack_overflow {     fprintf(stderr,"Giving up.  Parser stack overflow\n");   }</pre></p><p>You can help prevent parser stack overflows by avoiding the useof right recursion and right-precedence operators in your grammar.Use left recursion and and left-precedence operators instead, toencourage rules to reduce sooner and keep the stack size down.For example, do rules like this:<pre>   list ::= list element.      // left-recursion.  Good!   list ::= .</pre>Not like this:<pre>   list ::= element list.      // right-recursion.  Bad!   list ::= .</pre><h4>The <tt>%stack_size</tt> directive</h4><p>If stack overflow is a problem and you can't resolve the troubleby using left-recursion, then you might want to increase the sizeof the parser's stack using this directive.  Put an positive integerafter the %stack_size directive and Lemon will generate a parsewith a stack of the requested size.  The default value is 100.</p><p><pre>   %stack_size 2000</pre></p><h4>The <tt>%start_symbol</tt> directive</h4><p>By default, the start-symbol for the grammar that Lemon generatesis the first non-terminal that appears in the grammar file.  But youcan choose a different start-symbol using the %start_symbol directive.</p><p><pre>   %start_symbol  prog</pre></p><h4>The <tt>%token_destructor</tt> directive</h4><p>The %destructor directive assigns a destructor to a non-terminalsymbol.  (See the description of the %destructor directive above.)This directive does the same thing for all terminal symbols.</p><p>Unlike non-terminal symbols which may each have a different data typefor their values, terminals all use the same data type (defined bythe %token_type directive) and so they use a common destructor.  Otherthan that, the token destructor works just like the non-terminaldestructors.</p><h4>The <tt>%token_prefix</tt> directive</h4><p>Lemon generates #defines that assign small integer constantsto each terminal symbol in the grammar.  If desired, Lemon willadd a prefix specified by this directiveto each of the #defines it generates.So if the default output of Lemon looked like this:<pre>    #define AND              1    #define MINUS            2    #define OR               3    #define PLUS             4</pre>You can insert a statement into the grammar like this:<pre>    %token_prefix    TOKEN_</pre>to cause Lemon to produce these symbols instead:<pre>    #define TOKEN_AND        1    #define TOKEN_MINUS      2    #define TOKEN_OR         3    #define TOKEN_PLUS       4</pre><h4>The <tt>%token_type</tt> and <tt>%type</tt> directives</h4><p>These directives are used to specify the data types for valueson the parser's stack associated with terminal and non-terminalsymbols.  The values of all terminal symbols must be of the sametype.  This turns out to be the same data type as the 3rd parameterto the Parse() function generated by Lemon.  Typically, you willmake the value of a terminal symbol by a pointer to some kind oftoken structure.  Like this:</p><p><pre>   %token_type    {Token*}</pre></p><p>If the data type of terminals is not specified, the default valueis ``int''.</p><p>Non-terminal symbols can each have their own data types.  Typicallythe data type  of a non-terminal is a pointer to the root of a parse-treestructure that contains all information about that non-terminal.For example:</p><p><pre>   %type   expr  {Expr*}</pre></p><p>Each entry on the parser's stack is actually a union containinginstances of all data types for every non-terminal and terminal symbol.Lemon will automatically use the correct element of this union dependingon what the corresponding non-terminal or terminal symbol is.  Butthe grammar designer should keep in mind that the size of the unionwill be the size of its largest element.  So if you have a singlenon-terminal whose data type requires 1K of storage, then your 100entry parser stack will require 100K of heap space.  If you are willingand able to pay that price, fine.  You just need to know.</p><h3>Error Processing</h3><p>After extensive experimentation over several years, it has beendiscovered that the error recovery strategy used by yacc is aboutas good as it gets.  And so that is what Lemon uses.</p><p>When a Lemon-generated parser encounters a syntax error, itfirst invokes the code specified by the %syntax_error directive, ifany.  It then enters its error recovery strategy.  The error recoverystrategy is to begin popping the parsers stack until it enters astate where it is permitted to shift a special non-terminal symbolnamed ``error''.  It then shifts this non-terminal and continuesparsing.  But the %syntax_error routine will not be called againuntil at least three new tokens have been successfully shifted.</p><p>If the parser pops its stack until the stack is empty, and it stillis unable to shift the error symbol, then the %parse_failed routineis invoked and the parser resets itself to its start state, readyto begin parsing a new file.  This is what will happen at the veryfirst syntax error, of course, if there are no instances of the ``error'' non-terminal in your grammar.</p></body></html>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线观看视频一区二区| 久久综合九色综合97_久久久| 日韩欧美在线综合网| 久久久精品国产免大香伊| 一区二区三区电影在线播| 国产一区二区三区久久久| 欧美日韩美少妇| 国产精品的网站| 国产美女精品在线| 6080国产精品一区二区| 亚洲最大的成人av| 丰满少妇在线播放bd日韩电影| 日韩一区和二区| 亚洲制服丝袜av| 91麻豆免费看| 国产精品久久午夜| 国产成人精品亚洲777人妖 | 26uuu国产日韩综合| 亚洲国产aⅴ天堂久久| 99久久久久免费精品国产| 国产喷白浆一区二区三区| 蜜臀av亚洲一区中文字幕| 在线综合视频播放| 丝袜美腿高跟呻吟高潮一区| 欧美视频一区二区三区| 一区二区理论电影在线观看| 99久久免费视频.com| 国产精品福利一区| 成人不卡免费av| 亚洲欧洲色图综合| 成人av电影在线播放| 国产精品久久久久aaaa樱花| 成人丝袜18视频在线观看| 国产精品久久久一区麻豆最新章节| 国产成人午夜99999| 国产日韩精品一区二区三区 | 日本丶国产丶欧美色综合| 国产精品久久久久久久久果冻传媒| 懂色av一区二区夜夜嗨| 国产精品美女久久福利网站| 95精品视频在线| 一区二区三区四区中文字幕| 欧美日韩极品在线观看一区| 日本视频一区二区三区| www欧美成人18+| 成人三级在线视频| 亚洲老司机在线| 欧美精品tushy高清| 久久综合综合久久综合| 国产日韩精品一区| 一本久久a久久免费精品不卡| 亚洲国产精品嫩草影院| 日韩欧美视频一区| 国产99久久久国产精品潘金 | 午夜伦欧美伦电影理论片| 91.com在线观看| 激情五月激情综合网| 国产精品欧美久久久久无广告 | 欧美人妖巨大在线| 久久99国产精品久久99果冻传媒| 久久婷婷一区二区三区| 972aa.com艺术欧美| 日本麻豆一区二区三区视频| 久久精品视频免费| 色久优优欧美色久优优| 久久99精品久久久久久久久久久久| 久久久不卡影院| 欧美性生交片4| 国产精一区二区三区| 亚洲最大色网站| 久久九九影视网| 欧美日韩一区不卡| 国产传媒欧美日韩成人| 五月综合激情网| 国产精品麻豆久久久| 91精品免费观看| av一二三不卡影片| 久久99九九99精品| 亚洲最大色网站| 中文字幕日本不卡| 精品免费日韩av| 欧美在线观看视频在线| 国产精品亚洲视频| 日韩av一二三| 一区二区成人在线| 国产欧美一区二区三区网站| 日韩一区二区在线播放| 一本久道中文字幕精品亚洲嫩| 国产一区二区三区| 欧美aaaaaa午夜精品| 亚洲男帅同性gay1069| 国产女人水真多18毛片18精品视频| 这里只有精品99re| 欧美视频在线一区| 色综合久久久久久久久| 成人激情免费视频| 国产一区欧美一区| 蜜桃在线一区二区三区| 亚洲福利电影网| 一区二区三区中文字幕电影 | 久久人人97超碰com| 欧美理论片在线| 在线看日韩精品电影| 99精品久久只有精品| 成人美女视频在线观看| 国产精品一区在线| 久久66热re国产| 免费观看30秒视频久久| 日韩电影在线免费看| 日韩专区一卡二卡| 亚洲1区2区3区视频| 亚洲午夜精品17c| 亚洲午夜私人影院| 婷婷丁香激情综合| 日本亚洲免费观看| 国产精品1区二区.| 国产成人精品免费看| 丁香激情综合国产| 成人app网站| 色狠狠色噜噜噜综合网| 在线观看国产一区二区| 欧美三级在线视频| 欧美一三区三区四区免费在线看| 91精品国产色综合久久不卡蜜臀| 欧美高清hd18日本| 337p日本欧洲亚洲大胆精品 | 国产一区视频导航| 国产v日产∨综合v精品视频| 成人av综合在线| 色一区在线观看| 欧美日韩一区二区三区在线| 制服.丝袜.亚洲.另类.中文| 精品国产乱码久久久久久免费| 久久久久久免费网| 国产精品久久久久国产精品日日| 亚洲美女在线国产| 日韩精品一级中文字幕精品视频免费观看 | 亚洲在线视频免费观看| 亚洲大片一区二区三区| 麻豆成人91精品二区三区| 懂色一区二区三区免费观看| 色婷婷精品大视频在线蜜桃视频| 欧美日韩情趣电影| 久久网站最新地址| 一区二区三区欧美久久| 美腿丝袜亚洲三区| 97超碰欧美中文字幕| 91麻豆精品国产91久久久更新时间| 亚洲精品在线电影| 亚洲精品一二三四区| 奇米影视一区二区三区小说| 国产.欧美.日韩| 精品视频一区二区不卡| 久久嫩草精品久久久精品| 亚洲一区二区三区三| 国产精品99久久久久| 精品视频在线视频| 中文av字幕一区| 全部av―极品视觉盛宴亚洲| www.在线欧美| 3751色影院一区二区三区| 中文字幕在线不卡视频| 毛片av一区二区三区| 在线亚洲一区观看| 久久久国产一区二区三区四区小说| 亚洲午夜激情av| 成人av网址在线| 久久亚洲精精品中文字幕早川悠里| 亚洲卡通动漫在线| 国产成人精品一区二区三区网站观看| 欧美日韩午夜在线视频| 自拍偷拍国产亚洲| 国产精品资源在线观看| 欧美剧情片在线观看| 亚洲人成伊人成综合网小说| 国产精品亚洲专一区二区三区 | 国产欧美日韩综合精品一区二区| 亚洲一区免费在线观看| 成人久久久精品乱码一区二区三区| 91精品国产高清一区二区三区蜜臀| 亚洲美女精品一区| 成人性生交大片免费看中文| 精品少妇一区二区| 石原莉奈在线亚洲二区| 欧美色国产精品| 亚洲靠逼com| 色婷婷久久久亚洲一区二区三区| 国产亚洲欧美日韩俺去了| 极品少妇一区二区三区精品视频| 制服丝袜av成人在线看| 五月天婷婷综合| 欧美日韩1区2区| 亚洲动漫第一页| 欧洲激情一区二区| 亚洲一区在线看| 欧美性高清videossexo| 亚洲午夜精品一区二区三区他趣| 欧美影院午夜播放| 亚洲一区二区3| 欧美日韩一区二区在线观看视频|