Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

null_pointer

STL streams and strings

This topic is 6474 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m following the tutorials on FlipCode and writing a very simple scripting language/compiler/VM/potato peeler. I have gotten to the part about the lexer, and have my basic symbol table in order. I guess my knowledge of STL streams is failing me here, so could anyone show me how I could read in a continuous stream of chars (a source file), and produce tokens, and how I would go about checking to see if the symbols match text in the stream. Then I need to convert the stream into tokens. I just need a little pseudo-code and some of the STL function names to use, and I should be able to figure it out from there. Thanks for your time!
- null_pointer Sabre Multimedia

Share this post


Link to post
Share on other sites
Advertisement
Sorry, just finished a full sunday of programming (deadlines suck), so I''m not going to give my normally-stellar answer.

You need to look at sstream and/or stringstream. They''re iostreams, so they should be familiar to you. You can take those streams and feed them or get from them basic_strings.

PS, this stuff is hard, so get ready for tons of trial & error.

Share this post


Link to post
Share on other sites
quote:
Original post by null_pointer

I know it''ll be hard, but it''s good practice. I am very close to writing the GUI Editor for the Virtual OS so I need to study up on text parsing anyway. Besides, it uses something like a tiny scripting language to handle events.


Hey... didn''t you once suggest to me that scripting was just a poor substitute for hard-coding in C++?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!