www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - OT: Less-restrictive alternative to XML and XML visualizers?

reply "Nick Sabalausky" <a a.a> writes:
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? 
Jan 09 2009
next sibling parent reply BCS <ao pathlink.com> writes:
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.
Jan 09 2009
parent reply "Nick Sabalausky" <a a.a> writes:
"BCS" <ao pathlink.com> wrote in message 
news:78ccfa2d386e88cb409b20ef38c6 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 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 M*'DI*2( ='EP93TB3F]N M5&5R;6EN86PB/ T*(" (" (" \061D7T5X<"!C;VYT96YT/2)M>4EN="MQ M=VEF*BAS979E;G1Y<VEX*G 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 M(" (" (" (" (" \+TUU;'1?17AP/ T*(" (" (" (" /"]!9&1? M17AP/ T*(" (" (" (" /%!L=7, 8V]N=&5N=#TB*R( ='EP93TB5&5R 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(" (" (" (" (" (" \5F%L=64 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('1Y<&4](E1E<FUI;F%L(B O/ T*(" (" (" (" (" (#Q.96=A=&5? M17AP(&-O;G1E;G0](BAS979E;G1Y<VEX*G M*'DI*2( ='EP93TB3F]N5&5R M;6EN86PB/ T*(" (" (" (" (" (" (" \5F%L=64 8V]N=&5N=#TB M(" (" (" (" (" (" (" \3&5F=%!A<F5N(&-O;G1E;G0](B B('1Y M<&4](E1E<FUI;F%L(B O/ T*(" (" (" (" (" (" (" (" /$5X M<')E<W-I;VX 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 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>' 8V]N=&5N=#TB<V5V96YT>7-I>"IX(B!T>7!E/2).;VY497)M:6YA;"(^ M;'1?17AP(&-O;G1E;G0](G-E=F5N='ES:7 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 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(#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 M(" (" (" (#Q686QU92!C;VYT96YT/2)X(B!T>7!E/2).;VY497)M:6YA M(" (" (" \261E;G1I9FEE<B!C;VYT96YT/2)X(B!T>7!E/2)497)M:6YA M;"( +SX-"B (" (" (" (" (" (" (" (" (" (" (" (" M(" (" /"]686QU93X-"B (" (" (" (" (" (" (" (" (" M(" (" (" (" (" (" \+TUU;'1?17AP/ T*(" (" (" (" (" 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 M(" (" (" (" (" (" (" (" (" (" /%9A;'5E(&-O;G1E;G0] M(BAY*2( ='EP93TB3F]N5&5R;6EN86PB/ T*(" (" (" (" (" (" M(" (" (" (" (" (" (" (" (" \3&5F=%!A<F5N(&-O;G1E;G0] M(B B('1Y<&4](E1E<FUI;F%L(B O/ T*(" (" (" (" (" (" (" M(" (" (" (" (" (" (" (" \17AP<F5S<VEO;B!C;VYT96YT/2)Y M(" (" (" (" (" (" (" (" (" \061D7T5X<"!C;VYT96YT/2)Y 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(" (" (" (" (#PO3F5G871E7T5X<#X-"B (" (" (" (" (" M(" (" (" (" (" (" (" (" (" (" (" (" \+TUU;'1?17AP M/ T*(" (" (" (" (" (" (" (" (" (" (" (" (" (" M(" (" /"]!9&1?17AP/ T*(" (" (" (" (" (" (" (" (" M(" (" (" (" (" (" (" (" (" (" (#Q2:6=H=%!A<F5N(&-O M;G1E;G0](BDB('1Y<&4](E1E<FUI;F%L(B O/ T*(" (" (" (" (" M(" (" (" (" (" (" (" (" (#PO5F M(" (" (" (" (" (" (" (" (" (#PO375L M(" (" (" (" (" (" (" (" /"]!9&1?17AP/ T*(" (" (" M(" (" (" (" (" /"]%>'!R97-S:6]N/ T*(" (" (" (" (" M(" (" (" /%)I9VAT4&%R96X 8V]N=&5N=#TB*2( ='EP93TB5&5R;6EN 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
Jan 09 2009
parent reply BCS <ao pathlink.com> writes:
Reply to Nick,

 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.
Our stuff would be a little weak on the rendering side (it's extensable enought to fix that but it would involve a little work) Take a look at YAML if it looks like it might be intereting to you our stuff might as well. If you're intereted send my your email.
Jan 10 2009
parent BCS <ao pathlink.com> writes:
Reply to Benjamin,

 Reply to Nick,
 
 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.
 
Our stuff would be a little weak on the rendering side (it's extensable enought to fix that but it would involve a little work) Take a look at YAML if it looks like it might be intereting to you our stuff might as well. If you're intereted send my your email.
my address is: benjamin (at sign) precision software. us (scrub spaces)
Jan 10 2009
prev sibling parent reply Christopher Wright <dhasenan gmail.com> writes:
Nick Sabalausky wrote:
 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? 
JSON strings are a lot less restrictive than XML strings. If that's your main requirement, JSON will probably serve.
Jan 09 2009
parent reply "Nick Sabalausky" <a a.a> writes:
"Christopher Wright" <dhasenan gmail.com> wrote in message 
news:gk99av$atd$1 digitalmars.com...
 Nick Sabalausky wrote:
 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?
JSON strings are a lot less restrictive than XML strings. If that's your main requirement, JSON will probably serve.
Just looked at the JSON example on Wikipedia, I'm impressed so far. It seems to fix the main syntactical complaints I have with XML (overly verbose, limitations on names). There seems to be a decent opensource viewer here: http://www.codeplex.com/JsonViewer I don't suppose you know of a general-use tool that would let me provide a text file and a tree (JSON, XML, or anything else) that describes a particular parsing of the text file (obviously including indicies into the original text file for each node, or something like that) and lets you select one thing on one side and have it highlight the corresponding portion on the other side? Ie, like this: Source Frame: (Quotes indicate the selection) (1 + "(2 * 3)") % 4 Tree Frame: (Quotes indicate the selection) % |-- + | |-- 1 | |-- "*" | | |-- 2 | | |-- 3 |-- 4 Then again, that could be a good exercise for trying out DWT.
Jan 09 2009
next sibling parent Bill Baxter <wbaxter gmail.com> writes:
On Sat, Jan 10, 2009 at 2:51 PM, Nick Sabalausky <a a.a> wrote:
 I don't suppose you know of a general-use tool that would let me provide a
 text file and a tree (JSON, XML, or anything else) that describes a
 particular parsing of the text file (obviously including indicies into the
 original text file for each node, or something like that) and lets you
 select one thing on one side and have it highlight the corresponding portion
 on the other side?  Ie, like this:

 Source Frame: (Quotes indicate the selection)
 (1 + "(2 * 3)") % 4

 Tree Frame: (Quotes indicate the selection)
 %
 |-- +
 |   |-- 1
 |   |-- "*"
 |   |   |-- 2
 |   |   |-- 3
 |-- 4

 Then again, that could be a good exercise for trying out DWT.
Just don't try it out with DWT 1.038 or 1.039! 1.037 looks to be what you gotta stick with if you want DWT. --bb
Jan 09 2009
prev sibling parent "Nick Sabalausky" <a a.a> writes:
"Nick Sabalausky" <a a.a> wrote in message 
news:gk9cvv$gav$1 digitalmars.com...
 "Christopher Wright" <dhasenan gmail.com> wrote in message 
 news:gk99av$atd$1 digitalmars.com...
 Nick Sabalausky wrote:
 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?
JSON strings are a lot less restrictive than XML strings. If that's your main requirement, JSON will probably serve.
Just looked at the JSON example on Wikipedia, I'm impressed so far. It seems to fix the main syntactical complaints I have with XML (overly verbose, limitations on names). There seems to be a decent opensource viewer here: http://www.codeplex.com/JsonViewer I don't suppose you know of a general-use tool that would let me provide a text file and a tree (JSON, XML, or anything else) that describes a particular parsing of the text file (obviously including indicies into the original text file for each node, or something like that) and lets you select one thing on one side and have it highlight the corresponding portion on the other side? Ie, like this: Source Frame: (Quotes indicate the selection) (1 + "(2 * 3)") % 4 Tree Frame: (Quotes indicate the selection) % |-- + | |-- 1 | |-- "*" | | |-- 2 | | |-- 3 |-- 4 Then again, that could be a good exercise for trying out DWT.
unfortunatly) to do just what I've described above. Should come in handy for anyone developing language-related tools. http://www.semitwist.com/download/parseproject.zip
Jan 15 2009