Re: lex - how to get current file position of parser file

federation2005@netzero.com
Thu, 3 Sep 2015 15:47:39 -0700 (PDT)

          From comp.compilers

Related articles
lex - how to get current file position of parser file jkallup@web.de (Jens Kallup) (2015-09-01)
Re: lex - how to get current file position of parser file kaz@kylheku.com (Kaz Kylheku) (2015-09-01)
Re: lex - how to get current file position of parser file federation2005@netzero.com (2015-09-03)
Re: lex - how to get current file position of parser file genew@telus.net (Gene Wirchenko) (2015-09-03)
Re: include files, was lex - how to get current file position of parse kaz@kylheku.com (Kaz Kylheku) (2015-09-04)
Re: lex - how to get current file position of parser file jkallup@web.de (Jens Kallup) (2015-09-06)
Re: lex - how to get current file position of parser file kaz@kylheku.com (Kaz Kylheku) (2015-09-07)
Re: lex - how to get current file position of parser file jkallup@web.de (Jens Kallup) (2015-09-07)
| List of all articles for this month |

From: federation2005@netzero.com
Newsgroups: comp.compilers
Date: Thu, 3 Sep 2015 15:47:39 -0700 (PDT)
Organization: Compilers Central
References: 15-08-019 15-09-001
Keywords: yacc, parse
Posted-Date: 03 Sep 2015 23:50:10 EDT

On Thursday, September 3, 2015 at 10:02:20 AM UTC-5, Kaz Kylheku wrote:
> Another approach (if you can design the language that way) is to specify
> reentrant parser and lexer.


If you can get a clean unambiguous cut this should work. But it bears
to point out that the reason you don't see reentrancy very much is
that the LR framework is not really compatible with it. Lookaheads
have to all be lined up, for a clean descent to a sub-level.


This issue is what underlies the frequent-occurrence of the "advanced
entry point" hack (e.g. starting up a sub-parser for "expressions" in
a typical Algol language), where the sub-level starts up one or more
tokens past the starting point of the thing being parsed. Those are
the very things factored-out up front in an LR table. So you end up
having to compromise on the LR-ness of LR itself, with the hack or
similar means, if you want separate parser levels.



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.