Quantcast
Viewing latest article 3
Browse Latest Browse All 5

Answer by Peter Taylor for What are some non-CS concepts that can be defined using BNF notation?

The literary arts are full of structured strings. The main problem there is finding ones which have sufficiently interesting structure. E.g.

play ::= act+
act ::= scene+
scene ::= (stage-direction | line)+
stage-direction ::= "Enter" actor+ | "Exit" actor+
...

Gypsy Spellweaver helpfully points out that this can be elaborated to incorporate even more structure as

play ::= act ( act* [intermission act+] )*

although you may want to distinguish between play (the text) and play-performance (which may have intermissions) and use that as an illustration of sharing rules between grammars.


Viewing latest article 3
Browse Latest Browse All 5

Trending Articles