213k views
0 votes
Clear up the Relationship between the proramming paradigms: event

driven, object oriented and procedural ?

1 Answer

2 votes

The difference from the previous BNF is that the "0" option is removed from `<even>`, indicating that numbers cannot begin with 0.

1) BNF for a language containing all positive even integers allowing numbers to begin with 0:

```
<even> ::= "0" | "2" | "4" | "6" | "8"
<number> ::= <even> <digit>*
<digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
```

In this BNF representation, `<even>` represents the possible even digits (0, 2, 4, 6, 8), `<number>` represents a positive even integer, and `<digit>` represents any digit from 0 to 9.

2) BNF for a language containing all positive even integers without numbers beginning with 0:

```
<even> ::= "2" | "4" | "6" | "8"
<number> ::= <even> <digit>*
<digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
```

In this BNF representation, `<even>` represents the possible even digits (2, 4, 6, 8), `<number>` represents a positive even integer, and `<digit>` represents any digit from 0 to 9. The difference from the previous BNF is that the "0" option is removed from `<even>`, indicating that numbers cannot begin with 0.

To know more about BNF click-

User Moein Hosseini
by
9.2k points