BTW: there is already a DSL toolchain based on pyPEG and outputting XML – it is YML, http://fdik.org/yml
Maybe this matches your needs. Convering automatically with yml2proc -Y it is:
state no="15000" {
timeout > 30
backgroundactions
as3function name="hideImages";
screen {
components {
textfield x="50", y="120", width="924", textsize="50", background="1", border="1" {
text say="1" {
part type="text" > Who would you like to call?
}
}
button label="MENU", width="80", height="30", x="920", y="10", textsize="14", icon="none", adjtext="-5" {
event name="clicked" {
action preconditions="no", name="transition" {
parameter {
type > state
name > n
value > 800
}
}
}
}
button label="My contacts", width="250", height="200", x="212", y="500", textsize="40", icon="iconRight2.png", iconx="65", icony="20", adjtext="35" {
event name="clicked" {
action preconditions="no", name="transition" {
parameter {
type > state
name > n
value > 15007
}
}
}
}
button label="Other", width="250", height="200", x="562", y="500", textsize="40", icon="iconWrong2.png", iconx="65", icony="20", adjtext="35" {
event name="clicked" {
action preconditions="no", name="transition" {
parameter {
type > state
name > n
value > 15100
}
}
}
}
}
}
}
But I would write it like this (which is correct YML, too):
// this grammar could be in a header file named guidsl.yml2
decl state(no);
decl as3function @name;
decl button(icon="none"); // default value
decl event @name;
// for the click event (which is frequent) we define a shortcut
decl clicked (*to, name="clicked") alias event {
action transition {
parameter n {
type state;
value *to;
}
}
};
decl action @name (preconditions="no");
decl parameter *name { name *name; content; };
decl type @name;
decl part(type="text", say=1);
// here comes the model
// include guidsl.yml2
// sensible defaults for this single case
decl button is button (
width=250,
height=200,
textsize=40,
iconx=65,
icony=20,
adjtext=35
);
state 15000 {
timeout 30;
backgroundactions
as3function hideImages;
screen {
components {
textfield x=50 y=120 width=924 textsize=50 background=1 border=1 {
part > Who would you like to call?
}
button label="MENU" width=80 height=30 x=920 y=10 textsize=14 adjtext=-5 {
clicked 800;
}
button label="My contacts" x=212 y=500 icon="iconRight2.png" {
clicked 15007;
}
button label="Other" x=562 y=500 icon="iconWrong2.png" {
clicked 15100;
}
}
}
}
YSLT (part of YML) now gives you a language to generate the code out of it.
According to your question, there is the XML Schema language to describe and check, see http://www.w3.org/XML/Schema – And, of course, there is YSchema ;-)
VB, author of pyPEG and YML