1

How can I define a spirit qi grammar which can have more than one starting rule? I am working on an XML grammar and I want to have 4 possible starting rules.

So if I have a grammar called xml_grammar and the base_type is (A, "A"). I also want few other starting rules.

secretformula
  • 6,414
  • 3
  • 33
  • 56
vishal129
  • 105
  • 9

1 Answers1

1

All formal grammars have a single start symbol. If you have multiple start symbols under consideration (say A, B, C and D), you can convert them into a single artificial start symbol S with a rule like:

S = A | B | C | D
thiton
  • 35,651
  • 4
  • 70
  • 100
  • Thanks thiton. It looks helpfuf but I am not sure will it work or not. I am trying to do this and test it for an iso_8859 xml grammar. Will let you know if it works and will accept the answer. – vishal129 Jul 16 '12 at 19:42