锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久偷看各类wc女厕嘘嘘,国产Av激情久久无码天堂,久久久久国产精品嫩草影院http://www.shnenglu.com/SysProgrammer/archive/2009/12/24/104001.htmlRenoRenoThu, 24 Dec 2009 15:51:00 GMThttp://www.shnenglu.com/SysProgrammer/archive/2009/12/24/104001.htmlhttp://www.shnenglu.com/SysProgrammer/comments/104001.htmlhttp://www.shnenglu.com/SysProgrammer/archive/2009/12/24/104001.html#Feedback0http://www.shnenglu.com/SysProgrammer/comments/commentRss/104001.htmlhttp://www.shnenglu.com/SysProgrammer/services/trackbacks/104001.html
// Unnamed simple script language products define as the flowing:
program ::= declaration_list
declaration_list ::= var_declaration | fun_declaration
var_declaration ::= DECLARE type_specifier_list ID; END
type_specifier_list ::= type_specifier type_specifier_list | EMPTY
type_specifier ::= VAR
fun_declaration ::= BEGIN statement_list END
statement_list ::= statement statement_list | EMPTY
statement ::= expression_stmt | compund_list | selection_stmt | iteration_stmt
expression_stmt ::= expression; | ;
compund_list ::= { statement_list }
selection_stmt :: IF ( expression ) statement | IF ( expression ) statement ELSE statement
ireation_stmt ::= WHILE ( expression ) statement
expression ::= var = expression | simple_expression
var ::= ID
simple_expression ::= additive_expression relop additive_expression | additive_expression
relop ::= <= | < | > | >= | == | !=
additive_expression ::= additive_expression addop term | term
addop ::= + | -
term ::= term mulop factor | factor
mulop ::= * | /
factor ::= ( expression ) | var | NUM

Reno 2009-12-24 23:51 鍙戣〃璇勮
]]>
PathInterpreter.hhttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/103847.htmlRenoRenoWed, 23 Dec 2009 14:03:00 GMThttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/103847.htmlhttp://www.shnenglu.com/SysProgrammer/comments/103847.htmlhttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/103847.html#Feedback0http://www.shnenglu.com/SysProgrammer/comments/commentRss/103847.htmlhttp://www.shnenglu.com/SysProgrammer/services/trackbacks/103847.html 

  1 #ifndef PATH_INTERPRETER
  2 #define PATH_INTERPRETER
  3 
  4 #define WIN32_LEAN_AND_MEAN
  5 #include <windows.h>
  6 #include <string.h>
  7 #include <stdlib.h>
  8 #include <ctype.h>
  9 #include <string>
 10 #include <list>
 11 
 12 using std::string;
 13 using std::list;
 14 
 15 #define MAX_WORD_LEN 8 // 8 Bytes
 16 
 17 class ContexScan;
 18 
 19 // CPathScriptLoader
 20 class CPathScriptLoader
 21 {
 22 public:
 23  string Context;
 24 
 25  void LoadScript( const char *szFile );
 26 };
 27 
 28 //
 29 // Contex Lex
 30 //
 31 //
 32 // ContexScan
 33 class ContexScan
 34 {
 35 public:
 36  enum ScanState { WORD, NOPRINT, };
 37 
 38 public:
 39  ContexScan();
 40  ~ContexScan();
 41 
 42  void SetExpression( const char *szExpr );
 43 
 44  bool SkipWord( const char *szWord );
 45  char *  GetNextWord();
 46  char *  CurrentWord() { return m_szCurrWord; }
 47  bool NextWord();
 48  void RebackWordByCount( int n ); // 閫鍑犱釜?
 49  void RebackNearestWordByName( const char *szWord ); // 閫鍒板摢涓?
 50 
 51 private:
 52  char * m_szExpr;
 53  char * m_pLastChar;
 54  char * m_pCurrChar;
 55  char m_szCurrWord[MAX_WORD_LEN];
 56  ScanState m_eState;
 57 };
 58 
 59 //
 60 // Syntax Tree Nodes
 61 //
 62 // AbstractNode
 63 class AbstractNode
 64 {
 65 public:
 66    AbstractNode( ContexScan& contex );
 67  virtual ~AbstractNode();
 68 
 69  virtual void Parse() = 0;
 70 
 71 protected:
 72  ContexScan& m_RefContexScan;
 73  list<AbstractNode *> m_Nodes;
 74 };
 75 
 76 // ProgramNode
 77 class ProgramNode : public AbstractNode
 78 {
 79 public:
 80    ProgramNode( ContexScan& contex );
 81  virtual ~ProgramNode();
 82 
 83  virtual void Parse();
 84 };
 85 
 86 // CommandListNode
 87 class CommandListNode : public AbstractNode
 88 {
 89 public:
 90    CommandListNode( ContexScan& contex );
 91  virtual ~CommandListNode();
 92 
 93  virtual void Parse();
 94 };
 95 
 96 // CommandNode
 97 class CommandNode : public AbstractNode
 98 {
 99 public:
100    CommandNode( ContexScan& contex );
101  virtual ~CommandNode();
102 
103  virtual void Parse();
104 };
105 
106 // RepeatNode
107 class RepeatNode : public AbstractNode
108 {
109 public:
110    RepeatNode( ContexScan& contex );
111  virtual ~RepeatNode();
112 
113  virtual void Parse();
114 };
115 
116 // BlockNode
117 class BlockNode : public AbstractNode
118 {
119 public:
120    BlockNode( ContexScan& contex );
121  virtual ~BlockNode();
122 
123  virtual void Parse();
124 };
125 
126 // PrimitiveNode
127 class PrimitiveNode : public AbstractNode
128 {
129 public:
130    PrimitiveNode( ContexScan& contex );
131  virtual ~PrimitiveNode();
132 
133  virtual void Parse();
134 };
135 
136 // CPathInterpret
137 // The Interpreter Facade interface
138 class CPathInterpret
139 {
140 public:
141  enum InterpretMode { NDEBUG, DEBUG, };
142 
143 public:
144  static InterpretMode m_Mode;
145 
146 public:
147  void LoadScript( const char *szFile );
148  void Interpret( InterpretMode mode = NDEBUG );
149 
150 private:
151  CPathScriptLoader m_ScriptLoader;
152  ContexScan   m_ContexScaner;
153 
154 };
155 
156 #endif // PATH_INTERPRETER
157 


Reno 2009-12-23 22:03 鍙戣〃璇勮
]]>
ConsoleMain.cpphttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/103848.htmlRenoRenoWed, 23 Dec 2009 14:03:00 GMThttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/103848.htmlhttp://www.shnenglu.com/SysProgrammer/comments/103848.htmlhttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/103848.html#Feedback0http://www.shnenglu.com/SysProgrammer/comments/commentRss/103848.htmlhttp://www.shnenglu.com/SysProgrammer/services/trackbacks/103848.html 

 1 #include <stdio.h>
 2 #include <string.h>
 3 #include "PathInterpreter.h"
 4 
 5 int main( int argc, char *argv[] )
 6 {
 7  if ( argc < 2 )
 8  {
 9   printf( "Usage: ExecuableFileName ScriptFileName [-DEBUG|-debug] \n" );
10   return 0;
11  }
12 
13  if ( argc > 3 )
14  {
15   printf( "Warning: More parameters have expected, after the third has ignored!\n" );
16   return 0;
17  }
18 
19  CPathInterpret Instance;
20  Instance.LoadScript( argv[1] );
21  if ( argc == 3 )
22  {
23   if ( strcmp( argv[2], "-DEBUG" ) == 0 || strcmp( argv[2], "-debug" ) == 0 )
24    Instance.Interpret( CPathInterpret::DEBUG );
25   else
26    printf( "Warning: Unknown about the third parameter!\n" );
27  }
28  else
29   Instance.Interpret();
30 
31  return 0;
32 }
33 
34 

 



Reno 2009-12-23 22:03 鍙戣〃璇勮
]]>
PathInterpreter.cpphttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/103842.htmlRenoRenoWed, 23 Dec 2009 13:57:00 GMThttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/103842.htmlhttp://www.shnenglu.com/SysProgrammer/comments/103842.htmlhttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/103842.html#Feedback0http://www.shnenglu.com/SysProgrammer/comments/commentRss/103842.htmlhttp://www.shnenglu.com/SysProgrammer/services/trackbacks/103842.html闃呰鍏ㄦ枃

Reno 2009-12-23 21:57 鍙戣〃璇勮
]]>
榪愬姩璺嚎鎺у埗鑴氭湰璇█http://www.shnenglu.com/SysProgrammer/archive/2009/12/23/Reno.htmlRenoRenoWed, 23 Dec 2009 08:58:00 GMThttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/Reno.htmlhttp://www.shnenglu.com/SysProgrammer/comments/103817.htmlhttp://www.shnenglu.com/SysProgrammer/archive/2009/12/23/Reno.html#Feedback2http://www.shnenglu.com/SysProgrammer/comments/commentRss/103817.htmlhttp://www.shnenglu.com/SysProgrammer/services/trackbacks/103817.html鏈榪戝湪鍋氫豢闆風數鐨勬父鎴忥紝鍏朵腑鏁屼漢椋炶埞鐨勮繍鍔ㄨ礬綰垮拰鐗瑰緛闇瑕佽兘鐏墊椿鐨勮緗紝騫朵笖灝介噺灝戝姩鍏朵粬閮ㄥ垎鐨勪唬鐮侊紝浜庢槸鎴戠殑鎯蟲硶鏄妸姣忕綾誨瀷鐨勯鑸規寚瀹氱殑榪愬姩璺嚎瀛樺叆鑴氭湰涓紝鐒跺悗鐢卞紩鎿庢牴鎹剼鏈墽琛?
鍥犳鍙互鎶婇鑸圭殑璺嚎鐪嬫垚鏄敱涓緋誨垪鐨勫叧閿偣緇勬垚錛屾瘡涓偣鏈夋瘮濡?涓睘鎬э紝X閫熷害錛孻閫熷害鍜屼繚鎸佽閫熷害鐨勬寔緇椂闂淬傝岃礬綰跨殑榪愬姩杞ㄨ抗鍙互鐢辯畝鍗曠殑鑴氭湰璇█鏉ュ畾涔夛紝姣斿涔熻闇瑕佸湪鏌愬嚑涓偣涔嬮棿閲嶅縐誨姩涓瀹氱殑嬈℃暟銆?/p>

浠ヤ笅鏄竴涓猄cript Demo:

GO
    BEGIN
        1.0 0.0 500
    END
    BEGIN
        -1.0 0.0 500
    END
    REPEAT 4
        BEGIN
             0.0 1.0 500
        END
        BEGIN
             1.0 0.0 500
        END
        BEGIN
             0.0 -1.0 500
        END
        BEGIN
            -1.0 0.0 500
        END
    END
END

琛ㄧず鍏堝乏鍙崇Щ鍔ㄤ竴嬈★紝鐒跺悗鍚戜笅錛屽悜鍙籌紝鍚戜笂錛屽悜宸﹀憟鐭╁艦縐誨姩4嬈★紝閫氳繃璁劇疆閫熷害鍒嗛噺鍙互瀹炵幇浠諱綍璺嚎鐨勭Щ鍔ㄤ互鍙婂叾浠栫壒寰併?br>璇ヨ剼鏈璦瑙i噴鍣ㄩ噰鐢ㄤ簡2涓璁℃ā寮忥紝Facade鍜孖nterpret妯″紡錛屽叾涓殑瑙i噴鍣ㄤ嬌鐢ㄤ簡鍑犱箮鍜屼換浣曡璁℃ā寮忎功涓婁粙緇嶇殑涓鏍風殑緇撴瀯錛屽緢緇忓吀鍛悀

闄勪笂璇█鐨勬枃娉曞畾涔?
program ::= GO command_list
command_list ::= command* END
command ::= begin_end_block | repeat
begin_end_block ::= BEGIN primitive END // Leaf Node on the Syntax tree
repeat ::= REPEAT INT command_list
primitive ::= SpeedX,SpeedY,Time // Recursive exit

// TestScript.txt
GO
  BEGIN
   1.0,0.0,500
  END
  BEGIN
   -1.0,0.0,500
  END
  REPEAT 4
   BEGIN
    0.0,1.0,500
   END
   BEGIN
    0.0,-1.0,500
   END
  END
END

// Execute result:



Reno 2009-12-23 16:58 鍙戣〃璇勮
]]>
色综合久久无码中文字幕| 久久国产精品一国产精品金尊| 久久成人国产精品二三区| 国产精品久久久久久福利漫画 | 一级做a爰片久久毛片毛片| 久久这里只有精品首页| 久久无码高潮喷水| 精品久久无码中文字幕| 精品久久久久久无码免费| 久久久久亚洲国产| 91久久国产视频| 精品久久久无码21p发布| 精品久久综合1区2区3区激情| 久久婷婷色香五月综合激情| 国产精品9999久久久久| 一级做a爰片久久毛片毛片| 国产精品无码久久久久久| 伊人伊成久久人综合网777| 青青青伊人色综合久久| 久久狠狠爱亚洲综合影院| 久久男人中文字幕资源站| 国产精品免费福利久久| 久久婷婷人人澡人人爽人人爱| 国产高清美女一级a毛片久久w| 久久无码人妻一区二区三区| 久久久高清免费视频| 久久一区二区免费播放| 国产视频久久| 色综合久久久久| 久久香蕉国产线看观看乱码| 亚洲精品美女久久久久99| 久久亚洲AV成人无码| 亚洲国产天堂久久综合| 亚洲精品美女久久久久99小说| 狠狠久久综合伊人不卡| 国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 久久夜色精品国产噜噜亚洲AV | 2021精品国产综合久久| 久久亚洲国产成人精品性色| 77777亚洲午夜久久多人| 综合网日日天干夜夜久久|