soncho
soncho

Reputation: 133

How do I Convert EBNF to BNF?

I had a question while I was studying for my university project. I found out about the grammar of BNF and EBNF by searching the internet.

(1) I need to convert this phrase to EBNF.

<id> ::= <letter> | <id><letter> | <id><digit>

So I did this conversion.

<id>::= <letter>( <letter> | <digit> )*

Is this grammar is correct, but also how can I express it with a syntax diagram?

(2) Conversely, how can I change this EBNF to BNF?

<complex sentence> ::= ‘{’ <sentence> { <sentence> } ‘}’

There were many ways to convert from BNF to EBNF on the Internet, but I felt that I lacked information on how to convert EBNF to BNF. I also want to know how this is represented by a syntax diagram.

Upvotes: 0

Views: 395

Answers (1)

Ian Boyd
Ian Boyd

Reputation: 257085

I don't believe that EBNF uses angle brackets (<, >).

id ::= letter ( letter | digit )*

And with Railroad Diagram Generator:

enter image description here

Upvotes: 1

Related Questions