[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Grammar rules in Contributor Guide summary are fragmented
From: |
Robin Bannister |
Subject: |
Grammar rules in Contributor Guide summary are fragmented |
Date: |
Sun, 7 Jan 2018 22:04:11 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
Hallo,
The Contributor Guide appendix 'LilyPond grammar' displays a summary
(ly-grammar.txt) which is derived from a summary produced by bison.
In the first section a production rule has a label on the left which
introduces the alternatives listed on the right. Or rather, _most_ rules
are like that, but for a few of them the label occurs twice. So if you
are looking for a rule and find it, you may overlook some of its
alternatives.
This is OK by bison (and maybe a practised eye) but not by me.
So I propose a readability enhancement where there is only one label per
rule and submit a revised yyout2grammar.py which caters for this.
While testing it I noticed and corrected several errors:
- the elimination of @-items in the alternatives is inaccurate
- in the second section, continuation lines pile up at the top
- in the third section, more than 30 nonterminals are missing and
@-rules are included
In the script, the production rule part is completely rewritten and the
rest is extensively refactored. See yyout2g_robin_A.py
I worked with bison-2.4.1 (GnuWin32) and obtained parser.yy and
yyout2grammar.py from git a few days ago, i.e post 2.19.80.
The following summaries are generated from that snapshot:
- before: ly-grammar.txt
- after: ly-g_robin_A.txt
Cheers,
Robin
ly-grammar.txt
Description: Text document
ly-g_robin_A.txt
Description: Text document
yyout2g_robin_A.py.txt
Description: Text document
- Grammar rules in Contributor Guide summary are fragmented,
Robin Bannister <=