Groups | Search | Server Info | Login | Register


Groups > comp.compilers > #267

Re: coupling LALR with a scanner?

From "Armel" <armelasselin@hotmail.com>
Newsgroups comp.compilers
Subject Re: coupling LALR with a scanner?
Date 2011-09-16 10:47 +0200
Organization les newsgroups par Orange
Message-ID <11-09-017@comp.compilers> (permalink)
References <11-07-013@comp.compilers> <11-07-015@comp.compilers> <11-07-018@comp.compilers> <11-08-004@comp.compilers> <11-09-016@comp.compilers>

Show all headers | View raw


>I don't understand why you want to have a different scanner for each
>state.  The parser can easily make the decision, whether a token is
>valid.  In fact, an LALR parser already has this information in the
>parser tables, so why make a simple situation complicated?

IELR was exactly made for that reason, as a first step to PSLR: some
grammars have no 'tokens' and 'grammar rules', they just have a 'grammar'
where mutually exclusive tokens are present, e.g. you cannot make a
Javascript single lexer as there are state where / (slash) means 'start of
regular expression' (of course the content of the regular expression follows
totally different lexing rules than the rest of the text) whereas in other
states it means 'division' operator. If your parser cannot tell which of the
two lexers to use, you are off.

> this could be confusing to the the user of your language.
people like Perl and Javascript, so we have to make parsers for those
languages :)

by the way I'd be open to use IELR, but I have to read the paper again
because it's far from being easy to understand and implement...

Armel
[This seems like an awfully complicated way to reinvent scanner start
states. -John]

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


Thread

coupling LALR with a scanner? "Armel" <armelasselin@hotmail.com> - 2011-07-05 01:02 +0200
  Re: coupling LALR with a scanner? "Armel" <armelasselin@hotmail.com> - 2011-07-07 10:28 +0200
    coupling LALR with a scanner? "Karsten Nyblad" <uu3kw29sb7@snkmail.com> - 2011-07-07 10:46 +0200
    Re: coupling LALR with a scanner? "Karsten Nyblad" <uu3kw29sb7@snkmail.com> - 2011-07-08 14:39 +0200
      Re: coupling LALR with a scanner? "Armel" <armelasselin@hotmail.com> - 2011-08-04 11:17 +0200
        Re: coupling LALR with a scanner? Paul B Mann <paul@paulbmann.com> - 2011-09-13 13:38 -0700
          Re: coupling LALR with a scanner? "Armel" <armelasselin@hotmail.com> - 2011-09-16 10:47 +0200
            Re: coupling LALR with a scanner? "Armel" <armelasselin@hotmail.com> - 2011-09-19 13:52 +0200
            Re: coupling LALR with a scanner? Paul B Mann <paul@paulbmann.com> - 2011-09-19 12:12 -0700
              Re: coupling LALR with a scanner? "Armel" <armelasselin@hotmail.com> - 2011-09-20 09:40 +0200
                Re: coupling LALR with a scanner? Chris Dodd <cdodd@acm.org> - 2011-09-23 23:59 +0100
                Re: coupling LALR with a scanner? Chris F Clark <cfc@shell01.TheWorld.com> - 2011-09-29 00:00 -0400
                Re: coupling LALR with a scanner? "Armel" <armelasselin@hotmail.com> - 2011-10-02 16:41 +0200
                Re: coupling LALR with a scanner? Chris F Clark <cfc@shell01.TheWorld.com> - 2011-10-03 11:59 -0400
                Re: coupling LALR with a scanner? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2011-10-03 21:08 +0000
          Re: coupling LALR with a scanner? Paul B Mann <paul@paulbmann.com> - 2011-09-17 10:38 -0700

csiph-web