Re: SLIF style guide / best practices?

2015-11-22 Thread Ron Savage
My first though is make it work and then optimize it (if that's possible). 
Classic anti-premature-optimization-101!

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: SLIF style guide / best practices?

2015-11-22 Thread Paul Bennett
On Nov 22, 2015 4:10 PM, "Ron Savage"  wrote:
>
> I always try to write the ::= rules top-down, and then list the ~ rules
alphabetically. This has turned out very well, for me at least.
>

Sounds sensible. In my (admittedly gargantuan) grammar linked above, do any
of you have specific examples of ways you can make it better? The idea is
basically to concatenate the separate files together into one big grammar,
but to split that monstrosity into ... I guess ... "functionally similar"
slices, to allow Processing Instructions to come along and maybe mutate the
tag L0 terminals (for instance) without having to glark the whole grammar.

If there's a better way to modify the grammar more or less on the fly, I'd
like to know about it too...

Thanks,

--
P/PW/PWBENNETT

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: SLIF style guide / best practices?

2015-11-21 Thread Ruslan Shvedov
On Sun, Nov 22, 2015 at 8:39 AM, Paul Bennett 
wrote:

> Is there such a document?
>
My specific scenario...
>
> I have a grammar broken up into chunks (corresponding more or less
> with similarity of meaning in the official SGML spec) at
>
> https://github.com/PWBENNETT/MarpaX-SGML/tree/master/lib/MarpaX/SGML/Grammar
>
> My specific question...
>
> Within each file, is it polite to other (human) readers to sort the
> productions alphanumerically, or to cluster them so that things that
> refer to each other are near each other, or something else?
>
‘to cluster them so that things that refer to each other are near each
other’ and even top-down seems to be more or less the current common
practice according to:

https://github.com/jeffreykegler/Marpa--R2/blob/master/cpan/lib/Marpa/R2/meta/metag.bnf

https://github.com/jddurand/MarpaX-Languages-C-AST/blob/master/lib/MarpaX/Languages/C/AST/Grammar/ISO_ANSI_C_2011.pm#L183

https://github.com/ronsavage/MarpaX-Languages-Lua-Parser/blob/master/lib/MarpaX/Languages/Lua/Parser.pm#L762

https://github.com/jddurand/MarpaX-Languages-SQL-AST/blob/master/lib/MarpaX/Languages/SQL/AST/Grammar/ISO_IEC_9075_2_2003.pm#L132


>
>
> Thanks,
>
>
> --
> Paul
>
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to marpa-parser+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: SLIF style guide / best practices?

2015-11-21 Thread Jeffrey Kegler
I don't think I'll ever write a style guide -- I prefer to see what others
come up with.

My order of productions is (I think) similar to the traditional BNF, that
you still see in standards.  This tries to be top down, but also to keep
similar things together.  Unfortunately the two goals are not always the
same thing, so finding things can be difficult.

My suspicion is that current style is dictated by what's easier to write,
not what is easier to read.

Alphanumeric order is very non-standard, and would be harder to write, but
would have the decided advantage that you could actually find things in a
predictable, systematic way.

I don't think anybody has ever written anything on BNF style.  Now that you
can actually *do* something with your BNF, it may be time for a look at
style issues.


On Sat, Nov 21, 2015 at 11:06 PM, Ruslan Shvedov 
wrote:

> On Sun, Nov 22, 2015 at 8:39 AM, Paul Bennett 
> wrote:
>
>> Is there such a document?
>>
> My specific scenario...
>>
>> I have a grammar broken up into chunks (corresponding more or less
>> with similarity of meaning in the official SGML spec) at
>>
>> https://github.com/PWBENNETT/MarpaX-SGML/tree/master/lib/MarpaX/SGML/Grammar
>>
>> My specific question...
>>
>> Within each file, is it polite to other (human) readers to sort the
>> productions alphanumerically, or to cluster them so that things that
>> refer to each other are near each other, or something else?
>>
> ‘to cluster them so that things that refer to each other are near each
> other’ and even top-down seems to be more or less the current common
> practice according to:
>
>
> https://github.com/jeffreykegler/Marpa--R2/blob/master/cpan/lib/Marpa/R2/meta/metag.bnf
>
>
> https://github.com/jddurand/MarpaX-Languages-C-AST/blob/master/lib/MarpaX/Languages/C/AST/Grammar/ISO_ANSI_C_2011.pm#L183
>
>
> https://github.com/ronsavage/MarpaX-Languages-Lua-Parser/blob/master/lib/MarpaX/Languages/Lua/Parser.pm#L762
>
>
> https://github.com/jddurand/MarpaX-Languages-SQL-AST/blob/master/lib/MarpaX/Languages/SQL/AST/Grammar/ISO_IEC_9075_2_2003.pm#L132
>
>
>>
>>
>> Thanks,
>>
>>
>> --
>> Paul
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "marpa parser" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to marpa-parser+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to marpa-parser+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.