From d8783e7a7eaa8221143aef650ce32124418a6486 Mon Sep 17 00:00:00 2001 From: Syd Bauman Date: Thu, 4 Nov 2021 18:54:14 -0400 Subject: [PATCH 1/2] Tweaks to README that MSMcQ may or may not approve of --- README.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c797fa9..52b1c1d 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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. From 4f4b45c71c33921fbd1b73eac8d4823a6f8c9d8b Mon Sep 17 00:00:00 2001 From: Syd Bauman Date: Thu, 4 Nov 2021 19:12:49 -0400 Subject: [PATCH 2/2] =?UTF-8?q?More=20to=20show=20MSMcQ=20where=20some=20p?= =?UTF-8?q?roblems=20are=20than=20to=20be=20a=20real=20fix=20=E2=80=A6=20I?= =?UTF-8?q?=20suspect=20the=20real=20fix=20may=20have=20to=20be=20in=20the?= =?UTF-8?q?=20src/=20from=20which=20things=20are=20tangled=20and=20woven.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/Aparecium.xqm | 4 +--- build/Earley-parser-internals.xqm | 3 +-- demos/compile-a-grammar.xq | 4 ++-- demos/compile-ixml-grammar-manually.xq | 4 ++-- lib/test-harness-0.xq | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/build/Aparecium.xqm b/build/Aparecium.xqm index c34fc5c..8fd6ec8 100644 --- a/build/Aparecium.xqm +++ b/build/Aparecium.xqm @@ -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'; diff --git a/build/Earley-parser-internals.xqm b/build/Earley-parser-internals.xqm index cc3ee76..6785f32 100644 --- a/build/Earley-parser-internals.xqm +++ b/build/Earley-parser-internals.xqm @@ -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( diff --git a/demos/compile-a-grammar.xq b/demos/compile-a-grammar.xq index 2cce09b..6231db7 100644 --- a/demos/compile-a-grammar.xq +++ b/demos/compile-a-grammar.xq @@ -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) @@ -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' \ No newline at end of file + else 'Unknown option' diff --git a/demos/compile-ixml-grammar-manually.xq b/demos/compile-ixml-grammar-manually.xq index 2d4716e..8480aa0 100644 --- a/demos/compile-ixml-grammar-manually.xq +++ b/demos/compile-ixml-grammar-manually.xq @@ -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) \ No newline at end of file +return aparecium:compile-grammar-from-xml($xmlG/ixml) diff --git a/lib/test-harness-0.xq b/lib/test-harness-0.xq index 47e72dd..9fa023e 100644 --- a/lib/test-harness-0.xq +++ b/lib/test-harness-0.xq @@ -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',