1

I am converting the following grammar from BNF to EBNF.

<race> => go <dir_list> and stop

<dir_list> =>   <dir> 
              | <dir> then <dir_list>
<dir> =>   from <point> to <point>  
         | around <point>   
         | to <point> 
<point> =>   A
           | B
           | C

I've done my research and i've come up with

<race> => go <dir_list> and stop
<dir_list> => <dir> { (then) <dir> }
<dir> => (from | around | to ) { <point> to <point> }
<point> => (A|B|C)

is this correct, in not can someone provide me with a solution?

Oktalist
  • 14,336
  • 3
  • 43
  • 63
Jube
  • 184
  • 2
  • 15
  • 1
    `(from | around | to) { to }` will allow syntax like `around to ` and `to to ` which the original BNF did not allow. It will also allow the use of `from`, `around`, or `to` on their own without a ``. And it will *not* allow `around ` or `to ` on their own. Also the parentheses around `then` are needless. – Oktalist Sep 02 '12 at 12:08
  • 1
    ` => (from to | around | to) ` – Oktalist Sep 02 '12 at 12:13
  • @Oktalist: Wouldn't that comment be more appropriate as an answer? – Grizzly Sep 02 '12 at 12:15
  • @Grizzly: I spose, but I wasn't confident enough that it answers the whole question – Oktalist Sep 02 '12 at 12:16
  • thank you that makes a little more sense – Jube Sep 02 '12 at 12:38

0 Answers0