I've posted similar question here, but it was closed because I didn't explained myself properly. I'll try to explain my problem again.
I managed to write LexicalAnalyzer that will tokenize the following to "public", "class", "A", "{",...,"if","(",...,"}"
string seq = "public class A " +
"{ " +
"public A() " +
"{ " +
"if(1==2) " +
"{ " +
"} " +
"else " +
"{ " +
"} " +
"} " +
"} "
Now, I need to parse it to tree. As I read, it's better to construct the parser in the way that will take rules. Meanwhile I need to write rules for "if" statement" that will be passed to parser and the last will build the parse tree. In future, I'll add rules for "class" and other.
To parse I mean that eventually I will get similar tree like here in the right
My question is how to implement the rules and the parser? Can you direct me or give simple example please?
I've read some posts, but I didn't found something that will help me to do what I need.
P.S. If it's still unclear, please don't close the post, but tell me and I'll change it.
Thank you