From: Jiao, D. <dj...@in...> - 2007-04-20 13:33:36
|
Ok, I thought you were asking how to implement it. I think you should address the precedence from the parser. Once you bulid a binaery tree for the operators (not the ASTTree!) in JavaCC, then in the Java code, you can just traverse that tree because the precedence is already defined in the tree. For how to interpret them, take a look at this page. http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html David sushil ronghe wrote: > > I mean how should i implement the matching in matcher class > SMARTSOperatorAtom > > > The highest precedence expression should be left last to parse > > > ok this is quite useful to me but my question was, > i want to know for matching what is the equivalent operator in java > for & and ; > suppose we have expression like this [C,N&H2] and [C,N;H2] > what is the difference in between this two. > > for both the operators this is true [C or N and H2] > or something else. > > > > > > > > On 4/20/07, *Jiao, Dazhi* <dj...@in... > <mailto:dj...@in...>> wrote: > > Sushil, > > When parsing a language with binary operators, the TREE structure > is the > key. > > To do precedence, please refer to my previous email about a > "LogicalOperator" class and my JJTree code. > > The BNF I created for parsing binary operators is: > > LogicalExpression ::= "[" AndOrExpression "]" > LowAndExpression ::= OrExpression ( ";" LowAndExpression )? > OrExpression ::= ExplicitHighAndExpression ( "," OrExpression ) ? > ExplicitHighAndExpression ::= ImplicitHighAndExpression ( "&" > ExplicitHighAndExpression )? > ImplicitHighAndExpression ::= NotExpression ( > ImplicitHighAndExpression ) ? > > The highest precedence expression should be left last to parse. As you > can see, this basically will create a partial binary parse tree. > > Logical bonds are similar to this. > > I hope this helps. and I really suggest you to take a look at the > BNF I > created. It's in the previous email and in the JJTree code. I made > a little changes to add ring identifiers. But the basic structure > is the > same. Even if we decide on JavaCC instead of JJTree, a BNF is > always helpful to have a full picture of the language. > > David > > sushil ronghe wrote: > > > > As a smart parser has completed a significant part of smarts > expression. > > i think this is the time to incorporate aromatic atom,and > support for > > expressions > > like atom with hydrogenes.Ex :c:[nH1] or [CH2] etc.. that will be > > done easily. > > > > But in operator precedence i am really unable to think how > should one > > implement that. > > at present for both these operator "&" and ";" i have added the > > "*and"* operator see the file > > SMARTSOperatorAtom in > "org.openscience.cdk.isomorphism.matchers.smarts". > > > > please help me to understand operator precedence. > > > > -- > > ******************************** > > sushil ronghe > > Center of Pharmacoinformatics > > India > > ********************************* > > > ------------------------------------------------------------------------ > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > > ------------------------------------------------------------------------ > > > > > _______________________________________________ > > Cdk-devel mailing list > > Cdk...@li... > <mailto:Cdk...@li...> > > https://lists.sourceforge.net/lists/listinfo/cdk-devel > > > > > > > -- > ******************************** > sushil ronghe > Center of Pharmacoinformatics > India > ********************************* |