0

I am converting BNF dialect 2 to standard EBNF and making the grammar as simple as possible from this problem below.

  <state> -> <abc> | <abc>;
  <state> -> <def> | <def>;
  <state> -> <ghi> | <ghi>;

here is my attempt that I followed along page 131 in my textbook http://umsl.edu/~mfrp9/misc/cpl.pdf

<state> -> (<abc> | <abc>)(<def> | <def)(<ghi> | <ghi>);

Is this a correct solution and is there a simpler solution than this with {...} for repeated?

Also I noticed in this post How to convert BNF to EBNF compared to the example above in my textbook removed <...> in the post and in my book it didn't? does it matter or what is the situation?

Community
  • 1
  • 1
Noobie
  • 65
  • 5
  • The BNF rules are a little odd; ` | ` is pretty much the same as ``, isn't it? – Jonathan Leffler Oct 01 '14 at 06:18
  • Of course I missed the obvious. So it should be (abc)(def)(ghi);? – Noobie Oct 01 '14 at 06:28
  • I think it should probably be `abc | def | ghi`, shouldn't it? Any one of those is valid as a state, but not several of them together. If it is homework, it might be as well to check whether there's an error in the 3 original rules; they are unorthodox in the extreme, but might be written like that to catch you out. – Jonathan Leffler Oct 01 '14 at 07:29

0 Answers0