2

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!! :)

skaffman
  • 398,947
  • 96
  • 818
  • 769
curioComp
  • 21
  • 2

2 Answers2

1

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.

mb14
  • 22,276
  • 7
  • 60
  • 102
0

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.

Edward Kmett
  • 29,632
  • 7
  • 85
  • 107