[plt-scheme] parser-tools: recursive lex?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Jan 3 14:04:56 EST 2009

At Fri, 2 Jan 2009 18:40:53 -0800, YC wrote:
> The code below (lexing internet message comment syntax) results in an
> infinite loop, so I assume lex can only handle regular expressions, but want
> to check to see if it can be done (or how the problem can be solved), or if
> I need to use yacc?

A lexer can only directly match regular expressions, but you can match
just the beginning of a comment, and then you can use a function call
as the action to parse more.

For an example of this technique, 


which has a lexer that calls `read-nested-comment' when it matches


Posted on the users mailing list.