[pcre-dev] Need help with implementing a parser (binary oper…

Αρχική Σελίδα
Delete this message
Συντάκτης: sasho648
Ημερομηνία:  
Προς: pcre-dev
Αντικείμενο: [pcre-dev] Need help with implementing a parser (binary operators) - pcre2
Hello,

First and foremost I want to thank you all developers for your amazing work
- it's really astonishing how all this does complex things without much
effort. Well actually effort is needed but it's definitely better than
writing a parser by hand.

Anyway so I've created some sort of C parser with your library that for the
moment handles unary and cast operators very well.

However I wanted to add binary ones too - currently for some reason this:

(?<addition>(?&addition)(\+\d)|\d)

Inhibits recursive loop. It's basically the exact same way it's written in
the standard - the idea is that the left hand side can contain infinite
times itself until it contains the right hand side.

My target is basically if I have multiple binary operators, with using
callouts in the right place, to get the operators in the right order, for
example if I have:

6 + 7 * 8 to give:

6
7
8
*
+

Because of priority. I basically had something going but I'm completely
rehauling it now (primarily because it wasn't working properly with
assignment).

Here is my github project <https://github.com/bsld/cparser>.

Thank you so much.

Happy holidays,

Alexander NIkolov