Reputation: 21
I want to read from a file in Visual Haskell Studio, token after token, by loading each time the next token in a variable. For example: getNextToken. Thanks!! :)
Upvotes: 2
Views: 332
Reputation: 22616
You can use Alex, which is a lexer (which split a string into a list of tokens). Then you can do whatever you want with the token list. If you really want to "load" them and put them in a variable, in a procedural way , I'm not sure Haskell is the right language to do it.
Upvotes: 1
Reputation: 29982
Well, the right answer is somewhat complicated:
Use a parser combinator library like Parsec that will let you fully define the meaning of the word 'token', which varies from context to context.
Upvotes: 0