[BLACKBOX] EBNF question

From: [at]} <Bob>
Date: Wed, 15 Feb 2012 23:23:19 -0000

----boundary-LibPST-iamunique-1464321379_-_-
Content-type: text/plain

Evening all,

this is not strictly on topic, but since EBNF is one of Wirth's languages I
hope people won't feel too angry with me for raising it here.

I need to define an interface file structure which is intended to be a
simplified version of a really quite complex XML schema. I am sketching the
structure of the file using a variety of notations, including EBNF, to make
sure I understand it properly before I document it for programmers who will
be producing files with this structure.

An excerpt of the EBNF in question is broadly as follows:

activity = fixedPart mandatoryParts { option } .
fixedPart = <easy to define> .
option = <easy to define>

The mandatoryParts is what I'm seeking help with. It consists of several
different structure types which are all of 1..M cardinality - in ebnf:
structure { structure }.

The difficult aspect is that each structure type must occur at least once,
and they may occur in any order.

This means that I can't write:

mandatoryParts = a {a} b {b} c {c} ... z{z} .

because that imposes the order a, b, c, ..., z

I can't write

mandatoryParts = { a {a} | b {b} | c {c} | ... | z {z} } .
or the equivalent
mandatoryParts = { a | b | c | ... | z }

because that makes each one optional.

The best I've come up with is to enumerate all permutations, which is
impractical because there are so many. For example:

mandatoryParts = ( A B C | A C B | B C A | B A C | C A B | C B A ) { a | b |
c } .
A = a {a} .
B = b {b} .
C = c {c} .
...

As you can see, it would quickly become ridiculous as the number of
mandatory types increases.

Any ideas for something succinct and general which captures this?

Thanks,
Bob


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1464321379_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldz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BiZXN0IEkndmUgY29tZSB1cCB3aXRoIGlzIHRvIGVudW1lcmF0ZSBhbGwgcGVybXV0YXRp
b25zLCB3aGljaCBpc1xwYXINCmltcHJhY3RpY2FsIGJlY2F1c2UgdGhlcmUgYXJlIHNvIG1hbnku
IEZvciBleGFtcGxlOlxwYXINClxwYXINCm1hbmRhdG9yeVBhcnRzID0gKCBBIEIgQyB8IEEgQyBC
IHwgQiBDIEEgfCBCIEEgQyB8IEMgQSBCIHwgQyBCIEEgKSBceyBhIHwgYiB8XHBhcg0KYyBcfSAu
XHBhcg0KQSA9IGEgXHthXH0gLlxwYXINCkIgPSBiIFx7Ylx9IC5ccGFyDQpDID0gYyBce2NcfSAu
XHBhcg0KLi4uXHBhcg0KXHBhcg0KQXMgeW91IGNhbiBzZWUsIGl0IHdvdWxkIHF1aWNrbHkgYmVj
b21lIHJpZGljdWxvdXMgYXMgdGhlIG51bWJlciBvZlxwYXINCm1hbmRhdG9yeSB0eXBlcyBpbmNy
ZWFzZXMuXHBhcg0KXHBhcg0KQW55IGlkZWFzIGZvciBzb21ldGhpbmcgc3VjY2luY3QgYW5kIGdl
bmVyYWwgd2hpY2ggY2FwdHVyZXMgdGhpcz9ccGFyDQpccGFyDQpUaGFua3MsXHBhcg0KQm9iXHBh
cg0KXHBhcg0KXHBhcg0KLS0tLVxwYXINClRvIHVuc3Vic2NyaWJlLCBzZW5kIGEgbWVzc2FnZSB3
aXRoIGJvZHkgIlNJR05PRkYgQkxBQ0tCT1giIHRvIExJU1RTRVJWQExJU1RTLk9CRVJPTi5DSH19
AH8A3J0=
----boundary-LibPST-iamunique-1464321379_-_---
Received on Thu Feb 16 2012 - 00:23:19 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:08 UTC