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

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

?? lemon.html

?? 嵌入式數據庫
?? HTML
?? 第 1 頁 / 共 3 頁
字號:
<html><head><title>The Lemon Parser Generator</title></head><body bgcolor=white><h1 align=center>The Lemon Parser Generator</h1><p>Lemon is an LALR(1) parser generator for C or C++.  It does the same job as ``bison'' and ``yacc''.But lemon is not another bison or yacc clone.  Ituses a different grammar syntax which is designed toreduce the number of coding errors.  Lemon also uses a moresophisticated parsing engine that is faster than yacc andbison and which is both reentrant and thread-safe.Furthermore, Lemon implements features that can be usedto eliminate resource leaks, making is suitable for usein long-running programs such as graphical user interfacesor embedded controllers.</p><p>This document is an introduction to the Lemonparser generator.</p><h2>Theory of Operation</h2><p>The main goal of Lemon is to translate a context free grammar (CFG)for a particular language into C code that implements a parser forthat language.The program has two inputs:<ul><li>The grammar specification.<li>A parser template file.</ul>Typically, only the grammar specification is supplied by the programmer.Lemon comes with a default parser template which works fine for mostapplications.  But the user is free to substitute a different parsertemplate if desired.</p><p>Depending on command-line options, Lemon will generate betweenone and three files of outputs.<ul><li>C code to implement the parser.<li>A header file defining an integer ID for each terminal symbol.<li>An information file that describes the states of the generated parser    automaton.</ul>By default, all three of these output files are generated.The header file is suppressed if the ``-m'' command-line option isused and the report file is omitted when ``-q'' is selected.</p><p>The grammar specification file uses a ``.y'' suffix, by convention.In the examples used in this document, we'll assume the name of thegrammar file is ``gram.y''.  A typical use of Lemon would be thefollowing command:<pre>   lemon gram.y</pre>This command will generate three output files named ``gram.c'',``gram.h'' and ``gram.out''.The first is C code to implement the parser.  The secondis the header file that defines numerical values for allterminal symbols, and the last is the report that explainsthe states used by the parser automaton.</p><h3>Command Line Options</h3><p>The behavior of Lemon can be modified using command-line options.You can obtain a list of the available command-line options togetherwith a brief explanation of what each does by typing<pre>   lemon -?</pre>As of this writing, the following command-line options are supported:<ul><li><tt>-b</tt><li><tt>-c</tt><li><tt>-g</tt><li><tt>-m</tt><li><tt>-q</tt><li><tt>-s</tt><li><tt>-x</tt></ul>The ``-b'' option reduces the amount of text in the report file byprinting only the basis of each parser state, rather than the fullconfiguration.The ``-c'' option suppresses action table compression.  Using -cwill make the parser a little larger and slower but it will detectsyntax errors sooner.The ``-g'' option causes no output files to be generated at all.Instead, the input grammar file is printed on standard output butwith all comments, actions and other extraneous text deleted.  Thisis a useful way to get a quick summary of a grammar.The ``-m'' option causes the output C source file to be compatiblewith the ``makeheaders'' program.Makeheaders is a program that automatically generates header filesfrom C source code.  When the ``-m'' option is used, the headerfile is not output since the makeheaders program will take careof generated all header files automatically.The ``-q'' option suppresses the report file.Using ``-s'' causes a brief summary of parser statistics to beprinted.  Like this:<pre>   Parser statistics: 74 terminals, 70 nonterminals, 179 rules                      340 states, 2026 parser table entries, 0 conflicts</pre>Finally, the ``-x'' option causes Lemon to print its version numberand then stops without attempting to read the grammar or generate a parser.</p><h3>The Parser Interface</h3><p>Lemon doesn't generate a complete, working program.  It only generatesa few subroutines that implement a parser.  This section describesthe interface to those subroutines.  It is up to the programmer tocall these subroutines in an appropriate way in order to produce acomplete system.</p><p>Before a program begins using a Lemon-generated parser, the programmust first create the parser.A new parser is created as follows:<pre>   void *pParser = ParseAlloc( malloc );</pre>The ParseAlloc() routine allocates and initializes a new parser andreturns a pointer to it.The actual data structure used to represent a parser is opaque --its internal structure is not visible or usable by the calling routine.For this reason, the ParseAlloc() routine returns a pointer to voidrather than a pointer to some particular structure.The sole argument to the ParseAlloc() routine is a pointer to thesubroutine used to allocate memory.  Typically this means ``malloc()''.</p><p>After a program is finished using a parser, it can reclaim allmemory allocated by that parser by calling<pre>   ParseFree(pParser, free);</pre>The first argument is the same pointer returned by ParseAlloc().  Thesecond argument is a pointer to the function used to release bulkmemory back to the system.</p><p>After a parser has been allocated using ParseAlloc(), the programmermust supply the parser with a sequence of tokens (terminal symbols) tobe parsed.  This is accomplished by calling the following functiononce for each token:<pre>   Parse(pParser, hTokenID, sTokenData, pArg);</pre>The first argument to the Parse() routine is the pointer returned byParseAlloc().The second argument is a small positive integer that tells the parse thetype of the next token in the data stream.There is one token type for each terminal symbol in the grammar.The gram.h file generated by Lemon contains #define statements thatmap symbolic terminal symbol names into appropriate integer values.(A value of 0 for the second argument is a special flag to theparser to indicate that the end of input has been reached.)The third argument is the value of the given token.  By default,the type of the third argument is integer, but the grammar willusually redefine this type to be some kind of structure.Typically the second argument will be a broad category of tokenssuch as ``identifier'' or ``number'' and the third argument willbe the name of the identifier or the value of the number.</p><p>The Parse() function may have either three or four arguments,depending on the grammar.  If the grammar specification file requestit, the Parse() function will have a fourth parameter that can beof any type chosen by the programmer.  The parser doesn't do anythingwith this argument except to pass it through to action routines.This is a convenient mechanism for passing state information downto the action routines without having to use global variables.</p><p>A typical use of a Lemon parser might look something like thefollowing:<pre>   01 ParseTree *ParseFile(const char *zFilename){   02    Tokenizer *pTokenizer;   03    void *pParser;   04    Token sToken;   05    int hTokenId;   06    ParserState sState;   07   08    pTokenizer = TokenizerCreate(zFilename);   09    pParser = ParseAlloc( malloc );   10    InitParserState(&sState);   11    while( GetNextToken(pTokenizer, &hTokenId, &sToken) ){   12       Parse(pParser, hTokenId, sToken, &sState);   13    }   14    Parse(pParser, 0, sToken, &sState);   15    ParseFree(pParser, free );   16    TokenizerFree(pTokenizer);   17    return sState.treeRoot;   18 }</pre>This example shows a user-written routine that parses a file oftext and returns a pointer to the parse tree.(We've omitted all error-handling from this example to keep itsimple.)We assume the existence of some kind of tokenizer which is createdusing TokenizerCreate() on line 8 and deleted by TokenizerFree()on line 16.  The GetNextToken() function on line 11 retrieves thenext token from the input file and puts its type in the integer variable hTokenId.  The sToken variable is assumed to besome kind of structure that contains details about each token,such as its complete text, what line it occurs on, etc. </p><p>This example also assumes the existence of structure of typeParserState that holds state information about a particular parse.An instance of such a structure is created on line 6 and initializedon line 10.  A pointer to this structure is passed into the Parse()routine as the optional 4th argument.The action routine specified by the grammar for the parser can usethe ParserState structure to hold whatever information is useful andappropriate.  In the example, we note that the treeRoot field ofthe ParserState structure is left pointing to the root of the parsetree.</p><p>The core of this example as it relates to Lemon is as follows:<pre>   ParseFile(){      pParser = ParseAlloc( malloc );      while( GetNextToken(pTokenizer,&hTokenId, &sToken) ){         Parse(pParser, hTokenId, sToken);      }      Parse(pParser, 0, sToken);      ParseFree(pParser, free );   }</pre>Basically, what a program has to do to use a Lemon-generated parseris first create the parser, then send it lots of tokens obtained bytokenizing an input source.  When the end of input is reached, theParse() routine should be called one last time with a token typeof 0.  This step is necessary to inform the parser that the end ofinput has been reached.  Finally, we reclaim memory used by theparser by calling ParseFree().</p><p>There is one other interface routine that should be mentionedbefore we move on.The ParseTrace() function can be used to generate debugging outputfrom the parser.  A prototype for this routine is as follows:<pre>   ParseTrace(FILE *stream, char *zPrefix);</pre>After this routine is called, a short (one-line) message is writtento the designated output stream every time the parser changes statesor calls an action routine.  Each such message is prefaced usingthe text given by zPrefix.  This debugging output can be turned offby calling ParseTrace() again with a first argument of NULL (0).</p><h3>Differences With YACC and BISON</h3><p>Programmers who have previously used the yacc or bison parsergenerator will notice several important differences between yacc and/orbison and Lemon.<ul><li>In yacc and bison, the parser calls the tokenizer.  In Lemon,    the tokenizer calls the parser.<li>Lemon uses no global variables.  Yacc and bison use global variables    to pass information between the tokenizer and parser.<li>Lemon allows multiple parsers to be running simultaneously.  Yacc    and bison do not.</ul>These differences may cause some initial confusion for programmerswith prior yacc and bison experience.But after years of experience using Lemon, I firmlybelieve that the Lemon way of doing things is better.</p><h2>Input File Syntax</h2><p>The main purpose of the grammar specification file for Lemon isto define the grammar for the parser.  But the input file alsospecifies additional information Lemon requires to do its job.Most of the work in using Lemon is in writing an appropriategrammar file.</p><p>The grammar file for lemon is, for the most part, free format.It does not have sections or divisions like yacc or bison.  Anydeclaration can occur at any point in the file.Lemon ignores whitespace (except where it is needed to separatetokens) and it honors the same commenting conventions as C and C++.</p><h3>Terminals and Nonterminals</h3><p>A terminal symbol (token) is any string of alphanumericand underscore charactersthat begins with an upper case letter.A terminal can contain lower class letters after the first character,but the usual convention is to make terminals all upper case.A nonterminal, on the other hand, is any string of alphanumericand underscore characters than begins with a lower case letter.Again, the usual convention is to make nonterminals use all lowercase letters.</p><p>In Lemon, terminal and nonterminal symbols do not need to be declared or identified in a separate section of the grammar file.Lemon is able to generate a list of all terminals and nonterminalsby examining the grammar rules, and it can always distinguish aterminal from a nonterminal by checking the case of the firstcharacter of the name.</p>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲黄色免费电影| 成人午夜视频在线| 国产成人在线视频免费播放| 一本大道久久精品懂色aⅴ| 日韩一区二区电影| 樱花草国产18久久久久| 国产在线播精品第三| 欧美日韩久久不卡| 亚洲欧洲日韩av| 极品美女销魂一区二区三区| 欧美日韩综合在线免费观看| 国产精品国产三级国产aⅴ中文 | 成人在线综合网| 日韩一区二区三区三四区视频在线观看 | 亚洲综合激情另类小说区| 国产乱码精品一区二区三区av| 欧美老肥妇做.爰bbww| 亚洲欧美日本在线| eeuss鲁片一区二区三区在线看| 精品欧美乱码久久久久久1区2区 | 欧美视频在线观看一区| 国产精品欧美一区二区三区| 国产一区999| 精品国产一区二区三区忘忧草| 三级亚洲高清视频| 欧美亚男人的天堂| 亚洲精品第一国产综合野| 成人h精品动漫一区二区三区| 久久久.com| 国产成人8x视频一区二区| 久久精品综合网| 国产成人av电影免费在线观看| 久久免费视频色| 国产黑丝在线一区二区三区| 国产欧美一区二区精品秋霞影院| 韩国女主播一区| 久久久99免费| 成人午夜短视频| 自拍偷自拍亚洲精品播放| 色先锋资源久久综合| 一区二区三区免费看视频| 在线视频综合导航| 亚洲成人av免费| 欧美一级高清片| 国产又粗又猛又爽又黄91精品| 久久精品人人爽人人爽| 成人在线视频一区二区| 亚洲日穴在线视频| 欧美私人免费视频| 久久精品国产澳门| 国产日韩精品视频一区| 91在线观看美女| 亚洲五码中文字幕| 精品嫩草影院久久| av网站免费线看精品| 亚洲狠狠爱一区二区三区| 日韩亚洲国产中文字幕欧美| 国产精品一区专区| 亚洲精品一二三四区| 欧美日韩精品一区二区天天拍小说 | 欧美亚洲国产怡红院影院| 欧美aaa在线| 国产精品理论片在线观看| 欧美日韩视频一区二区| 国产成人精品一区二区三区网站观看| 国产精品进线69影院| 欧美精品电影在线播放| 国产成人三级在线观看| 亚洲成人动漫一区| 国产亚洲成av人在线观看导航| 色诱视频网站一区| 九色porny丨国产精品| 亚洲美女屁股眼交| 欧美mv和日韩mv国产网站| 色婷婷综合久久久中文字幕| 久久国产三级精品| 亚洲精品视频在线观看免费| 久久久影视传媒| 精品视频一区二区不卡| 成人免费不卡视频| 日本三级亚洲精品| 亚洲三级视频在线观看| 国产网站一区二区三区| 欧美军同video69gay| 99久久精品国产一区二区三区| 美腿丝袜亚洲三区| 亚洲成人av免费| 亚洲男人天堂av| 国产精品麻豆99久久久久久| 欧美电影精品一区二区| 欧美日韩国产首页| 色综合久久精品| 国产91综合一区在线观看| 另类中文字幕网| 亚洲成人你懂的| 亚洲精品大片www| 亚洲丝袜精品丝袜在线| 日本一区二区免费在线观看视频 | 欧美国产成人精品| 精品裸体舞一区二区三区| 在线不卡免费av| 欧美色区777第一页| 一本大道久久a久久综合婷婷 | 欧美国产精品久久| 国产调教视频一区| 久久久蜜臀国产一区二区| 日韩三级视频在线看| 欧美日韩国产天堂| 欧美日韩一区二区三区不卡| 在线影院国内精品| 91国产免费看| 欧美日韩你懂的| 欧美区视频在线观看| 欧美日韩国产一级二级| 欧美日韩精品一区二区三区| 精品视频免费看| 91精品婷婷国产综合久久竹菊| 欧美三级电影网| 777午夜精品视频在线播放| 欧美日韩在线播放三区| 欧美日韩亚洲综合一区二区三区| 欧美午夜精品久久久久久孕妇 | 日韩精品一区在线观看| 欧美大片在线观看| 久久人人爽人人爽| 国产网红主播福利一区二区| 欧美激情艳妇裸体舞| 国产精品成人一区二区三区夜夜夜| 国产精品无圣光一区二区| 中文字幕精品在线不卡| 亚洲你懂的在线视频| 亚洲自拍另类综合| 亚洲成a人片在线观看中文| 日韩成人精品在线观看| 青青青伊人色综合久久| 国内精品免费在线观看| 国产91色综合久久免费分享| 91视频免费播放| 欧美精品九九99久久| 精品999久久久| 最新日韩av在线| 亚洲va韩国va欧美va精品| 精品一区二区三区不卡| 成人av午夜电影| 欧美日韩国产高清一区二区| 亚洲精品一区二区三区精华液 | 国产91色综合久久免费分享| 99国产精品久久久久久久久久久| 欧美性色黄大片| 久久综合色天天久久综合图片| 中文字幕一区二区三区在线观看 | 激情五月激情综合网| 成人一区二区三区中文字幕| 欧美少妇性性性| 国产日韩欧美在线一区| 亚洲图片欧美综合| 国产福利一区在线| 欧美日韩精品一区二区三区 | 亚洲精品欧美在线| 美国av一区二区| 91国偷自产一区二区使用方法| 日韩女优av电影| 亚洲激情男女视频| 国产精品一区三区| 69堂成人精品免费视频| 国产日产精品1区| 日韩电影在线一区| 色美美综合视频| 欧美国产综合色视频| 日本在线观看不卡视频| 91丨九色丨国产丨porny| 欧美精品一区二区三区在线播放| 亚洲国产精品综合小说图片区| 国产激情视频一区二区在线观看| 欧美人xxxx| 一区二区三区免费在线观看| 成人午夜激情片| 精品精品国产高清a毛片牛牛| 亚洲香蕉伊在人在线观| 99热精品国产| 日本一区二区三级电影在线观看 | 国产成人综合网站| 精品捆绑美女sm三区| 日精品一区二区| 91久久精品国产91性色tv | 一区二区三区在线观看国产| 国产成人亚洲精品狼色在线| 日韩欧美成人激情| 日本成人在线网站| 欧美日韩国产小视频在线观看| 亚洲精品国产品国语在线app| 国产精品综合一区二区三区| 精品日韩一区二区| 久久精品999| 精品国产露脸精彩对白| 精品一区二区三区在线播放 | 欧美视频一区二区三区在线观看| 亚洲欧美视频在线观看视频| 99久久er热在这里只有精品15| 国产精品三级视频|