Example: Examples of Syntax

(related to Definition: Grammar (Syntax))

We continue with the above examples of formal languages and define for them (more or less formally) a syntax.

Example 1

Let $\Sigma:=\{a,b,c\}$ be our alphabet and $L\subseteq (\Sigma^*,\cdot)$ be the formal language containing only the words beginning with "$a$" and ending with "$c$", e.g.

"$acc$", "$aabbcc$" are words of $L$, but "$a$", "$aa$", "$aaaa$", "$bca$", and "$bbbaaa$" are not words of $L$.

The syntax consists of the following rules:

Example 2

Let $\Sigma$ be the set of all Capital and lowercase Latin letters, including the empty space, the comma, the point, the question mark, and the exclamation mark, and let $L\subseteq (\Sigma^*,\cdot)$ be the formal language containing all English words. Thus

The syntax consists of these rules:

Please note that $s$ might not be a sentence since it does not have to start with a capital letter and it can end with a comma or a blank. Neither does $s$ have to make any sense in the natural English language. All it has to fulfill is the rules of the syntax.

Example 3

Let $\Sigma:=\{0,1,2,3,4,5,6,7,8,9,+,=\}$ and let $L\subseteq (\Sigma^*,\cdot)$ be the formal language containing all words starting with some letter(s) except "=", then containing the letter "$=$" only once and then ending some letter(s) except "=".

Let $\Sigma:=\{0,1,2,3,4,5,6,7,8,9,+,=\}$. Let

Thus, the syntax consists of these rules:


Thank you to the contributors under CC BY-SA 4.0!

Github:
bookofproofs


References

Bibliography

  1. Knauer Ulrich: "Diskrete Strukturen - kurz gefasst", Spektrum Akademischer Verlag, 2001