denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Denemo-devel] lexer states


From: Richard Shann
Subject: Re: [Denemo-devel] lexer states
Date: Mon, 09 Aug 2010 12:03:02 +0100

On Mon, 2010-08-09 at 08:42 +0100, Richard Shann wrote:
> the switch from using one lexer to the other as lalr operates is
> something I haven't studied yet.
What it will amount to is that the lexer you pass to lalr is a
handwritten procedure that checks which state is on the top of the stack
and then calls the correct lexer out of the set which you have created
(all operating on the same input).

It is all amazingly much easier to do this stuff in scheme. The stack of
states is just a list, and you just look at the head of the list to
decide which lexer to call. And the parser when it gets %{ - for example
- just puts 'longcomment at the head of the list. And the longcomment
lexer when it sees %} just takes the first element of the list and
returns.

Richard





reply via email to

[Prev in Thread] Current Thread [Next in Thread]