[racket] matching eof in a parser-tools lex-abbrev

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Tue Mar 6 14:52:15 EST 2012

Thanks, I was mildly disappointed that I couldn't use that regexp 
feature in lex-abbrevs.

I did end up using the arbitrary code feature in the "lexer" actions to 
great effect: to scan a string literal token that requires paren 
balancing, and do to the unescaping in the same pass.  The "lexer" 
syntax nicely gives you the input port, with the port position is 
exactly where you'd expect it to be.

I was also briefly disappointed that the parser syntax didn't support 
some EBNF conveniences.  But as soon as I started adding actions to 
build my AST, I found that I didn't want EBNF anyway.  The result was 
some elegant use of simple list-building and functional hashes.

Overall, a positive experience with the "parser-tools" collection.

-- 
http://www.neilvandyke.org/

Posted on the users mailing list.