in reply to Parsing a macro language
From your example format, a coarse version of the grammar would be something like
where I have not included whitespace elements in the regexes.<page> := /page p\d+ \{/ <question>* /\}/ <question> := /question \w+ {/ <label> <choices> /\}/ <label> := /label \{ [^}]+ \}/ <choices> := /single {/ <choice>+ /\}/ <choice> := /\d+ (Yes|No)/
Here the nesting, or hierarchy is represented by different grammar elements contained inside others.
-Mark
|
|---|