Table formula engine is widely used in many application systems. In Table formula engine, formula grammer defenition, formula grammer parsing and formula calculating are most import parts.Common parser generators have been introduced. For example Java Compiler Compiler,ANTLR,Chaperon,JFlex,SableCC,JTopas,runcc,Beaver,cup,SJPT,Lex(Lexical Analyzar), yacc( Yet Another Compiler Compiler),bison,Lemon,Grammatica.Table formula grammer has been analyzed and an appropriate formula engine is desinged and realized in the paper.The formula engine is composed by formula grammer definition, formula grammer parsing and formula calculating.Constructing token and production is formula grammer definition. First, classic string matching algorithms and regular expression matching algorithms are studied; second a binary sort tree string matching algorithm is proposed and realized.LL (1) grammer checking and a recursive descent parser are realized in formula grammer parsing part.By adding auxiliary calculating information into parse tree nodes, formula string input by users is converted into temporary codes; finally we get the correct result. |