• Post Reply Bookmark Topic Watch Topic
  • New Topic

String/Stream Tokenizer???? Again

 
Kevin Luludis
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all, I dont know if anyone remembers, but I have been working on this project since the beginning of the year. It is a "BABY" compiler. So far I have this :

This does a nice post fix parse of any expression you enter on the command line such as this.

java parser a=b+c*d-e/f

And will postfix parse it to a b c d * + e f / - =
This is great because later on i will be pushing and popping from the stack the individual tokens in this manner. I would like to implement either StringTokenizer or StreamTokenizer in order to be able to handle Identifiers, Digits, and Operators. So far all this handles is 1 variable at a time a, b, c, etc, each separated by an operator with NO whitespace. Please let me know what you would do here at this point. Whitespace is not an issue, as I would like to ignore it, but not necessarily use it as a delimiter. Either way I welcome any and all suggestions. Thanks again!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!