View mode: basic / threaded / horizontal-split · Log in · Help
January 10, 2009
OT: Less-restrictive alternative to XML and XML visualizers?
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?
January 10, 2009
Re: OT: Less-restrictive alternative to XML and XML visualizers?
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.
January 10, 2009
Re: OT: Less-restrictive alternative to XML and XML visualizers?
"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.
January 10, 2009
Re: OT: Less-restrictive alternative to XML and XML visualizers?
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.
January 10, 2009
Re: OT: Less-restrictive alternative to XML and XML visualizers?
"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.
January 10, 2009
Re: OT: Less-restrictive alternative to XML and XML visualizers?
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
January 10, 2009
Re: OT: Less-restrictive alternative to XML and XML visualizers?
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.
January 10, 2009
Re: OT: Less-restrictive alternative to XML and XML visualizers?
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)
January 15, 2009
Re: OT: Less-restrictive alternative to XML and XML visualizers?
"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.

If anyone's interested, I've hacked up that JsonViewer (C#, not D, 
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
Top | Discussion index | About this forum | D home