c# - C++ scanner (string-fu!) -


I am writing a scanner as part of a compiler.

I'm having a big headache trying to write a part:

Parsing a stream of tokens and pushing them together in a vector, white space Excerpt: Parsing in 6 different tokens (simple case, brackets and braces)

Example: int main () {}

  • )
  • )
  • }
  • How will you go about solving it? I am writing this in C ++, but the Java / C # solution will also be appreciated.

    Some points:

    1. And no, I can not use Boost, I can not guarantee that the library will be available to me (do not ask. ..)

    2. I do not want to use Lex, or any other special equipment I've never done before and just to say that I did this, one I want to try again.

    3. Strastross's book, C ++ programming language < / Em>, is a great example of creating a laser / parser for a simple calculator program. To know what you want to do, you should work as a good starting point.


    Comments