Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Whats wrong with my RPN (PostFix)output? A recursive descent approach with Grammars :)

John Poob
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy yalls! Fellow ranchers, I call for your help.. I cant seem to understand how to output my Infix expressions (ex. (a+b)*c | a+(b*c) ) into a post fix Expression using a b c (ex. ab+c* | abc*+ )
I wish to do this using the recursive descent method and not the stack parsing method. The output either doesn't come out correctly or I get an error.

I know this can help in compiler design and has many other uses but my expect method exceptions keep coming up. I have the Grammars listed below and I appear to have a problem getting the correct Tokens to be parsed and outputting in the correct

Reverse Polish Notation (Postfix) from my Infix input. I aimed to use the consume method to take in the current token and advance to the next.
Can anyone point out the problems in my code? Ive used this format before for basic grammars but this is slightly more difficult.

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic