• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

String/Stream Tokenizer???? Again

 
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!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!