Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1597

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

From federation2005@netzero.com
Newsgroups comp.compilers
Subject Re: lex - how to get current file position of parser file
Date 2015-09-03 15:47 -0700
Organization Compilers Central
Message-ID <15-09-002@comp.compilers> (permalink)
References <15-08-019@comp.compilers> <15-09-001@comp.compilers>

Show all headers | View raw


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.

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

lex - how to get current file position of parser file Jens Kallup <jkallup@web.de> - 2015-09-01 04:20 +0200
  Re: lex - how to get current file position of parser file Kaz Kylheku <kaz@kylheku.com> - 2015-09-01 14:19 +0000
    Re: lex - how to get current file position of parser file federation2005@netzero.com - 2015-09-03 15:47 -0700
      Re: include files, was lex - how to get current file position of parser file Kaz Kylheku <kaz@kylheku.com> - 2015-09-04 05:26 +0000
    Re: lex - how to get current file position of parser file Gene Wirchenko <genew@telus.net> - 2015-09-03 18:19 -0700
      Re: lex - how to get current file position of parser file Jens Kallup <jkallup@web.de> - 2015-09-06 21:53 +0200
        Re: lex - how to get current file position of parser file Kaz Kylheku <kaz@kylheku.com> - 2015-09-07 05:59 +0000
    Re: lex - how to get current file position of parser file Jens Kallup <jkallup@web.de> - 2015-09-07 17:11 +0200

csiph-web