Re: {Spam?} Re: state in parsers

Kristof Bastiaensen <[email protected]> Tue, 15 Dec 2015 14:25:47 +0100
Newsgroups gmane.emacs.semantic
Message-ID <[email protected]>
Hi John,

I don't disagree, but I didn't design the language.  The parser in ghc has:

> close :: { () }
>         : vccurly               { () } -- context popped in lexer.
>         | error                 {% popContext }

popContext is a function that pops the current layout context in the lexer.
Would that work in semantic?

Regards,
Kristof


On 14-12-15 18:48, John Yates wrote:
> Kristof,
>
> [I have not looked at your example, only the text of your most recent 
> question.]
>
> In the craft of building parsers it is generally considered poor 
> design to have feedback from the parser to the lexer. Ideally the 
> lexer should be able to produce a stream of tokens and quite 
> independently the parser should consume those tokens.  Sometimes the 
> lexer cannot be entirely context free. The quintessential example is 
> parsing declarators in C/C++. See this article for a description:
>
> https://en.wikipedia.org/wiki/The_lexer_hack
>
> /john
>


------------------------------------------------------------------------------