Quantcast
Channel: What are some non-CS concepts that can be defined using BNF notation? - Computer Science Educators Stack Exchange
Viewing all articles
Browse latest Browse all 5

What are some non-CS concepts that can be defined using BNF notation?

$
0
0

I'm preparing a class on the modified BNF notation that python uses. I.e.,

Each rule begins with a name (which is the name defined by the rule) and ::=. A vertical bar (|) is used to separate alternatives; it is the least binding operator in this notation. A star (*) means zero or more repetitions of the preceding item; likewise, a plus (+) means one or more repetitions, and a phrase enclosed in square brackets ([ ]) means zero or one occurrences (in other words, the enclosed phrase is optional). The * and + operators bind as tightly as possible; parentheses are used for grouping. Source

For this class, I'm not allowed to assume the students have prior knowledge in CS. Thus I must rely on concepts from general knowledge to provide examples in the use of BNF.

In other words, I can't use something like

longstringitem ::= longstringchar | stringescapeseq,

I must use something like this instead:

digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
"a digit is defined as either 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9"

What are some non-CS concepts that can be used to illustrate the * sign (zero or more repetitions of the preceding item,) the + sign (one or more repetitions,) the phrase enclosed in [] (zero or one occurrences) and the () (used for grouping) from the BNF notation?


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>