I think it would be useful if you could post the reparser stuff.

I think it would be really cool if we could parse the xml in a lazy fashion
so that the entire tree might not come into memory at once.

i.e.

let x=parse xml
in
        (y,z)=processXml(someAlgebra,x)




like the circular rep-min problem.  I do not know if this will be viable
with the combinator libraries.  I am still working on my xpath parser.









This might be of interest to you.  http://www.w3.org/Math/








> -----Original Message-----
> From: Theodore Norvell [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 25, 2000 10:56 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: combinator parser and XSLT
> 
> 
> 
> Doug:
> 
> Thanks for your reply.
> 
> I think I have a similar problem to yours.  XML only provides the
> skeleton of the language but there are structural aspects that the XML
> tags do not express.  The language I'm parsing is essentially
> a language of mathematical expressions, so you might see
> 
>       a+<fraction><denominator>c+d</denominator>
>                   <numerator>e+f</numerator>
>         </fraction>+g
> 
> The way I'm doing this is to use XMLLib's parser to create a tree 
> (a "document object") and then using a parsing monad to 
> "reparse" the tree
> of strings into a full abstract syntax tree.  Since most 
> combinator parser
> systems and monadic parser systems expect their inputs to be 
> strings rather
> than lists of trees, I had to write my own Monad; but that 
> wasn't so hard.  For
> example, there is a combinator
>       (<?>) :: String -> (Reparser a) -> (Reparser a)
> which can be used thusly:
> 
> parseFraction = -- Succeeds only if the next content item is a
>               -- well formed fraction element.
>       "fraction" <?> (do d <- parseDenominator
>                          n <- parseNumerator
>                          endP -- ensure no spurious content 
> in the element
>                          return (Fraction d n) )
> 
> I'd be happy to send you the reparsing monad, if you like.  I wrote it
> a while ago, so it may not be compatible with the latest version
> of XMLLib (HaXml?). Unlike Daan and Manual, I'm unable to 
> claim that it is
> adequately documented or efficient.
> 
> To answer Chris's question. One could easily use this reparsing
> monad to flatten the tree into a sequence of SAX tokens.  How lazy it
> would be depend on the underlying XML parser.
> 
> Cheers,
> Theodore Norvell
> 
> ----------------------------
> Dr. Theodore Norvell                                    
> [EMAIL PROTECTED]
> Electrical and Computer Engineering         
> http://www.engr.mun.ca/~theo
> Engineering and Applied Science                    Phone: 
> (709) 737-8962
> Memorial University of Newfoundland                  Fax: 
> (709) 737-4042
> St. John's, NF, Canada, A1B 3X5
> 

Reply via email to