EBNF syntax for bounded repetition could be just simply A 3*5 and these are
equal:
A? is A*1
A+ is A1*
A* is A0*
Frantisek
On Monday, June 10, 2013 11:04:52 AM UTC+2, Frantisek Sodomka wrote:
>
> Hello Mark,
> I have few suggestions:
>
> 1. I was going through the tutorial and comparing EBNF and ABNF grammars.
> ABNF adds Bounded Repetition 3*5 A. Is there any chance of adding it also
> to EBNF? I don't know, how the syntax would be, but it can be useful at
> times.
> Repetition of characters can be done inside regular expression. Repetition
> of rules can be done also - 3*5 A would be:
> S = A A A A? A?
> Repetition of 100*120 A is not practical to encode like this anymore. I
> know about the combinators:
> {:S (rep 100 120 (nt :A))}
> and mixing of grammars:
> (abnf "S = 100*130 A")
> but still, it would be nice to be able to do it inside the EBNF string.
>
> Reading through the:
> http://en.wikipedia.org/wiki/Ebnf
>
> 2. I found that EBNF implements an exception operator -
> http://en.wikipedia.org/wiki/Ebnf#Table_of_symbols
> used for example like this:
> string = '"' , { all characters - '"' }, '"' ;
> Negative lookahead can be used instead
> string = '"' , { !'"' all characters }, '"' ;
> Just wanted to let you know about this difference. I can imagine that
> there many modifications of EBNF grammar out there :-)
>
> 3. Returning back to the point 1. and reading
> http://en.wikipedia.org/wiki/Ebnf#Conventions
> There actually is a way, how to express repetitions in EBNF:
> aa = "A";
> bb = 3 * aa, "B";
> cc = 3 * [aa], "C";
> dd = {aa}, "D";
> ee = aa, {aa}, "E";
> ff = 3 * aa, 3 * [aa], "F";
> gg = {3 * aa}, "G";
> Again, don't know if the syntax is optimal. ABNF and regular expressions
> define it better, in my opinion.
>
> Thank you for your good work!
>
> Frantisek
>
>
> On Tuesday, May 14, 2013 10:13:52 AM UTC+2, puzzler wrote:
>>
>> Instaparse is an easy-to-use, feature-rich parser generator for Clojure.
>> The big idea behind instaparse is to make it simple to convert grammars to
>> parsers without needing to know the idiosyncrasies of LL1, LALR, and other
>> esoteric grammar restrictions imposed by most parser generators.
>>
>> When I announced instaparse a little over a month ago, I imagined that I
>> had packed so many features into it, that surely there was nothing more
>> that anyone could possibly want. Oh, how naive I was :) . Within a few
>> days, there were a half-dozen great enhancement ideas posted on the github
>> site.
>>
>> Here are the highlights of the new 1.1.0 release:
>>
>> 1. Support for comments in the grammar. (This was by far the most
>> popular request.)
>>
>> 2. A new front-end for ABNF grammars. ABNF is a syntax popular for
>> carefully defining protocols in formal specs. Instaparse's support for
>> ABNF means that it is a simple copy-paste exercise to turn these
>> specifications into an executable parser.
>>
>> 3. The ability to convert EBNF and ABNF *fragments* into Clojure data
>> structures that can be easily merged with one another and with data
>> structures built by the combinator library.
>>
>> https://github.com/Engelberg/instaparse for full feature list and
>> extensive tutorial.
>> https://github.com/Engelberg/instaparse/blob/master/CHANGES.md for a
>> list of changes since the last version.
>> https://github.com/Engelberg/instaparse/blob/master/docs/ABNF.md for
>> detailed docs about the new ABNF syntax.
>>
>> It seems that whenever instaparse comes up, there is an outcry from
>> people who have a visceral reaction against the notion of building a parser
>> from a *string specification* of a grammar. So I want to be clear up
>> front that instaparse supports *three *input formats that you can freely
>> mix-and-match: EBNF strings, ABNF strings, and Clojure data structures.
>> String input is particularly handy since most grammars are already written
>> down somewhere in one of these two notations, but the data structures are
>> an option if you need them. Instaparse also supports two output formats:
>> hiccup and enlive.
>>
>> This release focused mostly on adding new features; the next version will
>> primarily be another round of performance tuning. If you want to follow
>> along and help test as I try out new optimization strategies, keep an eye
>> on the 1.2.0-SNAPSHOT branch:
>> https://github.com/Engelberg/instaparse/tree/v1.2
>>
>> Special thanks to Alex Engelberg who implemented the new ABNF input
>> format, and David Powell and Peter Monks who suggested the feature and
>> helped test it.
>>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.