User Tools

Site Tools


tanszek:oktatas:techcomm:bn_formulas

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tanszek:oktatas:techcomm:bn_formulas [2024/10/07 16:22] – created kneheztanszek:oktatas:techcomm:bn_formulas [2025/11/25 07:50] (current) knehez
Line 9: Line 9:
 | ''::=''     | definition | | ''::=''     | definition |
 | ''|''       | alternative | | ''|''       | alternative |
-''{expression}'' | repetition (minimum and maximum repetitions can be specified using subscripts) |+\({expression}_{min}^{max}\) | repetition (minimum and maximum repetitions can be specified using subscripts) |
 | ''GOTO''    | terminal symbol (in quotes for clarity, can also use apostrophes instead) | | ''GOTO''    | terminal symbol (in quotes for clarity, can also use apostrophes instead) |
  
Line 16: Line 16:
 Let’s start with a few typical examples and try to generalize: Let’s start with a few typical examples and try to generalize:
  
-''ABC-1234, GHT-234, HSD-333, AI-BB-654''+''ABC-935, GHT-234, HSD-333, AI-BB-654''
  
 Syntax definition: Syntax definition:
 $$ $$
-<license\_plate>::<newType> | <oldType> \\ +<license\_plate>::=<newType> | <oldType> \\ 
-<oldType>::={<letter>}_3^3 − {<number>}_3^3 \\ +<oldType>::=\{<letter>\}_3^3 − \{<number>\}_3^3 \\ 
-<newType>::={<letter>}_2^2 − {<letter>}_2^2 − {<number>}_3^3 \\+<newType>::=\{<letter>\}_2^2 − \{<letter>\}_2^2 − \{<number>\}_3^3 \\
 <letter>::=A|B|C...|Z \\ <letter>::=A|B|C...|Z \\
 <number>::=0|1|2|3|4|5|6|7|8|9 \\ <number>::=0|1|2|3|4|5|6|7|8|9 \\
Line 31: Line 31:
 Let’s list a few examples and try to generalize: Let’s list a few examples and try to generalize:
  
-''062012345, +36301234567, 0680460046''+''062012345, 0036701234567, +36301234567, 0680460046'' 
 + 
 +Syntax definition: 
 +$$ 
 +<phone call>::= \{<prefix>\}_0^1 <city> <customer> \\ 
 +<prefix>::=\{+|00\}_0^1 36|06 \\ 
 +<city>::=\{<number>\}_1^2\\ 
 +<customer>::=\{<number>\}_6^7\\ 
 +<number>::=0|1|2|3|4|5|6|7|8|9 \\ 
 +$$ 
 + 
 +=== 3. Example: How can we describe the BNF formula using itself? === 
 + 
 +\[ 
 +\langle \text{BN formula} \rangle ::= \{\langle \text{rule} \rangle \}_{1}^{\infty} 
 +\] 
 +\[ 
 +\langle \text{rule} \rangle ::= \langle \text{identifier} \rangle "::=" \langle \text{expression} \rangle 
 +\] 
 +\[ 
 +\langle \text{identifier} \rangle ::= "\langle" \langle \text{letter} \rangle \mid \left\lbrace \langle \text{letter} \rangle \mid \langle \text{digit} \rangle \right\rbrace "\rangle" 
 +\] 
 +\[ 
 +\langle \text{expression} \rangle ::= \langle \text{term} \rangle \left\lbrace "|" \langle \text{term} \rangle \right\rbrace 
 +\] 
 +\[ 
 +\langle \text{term} \rangle ::= \langle \text{factor} \rangle \left\lbrace \langle \text{factor} \rangle \right\rbrace 
 +\] 
 +\[ 
 +\langle \text{factor} \rangle ::= \langle \text{identifier} \rangle \mid \langle \text{terminal_symbol} \rangle 
 +\] 
 +\[ 
 +\langle \text{terminal_symbol} \rangle ::= \left\lbrace \langle \text{character} \rangle \right\rbrace 
 +\] 
 +\[ 
 +\langle \text{letter} \rangle ::= \langle \text{uppercase} \rangle \mid \langle \text{lowercase} \rangle 
 +\] 
 +\[ 
 +\langle \text{uppercase} \rangle ::= A \mid B \mid C \dots Z 
 +\] 
 +\[ 
 +\langle \text{lowercase} \rangle ::= a \mid b \mid c \dots z 
 +\] 
 +\[ 
 +\langle \text{digit} \rangle ::= 0 \mid 1 \mid 2 \mid 3 \mid 4 \mid 5 \mid 6 \mid 7 \mid 8 \mid 9 
 +\] 
 + 
tanszek/oktatas/techcomm/bn_formulas.1728318130.txt.gz · Last modified: 2024/10/07 16:22 by knehez