OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: DOCBOOK: Proposal #2 for BNF/EBNF markup


Here is round 2 of my BNF proposal.  Changes:

- Removed bnf element
- Changed name of prod element to production
- Change name of prodrecap element to productionrecap
- Replaced rhsline element with sbr element
- Added constraint and constraintnote elements

Things I didn't change, even though it was suggested:

- I kept the names lhs and rhs because they are so common in CoSci
- I kept the name nt because otherwise it really clogs up the code
- I kept constraint as an empty element

Issues and other notes:

- You really only want to put lineannotations at the ends of lines, but 
because it's a mixed content model, the DTD can't control the combination 
of sbr's, lineannotations, and line breaks inserted unilaterally by the 
formatter.

- Note that rhs is not line-specific.  The sbr element just forces a break, 
but it's entirely possible that the rhs content will also be flowed onto 
several lines just because the column in which it needs to appear has 
limited room.

- I don't think we can make the nt element empty and then generate its 
content (the nonterminal's name ) reliably, so we have to do a bit of 
"duplication" (and take the risk of error) and have authors supply the 
content inside the element.

			*		*		*

<!-- add productionset to %formal.class; -->
<!ELEMENT productionset
	((%formalobject.title.content;), (production|productionrecap)+)>
<!ELEMENT productionset %common.attrib;>

<!ELEMENT prod (lhs, rhs, constraint*)>
<!ATTLIST prod
	%idreq.common.attrib;
 >

<!ELEMENT lhs (#PCDATA)>
<!ATTLIST lhs %common.attrib;>

<!ELEMENT rhs (#PCDATA|nt|lineannotation|sbr)*>
<!ATTLIST rhs %common.attrib;>

<!-- add nt to %tech.char.class; -->
<!ELEMENT nt (#PCDATA)>
<!ATTLIST nt
	%common.attrib;
	%required-XLink-to-production-ID;
 >

<!ELEMENT constraint EMPTY>
<!ATTLIST constraint
	%common.attrib;
	$required-XLink-to-constraintnote-ID;
 >

<!ELEMENT prodrecap EMPTY>
<!ATTLIST prodrecap
	%common.attrib;
	%required-XLink-to-production-ID;
 >

<!-- Add constraintnote to %admon.class; -->
<!ELEMENT constraintnote (title, (%admon.mix;)+)>
<!ATTLIST constraintnote
	%idreq.common.attrib;
 >

			*		*		*

Examples based on the XML specification, but using this proposal; see 
http://www.w3.org/TR/REC-xml for how they're supposed to be presented:

<productionset>
<production id="NT-Char">
<lhs>Char</lhs>
<rhs>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
<!-- The above line break in the source file has nothing to do with the
line breaks in the output. -->
| [#x10000-#x10FFFF]
<lineannotation>any Unicode character, excluding the surrogate
blocks, FFFE, and FFFF.
</lineannotation>
</rhs>
</production>
</productionset>

<productionset>
<production id="NT-SDDecl">
<lhs>SDDecl</lhs>
<rhs><nt def="NT-S">S</nt> 'standalone' <nt def="NT-Eq">Eq</nt>
<!-- The above line break in the source file has nothing to do with the
line breaks in the output. -->
(("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))
</rhs>
<constraint def="check-rmd"/>
</production>
</productionset>

<productionset>
<production id="NT-element">
<lhs>element</lhs>
<rhs>
<nt def="NT-EmptyElemTag">EmptyElemTag</nt>
<sbr/><!-- There will be a line break in the output because of the sbr. -->
| <nt def="NT-STag">STag</nt> <nt def="NT-content">content</nt>
<!-- The above line break has nothing to do with the output. -->
<nt def="NT-ETag">ETag</nt>
</rhs>
<constraint def="GIMatch"/>
<constraint def="elementvalid"/>
</production>
</productionset>

			*		*		*

	Eve

Eve Maler                                    +1 781 442 3190
Sun Microsystems XML Technology Center    elm @ east.sun.com



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC