[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Feasibility of "do all application coding in the XML languages"?
- From: "Dimitre Novatchev" <dnovatchev@gmail.com>
- To: "Rushforth, Peter" <Peter.Rushforth@nrcan-rncan.gc.ca>
- Date: Wed, 3 Dec 2008 09:42:24 -0800
On Wed, Dec 3, 2008 at 6:58 AM, Rushforth, Peter
<Peter.Rushforth@nrcan-rncan.gc.ca> wrote:
> Dimitre,
>
> I have to confess even after reading the code, I don't understand it.
>
> Can you supply an example invocation using a simple input example,
> and expected output?
>
> I am definitely interested in anything that helps broaden the
> possible inputs to XSLT!
>
Peter,
Sometimes ago I posted to the xsl-list this short description of the
arguments to f:lr-parse(). It can be found here:
http://biglist.com/lists/xsl-list/archives/200711/msg00642.html
You can play with a small example located at:
http://fxsl.cvs.sourceforge.net/viewvc/fxsl/fxsl-xslt2/Tests/TestFunc-lrParse.xsl?view=markup&sortby=file
In this example, the parser is invoked with this code snippet:
11 <xsl:variable name="vsimpleExprPPTables" select=
12 "document('../data/simpleExprParseTables.xml')/*"/>
13
14 <xsl:template match="/">
15 <xsl:sequence select=
16 "f:lrParse($vsimpleExprPPTables,
17 '3 + 4*5 - (7%3)',
18 f:lexer-simpleExpr(),
19 f:OnSimpleExprRuleReduced()
20 )
21 /computedValue/node()
22 "
23 />
24 </xsl:template>
and the result from the transformation is: 22
The parse tables, which the general LR parser needs are located at
'../data/simpleExprParseTables.xml'. They are generated with the YACCX
tool (available on the FXSL project downloads at:
http://fxsl.cvs.sourceforge.net/viewvc/fxsl/fxsl-xslt2/Tools/YACCX/?sortby=file
),
which is just YACC, extended to generate its output as XML.
Two other, very big examples are the current parsers for JSON (as used
in the f:json-document() function and the XPath 2.0 parser)
I would be glad to assist you in producing your own parsers.
--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
> Cheers,
> Peter
>
>> -----Original Message-----
>> From: Dimitre Novatchev [mailto:dnovatchev@gmail.com]
>> Sent: December 2, 2008 11:57 PM
>> To: Rushforth, Peter
>> Cc: xml-dev@lists.xml.org; Costello, Roger L.
>> Subject: Re: [xml-dev] Feasibility of "do all application
>> coding in the XML languages"?
>>
>> On Tue, Dec 2, 2008 at 7:23 AM, Rushforth, Peter
>> <Peter.Rushforth@nrcan-rncan.gc.ca> wrote:
>>
>> > I think there's a lot of value in such interfaces. It
>> would be nice
>> > if it didn't involve having to write a parser each time,
>> but the cost
>> > is not too high, I think
>>
>> The cost is not high, especially if one uses a general and
>> portable native XSLT 2.0 parser writing tool, such as the
>> LR(1) Parsing Framework of FXSL,
>>
>>
>> http://fxsl.cvs.sourceforge.net/viewvc/fxsl/fxsl-xslt2/f/func-
>> lrParse.xsl?revision=1.7&view=markup&sortby=date
>>
>>
>>
>> --
>> Cheers,
>> Dimitre Novatchev
>> ---------------------------------------
>> Truly great madness cannot be achieved without significant
>> intelligence.
>> ---------------------------------------
>> To invent, you need a good imagination and a pile of junk
>> -------------------------------------
>> Never fight an inanimate object
>> -------------------------------------
>> You've achieved success in your field when you don't know
>> whether what you're doing is work or play
>>
>
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]