Skip to content

Commit 8ed69a9

Browse files
authored
Promote emu-grammar to top level and discourage emu-production etc. (#509)
1 parent ea9db8c commit 8ed69a9

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

spec/index.html

+44-44
Original file line numberDiff line numberDiff line change
@@ -657,9 +657,51 @@ <h3>Result</h3>
657657
</aside>
658658
</emu-clause>
659659

660+
<emu-clause id="emu-grammar">
661+
<h1>emu-grammar</h1>
662+
<p>Text inside emu-grammar elements is parsed using <a href="https://github.com/rbuckton/grammarkdown">Grammarkdown</a>. The syntax is essentially identical to the notational conventions in ECMAScript (minus formatting). See the <a href="https://github.com/rbuckton/grammarkdown">Grammarkdown readme</a>.</p>
663+
<p>Grammar will be displayed as an inline element flowing with text unless it is the immediate child of an emu-clause-like element.</p>
664+
665+
<h2>Attributes</h2>
666+
<p><b>collapsed:</b> If present, productions are displayed in collapsed format with LHS and RHS on the same line.</p>
667+
<p><b>example:</b> If present, the element is an example.</p>
668+
<p><b>primary:</b> Optional: Deprecated in favor of type="definition".</p>
669+
<p><b>type:</b> Optional: Disposition of the grammar. If absent, it is considered to reference productions defined elsewhere.</p>
670+
<ul>
671+
<li>"definition": The grammar is an authoritative source for productions which should be the target of references.</li>
672+
<li>"example": Deprecated in favor of the <b>example</b> attribute.</li>
673+
</ul>
674+
675+
<h2>Example</h2>
676+
<pre><code class="language-html">
677+
&lt;p>
678+
&lt;emu-grammar type="definition" collapsed example>
679+
HexIntegerLiteral :: `0x` HexDigits
680+
&lt;/emu-grammar>
681+
is a shorthand for:
682+
&lt;/p>
683+
&lt;emu-grammar type="definition" example>
684+
HexIntegerLiteral :: `0` `x` HexDigits
685+
&lt;/emu-grammar>
686+
</code></pre>
687+
688+
<h3>Result</h3>
689+
<aside class="result">
690+
<p>
691+
<emu-grammar type="definition" collapsed example>
692+
HexIntegerLiteral :: `0x` HexDigits
693+
</emu-grammar>
694+
is a shorthand for:
695+
</p>
696+
<emu-grammar type="definition" example>
697+
HexIntegerLiteral :: `0` `x` HexDigits
698+
</emu-grammar>
699+
</aside>
700+
</emu-clause>
701+
660702
<emu-clause id="grammar">
661-
<h1>Specifying Grammar</h1>
662-
<p>There are two ways to specify grammar in Ecmarkup: using the <a href="#emu-production">emu-production</a> element and related elements, or by using the <a href="#emu-grammar">emu-grammar</a> element which allows specifying grammar using a plaintext format.</p>
703+
<h1>Directly Specifying Grammar</h1>
704+
<p>Although discouraged, it is possible to directly specify grammar using the <a href="#emu-production">emu-production</a> element and related elements emitted by <a href="https://github.com/rbuckton/grammarkdown">Grammarkdown</a>.</p>
663705

664706
<h2>Lexical Grammar Examples</h2>
665707
<pre><code class="language-html">
@@ -733,48 +775,6 @@ <h3>Result</h3>
733775
</emu-production>
734776
</aside>
735777

736-
<emu-clause id="emu-grammar">
737-
<h1>emu-grammar</h1>
738-
<p>Text inside emu-grammar elements is parsed using <a href="https://github.com/rbuckton/grammarkdown">Grammarkdown</a>. The syntax is essentially identical to the notational conventions in ECMAScript (minus formatting). See the <a href="https://github.com/rbuckton/grammarkdown">Grammarkdown readme</a>.</p>
739-
<p>Grammar will be displayed as an inline element flowing with text unless it is the immediate child of an emu-clause-like element.</p>
740-
741-
<h2>Attributes</h2>
742-
<p><b>collapsed:</b> If present, productions are displayed in collapsed format with LHS and RHS on the same line.</p>
743-
<p><b>example:</b> If present, the element is an example.</p>
744-
<p><b>primary:</b> Optional: Deprecated in favor of type="definition".</p>
745-
<p><b>type:</b> Optional: Disposition of the grammar. If absent, it is considered to reference productions defined elsewhere.</p>
746-
<ul>
747-
<li>"definition": The grammar is an authoritative source for productions which should be the target of references.</li>
748-
<li>"example": Deprecated in favor of the <b>example</b> attribute.</li>
749-
</ul>
750-
751-
<h2>Example</h2>
752-
<pre><code class="language-html">
753-
&lt;p>
754-
&lt;emu-grammar type="definition" collapsed example>
755-
HexIntegerLiteral :: `0x` HexDigits
756-
&lt;/emu-grammar>
757-
is a shorthand for:
758-
&lt;/p>
759-
&lt;emu-grammar type="definition" example>
760-
HexIntegerLiteral :: `0` `x` HexDigits
761-
&lt;/emu-grammar>
762-
</code></pre>
763-
764-
<h3>Result</h3>
765-
<aside class="result">
766-
<p>
767-
<emu-grammar type="definition" collapsed example>
768-
HexIntegerLiteral :: `0x` HexDigits
769-
</emu-grammar>
770-
is a shorthand for:
771-
</p>
772-
<emu-grammar type="definition" example>
773-
HexIntegerLiteral :: `0` `x` HexDigits
774-
</emu-grammar>
775-
</aside>
776-
</emu-clause>
777-
778778
<emu-clause id="emu-production">
779779
<h1>emu-production</h1>
780780
<p>This is the top level element that contains a grammar production associating a shared <dfn>LHS</dfn> (left-hand side) <emu-xref href="#emu-nt" title></emu-xref> non-terminal symbol with one or more <emu-xref href="#emu-rhs" title></emu-xref> elements containing arbitrary <dfn>RHS</dfn> (right-hand side) sequences of terminal and non-terminal symbols.</p>

0 commit comments

Comments
 (0)