CN1896954A - 用于复杂多业务的动态编译器的构件化实现 - Google Patents
用于复杂多业务的动态编译器的构件化实现 Download PDFInfo
- Publication number
- CN1896954A CN1896954A CNA2006101065507A CN200610106550A CN1896954A CN 1896954 A CN1896954 A CN 1896954A CN A2006101065507 A CNA2006101065507 A CN A2006101065507A CN 200610106550 A CN200610106550 A CN 200610106550A CN 1896954 A CN1896954 A CN 1896954A
- Authority
- CN
- China
- Prior art keywords
- variable
- service
- compiler
- class
- expression
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Devices For Executing Special Programs (AREA)
Abstract
Description
public: Interpreter(){m_SyntaxTree.push_back(NULL);} ~Interpreter(); bool DcfineVariable(const char *VariableName,const char * VariableAddress); const char *Operation(char *Result,int Length,int *Error,const char *Context); void DumpVar(void){} //私有类 private: //解释器各种表达式基类 <!-- SIPO <DP n="3"> --> <dp n="d3"/> class Expression public: Expression(){} virtual ~Expression(){} virtual const char *Execute()=0; virtual const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context,int &ErrorNo)=0; virtual const char *ExpType(){return(const char *)"Expression";} friend class Expression; //终结符表达式,叶子节点不需要在进行语法分析 //语法树中的叶子结点,一些常量字符串,如’11’,’12’,’011’等 class LiteralExp:public Expression { public: explicit LiteralExp(const char *Literal):m_Literal(Literal){} virtual ~LiteralExp(){} const char *Execute(){return m_Literal.c_str();} const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo){return NULL;} const char *ExpType(){return(const char *)"LiteralExp";} private: string m_Literal;}; friend class LiteralExp; //表达式中出现的变量,语法树中的叶子结点 class VariableExp:public Expression { public: explicit VariableExp(const char *pVarAddress):m_pVarAddress(pVarAddress) {} ~VariableExp(){} const char *Execute(){return m_pVarAddress;} const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo){return NULL;} const char *ExpType(){return(const char *)"VariableExp";} private: const char *m_pVarAddress;}; friend class VariableExp; //函数表达式 //like(exp1,exp2) class LikeExp:public Expression { public: LikeExp():m_LeftExp(0),m_RightExp(0){} ~LikeExp(); const char *Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"LikeExp";} private: <!-- SIPO <DP n="4"> --> <dp n="d4"/> bool Compare(const char *CompareString,const char *CompareMod); Expression *m_LeftExp; Expression *m_RightExp;}; friend class LikeExp; //not(exp) class NotExp:public Expression { public: NotExp():m_BoolExp(0){} ~NotExp(); const char *Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"NotExp";} private: Expression *m_BoolExp;}; friend class NotExp; //if(exp,true_return,false_return) class IfExp:public Expression { public: IfExp():m_BoolExp(0),m_True_RetExp(0),m_False_RetExp(0){} ~IfExp(); const char *Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"IfExp";} private: Expression *m_BoolExp; Expression *m_True_RetExp; Expression *m_False_RetExp;}; friend class IfExp; //case(conditionl,result1,condition2,result2,....,default_result) class CaseExp:public Expression { public: CaseExp(){} ~CaseExp(); const char * Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"CaseExp";} private: vector<Expression *>m_ExpArray;}; friend class CaseExp; //bool_expl and bool_exp2 class AndExp:public Expression { public: <!-- SIPO <DP n="5"> --> <dp n="d5"/> AndExp():m_LeftCondition(0),m_RightCondition(0){}; ~AndExp() { delete m_LeftCondition; delete m_RightCondition;} const char * Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo){return NULL;} const char *ExpType(){return(const char *)"AndExp";} void AddLeftExp(Expression *LeftExp){m_LeftCondition=LeftExp;} void AddRightExp(Expression *RightExp){m_RightCondition=RightExp;} private: Expression *m_LeftCondition; Expression *m_RightCondition;}; friend class AndExp; //bool_exp1 or bool_exp2 class OrExp:public Expression { public: OrExp():m_LeftCondition(0),m_RightCondition(0){}; ~OrExp() { delete m_LeftCondition; delete m_RightCondition; } const char * Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo){return NULL;} const char *ExpType(){return(const char *)"OrExp";} void AddLeftExp(Expression *LeftExp){m_LeftCondition=LeftExp;} void AddRightExp(Expression *RightExp){m_RightCondition=RightExp;} private: Expression *m_LeftCondition; Expression *m_RightCondition;}; friend class OrExp; //in(value,test_value1,test_value2,....) class InExp:public Expression { public: InExp(){}; ~InExp(); const char * Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"InExp";} private: vector<Expression *>m_ExpArray;}; friend class InExp; //substring(string,{-}pos{,length})pos为正时从左到右从1开始,pos为 负时从右往左从-1开始 <!-- SIPO <DP n="6"> --> <dp n="d6"/> //如果忽略length表示取到字符串末尾 class SubStringExp:public Expression { public: SubStringExp():m_StringExp(0),m_PosExp(0),m_LenExp(0){} ~SubStringExp(); const char * Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"SubStringExp";} private: Expression *m_StringExp; Expression *m_PosExp; Expression *m_LenExp; //存放结果 char m_Buffer[255];}; friend class SubStringExp; //connect(string1,string2) class ConnectExp:public Expression { public: ConnectExp():m_FirstStrExp(0),m_SecondStrExp(0){} ~ConnectExp(); const char * Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"ConnectExp";} private: Expression *m_FirstStrExp; Expression *m_SecondStrExp; //存放结果 char m_Buffer[255];}; friend class ConnectExp; //set($VarExp,string) class SetExp:public Expression { public: SetExp():m_VariableExp(0),m_StringExp(0){} ~SetExp(); const char * Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"SetExp";} private: Expression *m_VariableExp; Expression *m_StringExp;}; friend class SetExp; //strabove(string1,string2)|strbelow(string1,string2) <!-- SIPO <DP n="7"> --> <dp n="d7"/> class StrCmpExp:public Expression { public: explicit StrCmpExp(bool blsStrAbove):m_StringExp1(0),m_StringExp2(0),m_blsStrAboye(blsStrAbove){} ~StrCmpExp(); const char * Execute(); const char *SyntaxAnalyze(Interpreter *plnterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return m_blsStrAbove?(const char *)"StrAbove":(const char *)"StrBelow";} private: Expression *m_StringExp1; Expression *m_StringExp2; bool m_blsStrAbove;}; friend class StrCmpExp; //numabove(numstring1,numstring2)|numbelow(numstring1,numstring2) class NumCmpExp:public Expression { public: explicit NumCmpExp(bool bNumStrAbove):m_NumStringExp1(0),m_NumStringExp2(0),m_bIsNumAbove(bNumStrAbove){} ~NumCmpExp(); const char*Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return m_bIsNumAbove?(const char *)"NumAbove":(const char *)"NumBelow";} private: Expression *m_NumStringExp1; Expression *m_NumStringExp2; bool m_bIsNumAbove;}; friend class NumCmpExp; //isdatetime(string) class IsDateTimeExp:public Expression { public: explicit IsDateTimeExp():m_StringExp(0){} ~IsDateTimeExp(); const char * Execute(); const char *SyntaxAnaIyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"IsDateTimeExp";} private: Expression *m_StringExp; }; friend class IsDateTimeExp; //add by liusk 2003/10/23 //计算字符串长度 <!-- SIPO <DP n="8"> --> <dp n="d8"/> //length(string) class LengthExp:public Expression { public: explicit LengthExp():m_StringExp(0){} ~LengthExp(); const char *Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"LengthExp";} private: char m_Length[30]; Expression *m_StringExp;}; friend class LengthExp; //add by liusk 2003/10/23 //如果value和搜索(serarch_n)列表中的任何一个相等则返回相应的 result,否则返回默认值default_result //与case函数的不同为,case为条件测试满足则返回,decode为比较测试与 一系列的值比较如果满足则返回对应的结果 //decode(value_exp,search1,resultl,search2,result2,..,default_result) class DecodeExp:public Expression { public: explicit DecodeExp(){} ~DecodeExp(); const char *Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"DecodeExp";} private: vector<Expression *>m_ExpArray;}; friend class DecodeExp; //add by liusk 2003/11/8 //comma(exp1,exp2,exp3,....,expn) //逗号表达式,执行所有的表达式语句,但返回最后一个表达式的值 //可做一些表达式的容器 class CommaExp:public Expression { public: expliciy CommaExp(){} ~CommaExp(); const char * Execute(); const char *SyntaxAnalyze(Interpreter *pInterpreter,const char *Context, int &ErrorNo); const char *ExpType(){return(const char *)"CommaExp";} private: vector<Expression *>m_ExpArray;}; friend class CommaExp; <!-- SIPO <DP n="9"> --> <dp n="d9"/> private: //变量列表 map<string,const char *>m_VaribleList; //索引0未使用 veetor<Expression *>m_SyntaxTree; //语法分析过程 const char *CompileExp(const char *Context,Expression **SyntaxTree,int &ErrorNo); const char *ValueExp(const char *Context,Expression **SyntaxTree,int &ErrorNo);}
//第一次编译表达式时会强制修改表达式的前2个字节 //第1个字节是已编译标志OxEE,第2个字节是索引号 //建议在配规则时每条规则前面预留2个tab字符 //主要是为了能迅速定位一个表达式的语法树 const char *Interpreter::Operation(char *Result,int Length,int *ErrorNo,const char *Context) { *ErrorNo=COMPILE_NOERROR; if(*(unsigned char *)Context==OxEE) { //try{运行时错误编号COMPILE_RUNTIME_ //需由Expression对象抛出异常try //取表达式的索引编号 return strncpy(Result,m_SyntaxTree[(unsigned int)*(Context+ 1)]->Execute(),Length);} catch(...){ *ErrorNo=COMPILE_RUNTIME_ERROR_UNKNOWN; return Result; } } else { //表达式超过最大限制 //(索引编号使用一个字节存储1~255,由于0是字符串结束标志未使用0) if(m_SyntaxTree.size()>=256) { *ErrorNo=COMPILE_RUNTIME_ERROR_EXPOVERLIMIT; return Context;} Expression *pTempExp=NULL; const char *pPosition=NULL; pPosition=CompileExp(Context,&pTempExp,*ErrorNo); if(*ErrorNo !=COMPILE_NOERROR) { return pPosition; } //如还有剩余的字符串则说明表达式不符文法规则 else if(*pPosition !=0) { *ErrorNo=COMPILE_ERROR_INVALID_EXP; <!-- SIPO <DP n="10"> --> <dp n="d10"/> delete pTempExp; return pPosition;} //对表达式加索引,格式为:OxEE索引编号,从1~255 //注:修改Context的第1个字节为OxEE(标志),第2个字节为索引号 *(unsigned char *)Context=OxEE; *(unsigned char *)(Context+1)=m_SyntaxTree.size(); m_SyntaxTree.push_back(pTempExp); return Operation(Result,Length,ErrorNo,Context);}
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNA2006101065507A CN1896954A (zh) | 2006-04-27 | 2006-07-12 | 用于复杂多业务的动态编译器的构件化实现 |
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200610039945 | 2006-04-27 | ||
CN200610039945.X | 2006-04-27 | ||
CNA2006101065507A CN1896954A (zh) | 2006-04-27 | 2006-07-12 | 用于复杂多业务的动态编译器的构件化实现 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN1896954A true CN1896954A (zh) | 2007-01-17 |
Family
ID=37609482
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNA2006101065507A Pending CN1896954A (zh) | 2006-04-27 | 2006-07-12 | 用于复杂多业务的动态编译器的构件化实现 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN1896954A (zh) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101488095A (zh) * | 2008-01-18 | 2009-07-22 | 松下电器产业株式会社 | 编译方法以及编译程序 |
CN103077038A (zh) * | 2013-01-31 | 2013-05-01 | 北京金和软件股份有限公司 | 动态生成和编译.net项目的方法 |
CN106649340A (zh) * | 2015-10-30 | 2017-05-10 | 北京国双科技有限公司 | 条件过滤数据的存取方法及装置 |
CN118193543A (zh) * | 2024-05-15 | 2024-06-14 | 成都融见软件科技有限公司 | 一种基于eda的节点树的查找方法、电子设备及存储介质 |
-
2006
- 2006-07-12 CN CNA2006101065507A patent/CN1896954A/zh active Pending
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101488095A (zh) * | 2008-01-18 | 2009-07-22 | 松下电器产业株式会社 | 编译方法以及编译程序 |
CN103077038A (zh) * | 2013-01-31 | 2013-05-01 | 北京金和软件股份有限公司 | 动态生成和编译.net项目的方法 |
CN103077038B (zh) * | 2013-01-31 | 2016-03-30 | 北京金和软件股份有限公司 | 动态生成和编译.net项目的方法 |
CN106649340A (zh) * | 2015-10-30 | 2017-05-10 | 北京国双科技有限公司 | 条件过滤数据的存取方法及装置 |
CN118193543A (zh) * | 2024-05-15 | 2024-06-14 | 成都融见软件科技有限公司 | 一种基于eda的节点树的查找方法、电子设备及存储介质 |
CN118193543B (zh) * | 2024-05-15 | 2024-07-12 | 成都融见软件科技有限公司 | 一种基于eda的节点树的查找方法、电子设备及存储介质 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110187885B (zh) | 一种量子程序编译的中间代码生成方法及装置 | |
CN1320454C (zh) | 用于处理xml对象的程序设计语言扩展及相关应用 | |
EP1174791B1 (en) | Unified data type system and method | |
CN1278231C (zh) | 将抽象句法表示法1数据模型化成对象模型的方法及系统 | |
CN100337235C (zh) | 访问数据库的方法及装置 | |
CN1371499A (zh) | 传统数据结构的对象特性元模型仿真器 | |
CN1305609A (zh) | 实现参数化类型与现有非参数化库兼容的方法 | |
CN112379917B (zh) | 浏览器兼容性提升方法、装置、设备及存储介质 | |
CN1526104A (zh) | 分析结构化数据 | |
CN1858717A (zh) | 一种数据编解码方法及其编解码器 | |
CN100397397C (zh) | 基于关系数据库的xml数据存储与访问方法 | |
CN1896954A (zh) | 用于复杂多业务的动态编译器的构件化实现 | |
CN114265772B (zh) | 一种测试用例的生成方法及一种测试方法 | |
CN1976320A (zh) | 数据访问控制方法及系统 | |
CN1525317A (zh) | 在标记中用于定义和使用子级说明的系统和方法 | |
CN1255744C (zh) | 智能卡通用高速发卡机及其发卡方法 | |
CN1207662C (zh) | 基于多代理的交互式Web服务调度方法 | |
Irwin et al. | Object oriented metrics: Precision tools and configurable visualisations | |
CN113971044A (zh) | 组件文档生成方法、装置、设备及可读存储介质 | |
CN1949175A (zh) | 一种对软件中的数据进行替换的方法 | |
CN111124422A (zh) | 一种基于抽象语法树的eos智能合约语言转换方法 | |
CN1900905A (zh) | 测试描述语言的实现方法及其装置 | |
CN1584885A (zh) | 用于验证分层组织的消息的系统和方法 | |
US7058651B2 (en) | Method, computer program product, and system for automatic class generation with simultaneous customization and interchange capability | |
CN1667610A (zh) | 一种基于标记的xml快速解码方法 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
EE01 | Entry into force of recordation of patent licensing contract |
Assignee: LIAN Technology (Nanjing) Co., Ltd. Assignor: Linkage System Integration Co., Ltd. Contract fulfillment period: 2009.6.23 to 2027.8.30 contract change Contract record no.: 2009320001548 Denomination of invention: Method for realizing structural dynamic compiler of complicated multi-service License type: exclusive license Record date: 2009.8.17 |
|
LIC | Patent licence contract for exploitation submitted for record |
Free format text: EXCLUSIVE LICENSE; TIME LIMIT OF IMPLEMENTING CONTACT: 2009.6.23 TO 2027.8.30; CHANGE OF CONTRACT Name of requester: LIANCHUANG SCIENCE ( NANJING ) CO., LTD. Effective date: 20090817 |
|
ASS | Succession or assignment of patent right |
Owner name: LIANCHUANG SCIENCE ( NANJING ) CO., LTD. Free format text: FORMER OWNER: NANJING LIANCHUANG SCIENCE CO., LTD. Effective date: 20091211 |
|
C41 | Transfer of patent application or patent right or utility model | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20091211 Address after: 16 F, 12 Huai gate, Nanjing City, Jiangsu Province, China: 210013 Applicant after: LIAN Technology (Nanjing) Co., Ltd. Address before: 16 F, 12 Huai gate, Nanjing City, Jiangsu Province, China: 210013 Applicant before: Linkage System Integration Co., Ltd. |
|
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Open date: 20070117 |