Grammar to Json converter

Enter the grammar as following:
head -> body | ... | body
head -> body | ... | body
...

Note:
  • Use '' to denote epsilon
  • Variables/Terminals in a body should be separated by spaces
  • Productions should be separated by new lines
  • For Safari users in the below place holder A -> a should be on a newline. (Thread on StackOverflow discussing the problem)