OT: Less-restrictive alternative to XML and XML visualizers?

Nick Sabalausky a at a.a
Fri Jan 9 18:41:14 PST 2009


"BCS" <ao at pathlink.com> wrote in message 
news:78ccfa2d386e88cb409b20ef38c6 at news.digitalmars.com...
> Reply to Nick,
>
>> I have a need for an inexpensive (preferably freeware or open-source,
>> obviously), alternate to using XML and an XML viewer (such as
>> MindFusion's XML Viewer). The main problem with XML is that I need
>> something that will allow node names to contain any arbitrary text
>> character (or at least just the ascii symbols such as parentheses,
>> comma, etc). Any ideas?
>>
>
> What are you wanting to /do/ with it. I ask because I know of a product 
> (Ok
> I'm helping develop it) that fits in part of the nich that XML tries to 
> cover.
>

I'm working on a high-level-language processing tool as a pet project (at 
the moment it just parses grammars compiled with the GOLD tool), and 
(especially for debugging) I'd like to output the parse tree and eventually 
AST in a way that I can easily/visually inspect the resulting trees.

I've attached an example XML (not guaranteed to be 100% valid XML) of what 
I'm talking about. You can see that the names of the XML nodes are the names 
of the parser rules and terminals (which is how I want it).

Problem is (though admittedly more of an inconvenience), for simple 
terminals, the name is usually the name of the symbol, which would lead to 
invalid XML-nodes like "<+ ...>...</+>". In the attached file, the node 
names are actually things like "Plus" instead of "+", but that's because I'm 
currently working around the problem by defining my grammars like this (GOLD 
.grm format):

Plus = '+'
Minus = '-'
<Add Exp> ::=
       <Add Exp> Plus <Mult Exp>
    |  <Add Exp> Minus <Mult Exp>
    |  <Mult Exp>

instead of this:

<Add Exp> ::=
       <Add Exp> '+' <Mult Exp>
    |  <Add Exp> '-' <Mult Exp>
    |  <Mult Exp>

Another possible issue is the "content" attribute. I know there's a lot of 
escaping that's needed to put an arbitrary string in an attribute, but I 
seem to vaguely remember there still being some sort of hard restriction on 
either what, or how much, you can put in there (I haven't looked that up 
yet).

One other feature I'd love to have in the tree-viewer tool (though not 
necessary) is the ability to show the tree and original source (not the 
grammar source, the source being parsed by the grammar) side-by-side, select 
a node and have it highlight the associated portion of source code (or 
vice-versa). But I'm not sure if anything like that exists in a general form 
that isn't tied to a particular language-processing environment. 


begin 666 parseTree.xml
M/%!R;V=R86T at 8V]N=&5N=#TB;7E);G0K<7=I9BHH<V5V96YT>7-I>"IX+2AY
M*2DB('1Y<&4](DYO;E1E<FUI;F%L(CX-"B @(" \17AP<F5S<VEO;B!C;VYT
M96YT/2)M>4EN="MQ=VEF*BAS979E;G1Y<VEX*G at M*'DI*2(@='EP93TB3F]N
M5&5R;6EN86PB/@T*(" @(" @(" \061D7T5X<"!C;VYT96YT/2)M>4EN="MQ
M=VEF*BAS979E;G1Y<VEX*G at M*'DI*2(@='EP93TB3F]N5&5R;6EN86PB/@T*
M(" @(" @(" @(" @/$%D9%]%>' @8V]N=&5N=#TB;7E);G0B('1Y<&4](DYO
M;E1E<FUI;F%L(CX-"B @(" @(" @(" @(" @(" \375L=%]%>' @8V]N=&5N
M=#TB;7E);G0B('1Y<&4](DYO;E1E<FUI;F%L(CX-"B @(" @(" @(" @(" @
M(" @(" @/$YE9V%T95]%>' @8V]N=&5N=#TB;7E);G0B('1Y<&4](DYO;E1E
M<FUI;F%L(CX-"B @(" @(" @(" @(" @(" @(" @(" @(#Q686QU92!C;VYT
M96YT/2)M>4EN="(@='EP93TB3F]N5&5R;6EN86PB/@T*(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(#Q)9&5N=&EF:65R(&-O;G1E;G0](FUY26YT(B!T
M>7!E/2)497)M:6YA;"(@+SX-"B @(" @(" @(" @(" @(" @(" @(" @(#PO
M5F%L=64^#0H@(" @(" @(" @(" @(" @(" @(#PO3F5G871E7T5X<#X-"B @
M(" @(" @(" @(" @(" \+TUU;'1?17AP/@T*(" @(" @(" @(" @/"]!9&1?
M17AP/@T*(" @(" @(" @(" @/%!L=7, at 8V]N=&5N=#TB*R(@='EP93TB5&5R
M;6EN86PB("\^#0H@(" @(" @(" @(" \375L=%]%>' @8V]N=&5N=#TB<7=I
M9BHH<V5V96YT>7-I>"IX+2AY*2DB('1Y<&4](DYO;E1E<FUI;F%L(CX-"B @
M(" @(" @(" @(" @(" \375L=%]%>' @8V]N=&5N=#TB<7=I9B(@='EP93TB
M3F]N5&5R;6EN86PB/@T*(" @(" @(" @(" @(" @(" @(" \3F5G871E7T5X
M<"!C;VYT96YT/2)Q=VEF(B!T>7!E/2).;VY497)M:6YA;"(^#0H@(" @(" @
M(" @(" @(" @(" @(" @(" \5F%L=64 at 8V]N=&5N=#TB<7=I9B(@='EP93TB
M3F]N5&5R;6EN86PB/@T*(" @(" @(" @(" @(" @(" @(" @(" @(" @(#Q)
M9&5N=&EF:65R(&-O;G1E;G0](G%W:68B('1Y<&4](E1E<FUI;F%L(B O/@T*
M(" @(" @(" @(" @(" @(" @(" @(" @/"]686QU93X-"B @(" @(" @(" @
M(" @(" @(" @/"].96=A=&5?17AP/@T*(" @(" @(" @(" @(" @(#PO375L
M=%]%>' ^#0H@(" @(" @(" @(" @(" @/$%S=&5R:7-K(&-O;G1E;G0](BHB
M('1Y<&4](E1E<FUI;F%L(B O/@T*(" @(" @(" @(" @(" @(#Q.96=A=&5?
M17AP(&-O;G1E;G0](BAS979E;G1Y<VEX*G at M*'DI*2(@='EP93TB3F]N5&5R
M;6EN86PB/@T*(" @(" @(" @(" @(" @(" @(" \5F%L=64 at 8V]N=&5N=#TB
M*'-E=F5N='ES:7 at J>"TH>2DI(B!T>7!E/2).;VY497)M:6YA;"(^#0H@(" @
M(" @(" @(" @(" @(" @(" @(" \3&5F=%!A<F5N(&-O;G1E;G0](B at B('1Y
M<&4](E1E<FUI;F%L(B O/@T*(" @(" @(" @(" @(" @(" @(" @(" @/$5X
M<')E<W-I;VX at 8V]N=&5N=#TB<V5V96YT>7-I>"IX+2AY*2(@='EP93TB3F]N
M5&5R;6EN86PB/@T*(" @(" @(" @(" @(" @(" @(" @(" @(" @(#Q!9&1?
M17AP(&-O;G1E;G0](G-E=F5N='ES:7 at J>"TH>2DB('1Y<&4](DYO;E1E<FUI
M;F%L(CX-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @/$%D9%]%
M>' @8V]N=&5N=#TB<V5V96YT>7-I>"IX(B!T>7!E/2).;VY497)M:6YA;"(^
M#0H@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" \375L=%]%
M>' @8V]N=&5N=#TB<V5V96YT>7-I>"IX(B!T>7!E/2).;VY497)M:6YA;"(^
M#0H@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @/$UU
M;'1?17AP(&-O;G1E;G0](G-E=F5N='ES:7 at B('1Y<&4](DYO;E1E<FUI;F%L
M(CX-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @/$YE9V%T95]%>' @8V]N=&5N=#TB<V5V96YT>7-I>"(@='EP93TB3F]N
M5&5R;6EN86PB/@T*(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @/%9A;'5E(&-O;G1E;G0](G-E=F5N='ES:7 at B('1Y
M<&4](DYO;E1E<FUI;F%L(CX-"B @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" \261E;G1I9FEE<B!C;VYT96YT
M/2)S979E;G1Y<VEX(B!T>7!E/2)497)M:6YA;"(@+SX-"B @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(#PO5F%L=64^
M#0H@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(#PO3F5G871E7T5X<#X-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" \+TUU;'1?17AP/@T*(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(#Q!<W1E<FES:R!C;VYT96YT/2(J(B!T>7!E
M/2)497)M:6YA;"(@+SX-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" \3F5G871E7T5X<"!C;VYT96YT/2)X(B!T>7!E/2).;VY4
M97)M:6YA;"(^#0H@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(#Q686QU92!C;VYT96YT/2)X(B!T>7!E/2).;VY497)M:6YA
M;"(^#0H@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" \261E;G1I9FEE<B!C;VYT96YT/2)X(B!T>7!E/2)497)M:6YA
M;"(@+SX-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @/"]686QU93X-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" \+TYE9V%T95]%>' ^#0H@(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" \+TUU;'1?17AP/@T*(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" \+T%D9%]%>' ^#0H@(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(#Q-:6YU<R!C;VYT96YT/2(M(B!T>7!E/2)497)M
M:6YA;"(@+SX-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @/$UU
M;'1?17AP(&-O;G1E;G0](BAY*2(@='EP93TB3F]N5&5R;6EN86PB/@T*(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @/$YE9V%T95]%>' @
M8V]N=&5N=#TB*'DI(B!T>7!E/2).;VY497)M:6YA;"(^#0H@(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @/%9A;'5E(&-O;G1E;G0]
M(BAY*2(@='EP93TB3F]N5&5R;6EN86PB/@T*(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" \3&5F=%!A<F5N(&-O;G1E;G0]
M(B at B('1Y<&4](E1E<FUI;F%L(B O/@T*(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" \17AP<F5S<VEO;B!C;VYT96YT/2)Y
M(B!T>7!E/2).;VY497)M:6YA;"(^#0H@(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" \061D7T5X<"!C;VYT96YT/2)Y
M(B!T>7!E/2).;VY497)M:6YA;"(^#0H@(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @/$UU;'1?17AP(&-O;G1E
M;G0](GDB('1Y<&4](DYO;E1E<FUI;F%L(CX-"B @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @/$YE9V%T
M95]%>' @8V]N=&5N=#TB>2(@='EP93TB3F]N5&5R;6EN86PB/@T*(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @/%9A;'5E(&-O;G1E;G0](GDB('1Y<&4](DYO;E1E<FUI;F%L
M(CX-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" \261E;G1I9FEE<B!C;VYT96YT/2)Y
M(B!T>7!E/2)497)M:6YA;"(@+SX-"B @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(#PO5F%L=64^
M#0H@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(#PO3F5G871E7T5X<#X-"B @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" \+TUU;'1?17AP
M/@T*(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @/"]!9&1?17AP/@T*(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" \+T5X<')E<W-I;VX^#0H@(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(#Q2:6=H=%!A<F5N(&-O
M;G1E;G0](BDB('1Y<&4](E1E<FUI;F%L(B O/@T*(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(#PO5F%L=64^#0H@(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" \+TYE9V%T95]%>' ^#0H@(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(#PO375L=%]%>' ^#0H@(" @
M(" @(" @(" @(" @(" @(" @(" @(" @/"]!9&1?17AP/@T*(" @(" @(" @
M(" @(" @(" @(" @(" @/"]%>'!R97-S:6]N/@T*(" @(" @(" @(" @(" @
M(" @(" @(" @/%)I9VAT4&%R96X at 8V]N=&5N=#TB*2(@='EP93TB5&5R;6EN
M86PB("\^#0H@(" @(" @(" @(" @(" @(" @(#PO5F%L=64^#0H@(" @(" @
M(" @(" @(" @/"].96=A=&5?17AP/@T*(" @(" @(" @(" @/"]-=6QT7T5X
M<#X-"B @(" @(" @/"]!9&1?17AP/@T*(" @(#PO17AP<F5S<VEO;CX-"CPO
,4')O9W)A;3X-"@T*
`
end




More information about the Digitalmars-d mailing list