• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic