[racket] parser-tools help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Timothy,
On 30-11-11 15:14, Timothy Nelson wrote:
> Hi Marijn,
>
> Two quick points:
>
> (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.
Actually the parser will accept symbols instead of tokens, but you
won't be able to store any data IN the token/symbol.
> (2) Parsers expect a nullary function that invokes the lexer on a
> port, so you need a small modification:
>
> (define (main port) (write (turn0-parser (lambda () (turn0-lexer
> port)))))
>
> If you instead write
>
> (define (main port) (write (turn0-parser (turn0-lexer port))))
>
> the parser is passed the first token itself, not a thunk it can
> call to get successive tokens, which is what it wants.
Thanks, that was real useful!
After fixing this I was able to figure out the rest of the problems.
Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk7WTWsACgkQp/VmCx0OL2yBeQCgt4mVFFNT3zy96jFENYFWw83l
EtEAmwQ3p+9WK90GMMx8vtq+ltrM9oyA
=bkLd
-----END PGP SIGNATURE-----