Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ is a processor for invisible XML.

Eventually, Aparecium will be available in both XQuery and
XSLT forms; at this writing (November 2021) only XQuery is
available. The schedule for the XSLT version is 'real soon
now'.
available. The schedule for the XSLT version is real soon
now.

## Current status

Expand All @@ -32,23 +32,25 @@ grammar.
## How to use Aparecium to experiment with ixml

The easiest way to play around is to load one of the query modules
from the `demos` subdirectory into BaseX or Oxygen and
from the `demos/` subdirectory into BaseX or Oxygen and
evaluate the query, then modify it and evaluate it again.

There are several demos:

* `demo.date.xq` illustrates one of the date grammars from
Steven Pemberton's ixml tutorial on the first day of
Declarative Amsterdam.
* `demo.date.xq` illustrates one of the date grammars from Steven
Pemberton’s [ixml
tutorial](https://homepages.cwi.nl/~steven/ixml/tutorial/tutorial.xhtml)
on the first day of Declarative Amsterdam 2021.

You will see, if you inspect it, that the demo has three main parts:
first it imports the Aparecium module, then it creates an XML element
(named `demo`)
with one or more `grammar` elements
and one or more `test-input` elements, and finally it
returns the result of calling `aparecium:parse-string($i, $g)`
for each test-input `$i` and each grammar `$g`.

You can modify the grammar and/or the input and re-evaluate
You can modify the grammar or the input (or both) and re-evaluate
the query to see the effects of your changes.

* `demo.s-expressions.xq` shows a grammar for simple
Expand Down Expand Up @@ -148,10 +150,10 @@ element in the result, you will see something like this:
The highest value seen for the `item/@to` attribute tells you where in
the input the parser stopped thinking it understood what was going on.
Here, the two items say that the parser has managed to recognize the
string from position 0 to position 4 (so the first four characters of
the input) as some portion of a 'rule', and the string from 3 to 4 as
an 's', or part of an 's'. So the parse looked OK until position 4 of
string from position 0 to position 4 (so the first five characters of
the input) as some portion of a rule, and the string from 3 to 4 as
an ‘s’, or part of an ‘s’. So the parse looked OK until position 4 of
the input. Then it all turned pear-shaped.

It is possible to get better diagnostics out of the data structures,
and one day Aparecium will do so.
and one day Aparecium will do so. Real soon now.
4 changes: 1 addition & 3 deletions build/Aparecium.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ declare function aparecium:recompile-ixml-grammar() as element(ixml) {
****************************************************************
:)
declare variable $aparecium:libloc as xs:string
:= 'file://'
|| '/Users/cmsmcq/'
|| '2021/Aparecium/lib';
:= '../lib';
declare variable $aparecium:ixml.ixml as xs:string
:= $aparecium:libloc || '/ixml.2021-09-14.ixml';

Expand Down
3 changes: 1 addition & 2 deletions build/Earley-parser-internals.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ declare function epi:earley-parse(
then $pt
else epi:astXparsetree($pt, count($lpt)) :)
(: What an ugly hack! Clean this up! :)
let $logfn := '/Users/cmsmcq/'
|| '2021/Aparecium/tests/output/raw.'
let $logfn := '../tests/output/raw.'
|| translate(
string(
adjust-dateTime-to-timezone(
Expand Down
4 changes: 2 additions & 2 deletions demos/compile-a-grammar.xq
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ at "../build/Aparecium.xqm";
(: A way to make it a little easier to experiment. :)
let $option := ('parse', 'compile')[1]
let $grammar-fn := 'arith.ixml',
$output-fn := 'file:///Users/cmsmcq/2021/github/Aparecium/demos/'
$output-fn := '../demos/'
|| $grammar-fn || '.'
|| $option || 'd.xml',
$grammar := unparsed-text($grammar-fn)
Expand All @@ -18,4 +18,4 @@ return if ($option = 'parse')
else if ($option = 'compile')
then let $g2 := aparecium:compile-grammar-from-xml($g1)
return (file:write($output-fn, $g2), $g2)
else 'Unknown option'
else 'Unknown option'
4 changes: 2 additions & 2 deletions demos/compile-ixml-grammar-manually.xq
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import module
at "../build/Aparecium.xqm";


let $basedir := '/Users/cmsmcq/github/2021/Aparecium',
let $basedir := '..',
$libdir := $basedir || '/lib',
$fn := 'ixml.2021-09-14.ixml.xml',
$uri := 'file://' || $libdir || '/' || $fn
let $xmlG := doc($uri)
return aparecium:compile-grammar-from-xml($xmlG/ixml)
return aparecium:compile-grammar-from-xml($xmlG/ixml)
2 changes: 1 addition & 1 deletion lib/test-harness-0.xq
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import module

let $fVerbose := ('always', 'never', 'failure')[1]

let $basedir := '/Users/cmsmcq/2021/Aparecium',
let $basedir := '..',
$builddir := $basedir || '/build',
$testindir := $basedir || '/tests',
$testoutdir := $testindir || '/output',
Expand Down