Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #111966
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
| Newsgroups | comp.lang.c |
| Subject | Re: Parser Combinators |
| Date | Sun, 11 Jun 2017 12:11:08 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 32 |
| Message-ID | <87d1aaaier.fsf@bsb.me.uk> (permalink) |
| References | <bea1900f-ba44-4471-98ef-d4919809a9c9@googlegroups.com> <7zdZA.208266$lG2.203417@fx11.am4> <49c9d382-1207-427e-95d2-5c4f4e46f424@googlegroups.com> <caec227b-c451-449c-bfdf-47019bff90ae@googlegroups.com> <901b3568-9d51-48d8-8629-292b4d2180e7@googlegroups.com> <7cc32276-833b-40b4-bf43-940be3d02a7e@googlegroups.com> <871sqvfu52.fsf@bsb.me.uk> <a27a64f6-8cf3-429d-b508-35eb706e0600@googlegroups.com> <3d4e5258-687f-4be0-a227-9443e536c479@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | mx02.eternal-september.org; posting-host="5652d5b6530d9034c1dbc609b5dedcc4"; logging-data="11728"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+CMqhVQ/gR0FJEvYO8mi/XAoS0rEYDJoY=" |
| Cancel-Lock | sha1:xc1WevUKPIwpbHJhMO0MqW3HbsQ= sha1:odFncysmA7Fz/OSXXuhzLCmk+fs= |
| X-BSB-Auth | 1.edbcba39c5bd94aa7ec5.20170611121108BST.87d1aaaier.fsf@bsb.me.uk |
| Xref | csiph.com comp.lang.c:111966 |
Show key headers only | View raw
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");
?
--
Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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