Corrections to preserves-schema host-type generation; extract host-type schema
This commit is contained in:
parent
897fc13054
commit
c411e47d7f
|
@ -4,7 +4,7 @@ title: "Preserves Schema"
|
|||
---
|
||||
|
||||
Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||
October 2023. Version 0.3.4.
|
||||
December 2023. Version 0.3.5.
|
||||
|
||||
[abnf]: https://tools.ietf.org/html/rfc7405
|
||||
[identifierlike]: #sufficiently-identifierlike-values
|
||||
|
@ -470,7 +470,7 @@ The host-language types corresponding to a metaschema instance can
|
|||
themselves be described according to a grammar.
|
||||
|
||||
The definitions in this section should be understood as being part of a
|
||||
module named `host`, in a bundle alongside a module named `schema`
|
||||
module named [`host`](schema/host.prs), in a bundle alongside a module named `schema`
|
||||
corresponding to the metaschema in the appendix below.
|
||||
|
||||
#### Abstract host language types
|
||||
|
@ -555,7 +555,8 @@ patterns, **product**{:.pseudocode} yields `unit` type itself.
|
|||
> **gather** `<tuple [`*f`1` .. f`n`*`]>` = **gather** *f`1`* ⧺ ⋯ ⧺ **gather** *f`n`*
|
||||
> **gather** `<tuplePrefix [`*f`1` ... f`n`*`]` *f`repeated`*`>` = **gather** *f`1`* ⧺ ⋯ ⧺ **gather** *f`n`* ⧺ **gather** *f`repeated`*
|
||||
> **gather** `<dict {`*v`1`*`:`*f`1` ... v`n`*`:`*f`n`*`}>` = **gather** *f`1`′* ⧺ ⋯ ⧺ **gather** *f`n`′*,
|
||||
> where (*f`1`′ ⋯ f`n`′*) are (*f`1` ⋯ f`n`*) sorted according to [Preserves term order](./preserves.html#total-order).
|
||||
> where (*f`1`′ ⋯ f`n`′*) are the *f`i`* sorted by [Preserves term order](./preserves.html#total-order) of the corresponding *v`i`*.
|
||||
> **gather** *s* = `[]`, when *s* ∈ `schema.SimplePattern`.
|
||||
|
||||
## Appendix: Metaschema
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
all: schema.bin
|
||||
all: schema.bin host.bin
|
||||
|
||||
schema.bin: schema.prs
|
||||
../implementations/javascript/packages/schema-cli/bin/preserves-schemac.js --no-bundle .:schema.prs > $@.tmp || (rm -f $@.tmp; false)
|
||||
%.bin: %.prs
|
||||
../implementations/javascript/packages/schema-cli/bin/preserves-schemac.js --no-bundle .:$< > $@.tmp || (rm -f $@.tmp; false)
|
||||
mv $@.tmp $@
|
||||
|
||||
clean:
|
||||
rm -f schema.bin
|
||||
rm -f schema.bin host.bin
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
´³schema·³version°³definitions·³Field´³orµµ±unit´³lit³unit„„µ±any´³lit³any„„µ±embedded´³lit³embedded„„µ±array´³rec´³lit³array„´³tupleµ´³named³element´³refµ„³Field„„„„„„µ±set´³rec´³lit³set„´³tupleµ´³named³element´³refµ„³Field„„„„„„µ±map´³rec´³lit³map„´³tupleµ´³named³key´³refµ„³Field„„´³named³value´³refµ„³Field„„„„„„µ±ref´³rec´³lit³ref„´³tupleµ´³named³name´³refµ³schema„³Ref„„„„„„µ±AtomKind´³refµ³schema„³AtomKind„„„„³Record´³rec´³lit³rec„´³tupleµ´³named³fields´³seqof´³refµ„³
|
||||
NamedField„„„„„„³Simple´³orµµ±Field´³refµ„³Field„„µ±Record´³refµ„³Record„„„„³Variant´³tupleµ´³named³label´³atom³Symbol„„´³named³type´³refµ„³Simple„„„„³
|
||||
Definition´³orµµ±union´³rec´³lit³union„´³tupleµ´³named³variants´³seqof´³refµ„³Variant„„„„„„„µ±Simple´³refµ„³Simple„„„„³
|
||||
NamedField´³tupleµ´³named³name´³atom³Symbol„„´³named³type´³refµ„³Field„„„„„³embeddedType€„„
|
|
@ -0,0 +1,19 @@
|
|||
version 1 .
|
||||
|
||||
Definition = <union @variants [Variant ...]> / Simple .
|
||||
Variant = [@label symbol @type Simple] .
|
||||
|
||||
Simple = Field / Record .
|
||||
Record = <rec @fields [NamedField ...]> .
|
||||
NamedField = [@name symbol @type Field] .
|
||||
|
||||
Field =
|
||||
/ =unit
|
||||
/ =any
|
||||
/ =embedded
|
||||
/ <array @element Field>
|
||||
/ <set @element Field>
|
||||
/ <map @key Field @value Field>
|
||||
/ <ref @name schema.Ref>
|
||||
/ schema.AtomKind
|
||||
.
|
Loading…
Reference in New Issue