Re: {Spam?} Re: state in parsers
Kristof Bastiaensen <[email protected]> Tue, 15 Dec 2015 16:58:22 +0100
| Newsgroups | gmane.emacs.semantic |
|---|---|
| Message-ID | <[email protected]> |
Yes, the clause is entered when no other rules match. On 15-12-15 16:23, John Yates wrote: > Is 'error' a reserved word? That is can the lexer reliably recognize > it and pop context? > > On Tue, Dec 15, 2015 at 8:25 AM, Kristof Bastiaensen > <[email protected] <mailto:[email protected]>> wrote: > > 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 > > > ------------------------------------------------------------------------------ _______________________________________________ cedet-semantic mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cedet-semantic