Hi Marijn,<br><br>Two quick points:<br><br>(1) The parser works with token structs, not symbols. Whenever you declare a token, a cooresponding "token-<name>" form is made available to you when using lexer. <br>
You can find two examples of all this in your Racket\collects\parser-tools\examples folder. To see the process, try this in interactions:<br><br>(define pt (open-input-string input))<br>(turn0-lexer pt)<br>(turn0-lexer pt)<br>
<br>and so on. If you want the turn token to contain the number that follows, you'll need to change the regexp that matches the token to include the number in the lexeme.<br><br>(2) Parsers expect a nullary function that invokes the lexer on a port, so you need a small modification:<br>
<br>(define (main port)<br> (write (turn0-parser (lambda () (turn0-lexer port)))))<br><br>If you instead write<br><br>(define (main port)<br> (write (turn0-parser (turn0-lexer port))))<br><br>the parser is passed the first token itself, not a thunk it can call to get successive tokens, which is what it wants.<br>