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


Groups > comp.lang.c > #112003

Re: Parser Combinators

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Parser Combinators
Date 2017-06-12 12:25 +0100
Organization A noiseless patient Spider
Message-ID <87o9ttcusv.fsf@bsb.me.uk> (permalink)
References (6 earlier) <871sqvfu52.fsf@bsb.me.uk> <a27a64f6-8cf3-429d-b508-35eb706e0600@googlegroups.com> <3d4e5258-687f-4be0-a227-9443e536c479@googlegroups.com> <87d1aaaier.fsf@bsb.me.uk> <9f44673b-731e-48a5-8e9d-1bc4297e8f46@googlegroups.com>

Show all headers | View raw


luser droog <luser.droog@gmail.com> writes:

> On Sunday, June 11, 2017 at 6:11:19 AM UTC-5, Ben Bacarisse wrote:
>> luser droog <luser.droog@gmail.com> writes:
>> <snip>
>> > This should be my last post so I can focus on other stuff, but I 
>> > fixed the quantifiers. Didn't want to leave the thread dangling
>> > with broken code.
>> >
>> > The idea for the Kleene star quantifier combinator is that it's
>> > a sequence
>> >
>> >   [ x ]
>> >
>> > where x is the input parser. But it could be zero, so wrap the 
>> > sequence in an alternation with succeeds.
>> >
>> >   << [ x ]  true >>
>> >
>> > Then stitch it up into a loop by putting the alternate inside
>> > the sequence.
>> >
>> >   y = << [ x y ]  true >>
>> >
>> > This will match 0 or more of x and return the length matched.
>> 
>> What about:
>> 
>>   parser p = sequence2(some(term('x')), string("xy"));
>>   test(p, "xxxxy");
>> 
>> ?
>
> Touché. That doesn't work. The quantifiers I've supplied are strictly
> greedy.

Just a small point to avoid confusion: "strictly greedy" seems to be
your own term, at least I've not hear it before.  The normal Kleene star
operator is greedy in the usual meaning of the term -- that it matches
the longest possible string /that still allows the whole pattern to
match/.

<snip>
-- 
Ben.

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


Thread

Parser Combinators luser droog <luser.droog@gmail.com> - 2017-05-30 00:34 -0700
  Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-04 19:34 -0700
    Re: Parser Combinators Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-05 12:46 +0100
      Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-05 07:55 -0700
  Re: Parser Combinators bartc <bc@freeuk.com> - 2017-06-05 15:06 +0100
    Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-05 08:00 -0700
      Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-06 21:54 -0700
        Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-06 22:32 -0700
          Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-06 23:03 -0700
            Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-06 23:24 -0700
            Re: Parser Combinators Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-07 20:57 +0100
              Re: Parser Combinators Melzzzzz <Melzzzzz@zzzzz.com> - 2017-06-08 00:55 +0000
              Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-07 20:17 -0700
                Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-11 00:29 -0700
                Re: Parser Combinators Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-11 12:11 +0100
                Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-11 21:21 -0700
                Re: Parser Combinators Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-12 12:25 +0100
                Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-12 13:53 -0700
                Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-13 04:43 -0700
                Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-16 02:22 -0700
                Re: Parser Combinators Melzzzzz <Melzzzzz@zzzzz.com> - 2017-06-17 04:04 +0000
                Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-06-16 23:05 -0700
                Re: Parser Combinators Melzzzzz <Melzzzzz@zzzzz.com> - 2017-06-17 06:16 +0000
                Re: Parser Combinators tkook11@gmail.com - 2017-08-10 06:38 -0700
                Re: Parser Combinators Steve Carroll <tmelmosfire@gmail.com> - 2017-08-12 13:07 -0700
                Re: Parser Combinators luser droog <luser.droog@gmail.com> - 2017-08-20 18:45 -0700
          Re: Parser Combinators bartc <bc@freeuk.com> - 2017-06-07 12:22 +0100
        Re: Parser Combinators Melzzzzz <Melzzzzz@zzzzz.com> - 2017-06-07 12:43 +0000
          Re: Parser Combinators bartc <bc@freeuk.com> - 2017-06-07 14:43 +0100

csiph-web