FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Progress

 
Post new topic   Reply to topic     Forum Index -> DSP
View previous topic :: View next topic  
Author Message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Wed Aug 11, 2004 2:09 pm    Post subject: Progress Reply with quote

Sometimes it feels like I'm developing this software in geologic time. For those of you who have been waiting for a release, it's been painful for me as well.

The most recent hangup has been working with the servlet parser, which is arguably the very heart-and-soul of DSP. In the spirit of the original design, it has been abstracted out the wazoo to allow for other parsers to be built on top of it. This is going to be a key feature, when DSP moves away from .ini files for application configs and focus on xml-based configurations instead. So I've taken my time to make sure that I back a good, solid design that won't cause trouble any time soon.

Ultimately the parser works with a set of tokens to search for, and "tags" that they correspond to. Each tag has several overridden methods that are used during different phases of parsing that particular tag, to generate and filter content as it is passed in by the parser. That content is in turn passed onto several named buckets that are used in a second-pass to generate the output file.

What sets this version apart from its predecessor is that tags can (now) define what its child tags are. In the case of a <dsp:code> tag, it only defines <[CDATA[...]]>, text and {inline code} expressions as being sensitive to the parser..

Furthermore, the design also supports XML-like tags, subtitutions and inline statements all within the same scope.

Overally the parser is pretty much done, and I'm moving through a test phase to make sure that its generating good output. I also have a whole suite of interesting Mango parsers that have fallen out of the design. The most notable of which is the StringSet parser; this is what makes the DSP parser tick.

The next steps are to revisit servlet compilation and the library cache, followed by meshing that, the parser and the custom mango engine together. [/i]
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Wed Aug 11, 2004 3:17 pm    Post subject: Reply with quote

Woohoo!

Looking forward to trying it out. Those parsers sound useful too! Note that Stonecobra is working on an XML parser, and Chris S is apparently building a DOM-style API.
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Wed Aug 11, 2004 4:23 pm    Post subject: Reply with quote

kris wrote:
Woohoo!

Looking forward to trying it out. Those parsers sound useful too! Note that Stonecobra is working on an XML parser, and Chris S is apparently building a DOM-style API.


Outstanding! We could use a good D-native XML parser, as DSP's parser isn't really up to the task. Sad

The DSP parser *could* handle true XML, but parsing XML-like tags is about all it has in common with an XML parser. Its really more of a compromise of several parser types, leaning more towards explicit parsing of known tokens rather than a freely formatted file.

Here's a crude BNF for how it sees an input file, so you can see what I'm talking about:

Code:

file ::= entities
entities ::= null | entity | entity entities
entity ::= tag | text-entity
text-entity ::= null | char | char text-entity
tag ::= start-token |
           start-token attribute-text end-close-token |
           start-token attribute-text close-token entities end-token
start-token ::= text-entity
close-token ::= text-entity
end-close-token ::= text-entity
end-token ::= text-entity
attribute-text ::= null | text-entity | attribute-list
attribute-list ::= attribute | attribute attribute-list
attribute ::= attribute-name "=" attribute-value
attribute-name ::= text-entity
attribute-value ::= "\'" text-entity "\'" | "\"" text-entity "\""


At first glance it looks like an XML parser, until you look at the def for 'tag'. A tag is defined by one, two or three tokens where the text in between is treated rather arbitrarily. The parser needs to know all the start-tokens ahead of time, and treats everything else as plain text.

Ultimately I did this so people could use DSP to cut-across non-DSP tags if they didn't care about their scripts being XML-compliant:

Code:
<img src="<dsp:output>{getPath("images")}foo.jpg</dsp:output>"/>


Kris,
I have DspServletContext loading application.ini on load, as sort of an .htaccess-like config that also sets the various parameters needed to compile DSP servlets. Perhaps this kind of feature might be better served in Mango itself, by a generic "application.xml" on a per-context basis....?
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Wed Aug 11, 2004 4:34 pm    Post subject: Reply with quote

pragma wrote:
Kris, I have DspServletContext loading application.ini on load, as sort of an .htaccess-like config that also sets the various parameters needed to compile DSP servlets. Perhaps this kind of feature might be better served in Mango itself, by a generic "application.xml" on a per-context basis....?

Absolutely it would. I've held off on doing that until the XML parser was available. When it's operational I'll add a Context method to accept some kind of "ini file" adaptor (so it's loosly coupled: XML or text; file or socket; etc). Does that sound like it would meet your needs?

- Kris
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Wed Aug 11, 2004 5:32 pm    Post subject: Reply with quote

kris wrote:
I've held off on doing that until the XML parser was available. When it's operational I'll add a Context method to accept some kind of "ini file" adaptor (so it's loosly coupled: XML or text; file or socket; etc). Does that sound like it would meet your needs?

- Kris


That would work well. When you add that, I think it would be great to get a thread going over on the Mango board about a baseline application.xml format so we're all on the same page. Smile

- Eric
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Wed Aug 11, 2004 7:49 pm    Post subject: Reply with quote

Sounds like a plan!

When the time is right, perhaps you'll submit the schema used by Dsp as the baseline format?
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Mon Aug 16, 2004 5:28 pm    Post subject: Reply with quote

kris wrote:
Sounds like a plan!

When the time is right, perhaps you'll submit the schema used by Dsp as the baseline format?


NP. When I finally work the kinks out of this iteration, It'll be the first of many contributions to mango I have planned.
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DSP All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group