c# - parser String boolean expression -



I should create a search engine so that any Boolean expression like (word1 + word2) -! Word 3 - where + stands for and , - means or and ! means not .

Then searches for these words in the database and returns the documents that receive the expression .. Then I used the dictionary like this:

 < Code> dictionary & lt; String, list & lt; Int & gt; & Gt; Word and doc = new dictionary & lt; String, list & lt; Int & gt; & Gt; ();   

And I searched every word in the database, then added it to the list of document IDs in the document - I have declared two methods.
To merge two lists first:

  Public list & lt; Int & gt;  
  public list & lt; Int & gt; The problem is: How should I parse Boolean expression in the text box (list & lt; int & gt; p1, list & lt; int & gt; p2)   

The problem is: Where + is

then combine two lists of words. If - is in the end, then consolidation two lists to prepare a list of required document IDs ... please help me and thank you very much.

I think you have to write a type of grammar. Can help you, as you can in LEX and YACC Community is important, I hope you will be able to complete your grammar so far.

I hope this helps

JP

Comments