summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/pgf.schema.json
diff options
context:
space:
mode:
authorJohn J. Camilleri <john@digitalgrammars.com>2019-07-07 17:35:31 +0200
committerJohn J. Camilleri <john@digitalgrammars.com>2019-07-07 17:35:31 +0200
commitcb88b56016f8517ab6d370c3862924f3db806e95 (patch)
treeb253754d38d75f3af8f732a8fa4b50b55a372845 /src/compiler/GF/Compile/pgf.schema.json
parentecf9b41db0a058a0477a6f19fba1ba30ca6643c3 (diff)
Finish compile to PGF JSON, including JSON schema for resulting format.
Diffstat (limited to 'src/compiler/GF/Compile/pgf.schema.json')
-rw-r--r--src/compiler/GF/Compile/pgf.schema.json232
1 files changed, 232 insertions, 0 deletions
diff --git a/src/compiler/GF/Compile/pgf.schema.json b/src/compiler/GF/Compile/pgf.schema.json
new file mode 100644
index 000000000..2ad1d5442
--- /dev/null
+++ b/src/compiler/GF/Compile/pgf.schema.json
@@ -0,0 +1,232 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "http://grammaticalframework.org/pgf.schema.json",
+ "type": "object",
+ "title": "PGF JSON Schema",
+ "required": [
+ "abstract",
+ "concretes"
+ ],
+ "properties": {
+ "abstract": {
+ "type": "object",
+ "required": [
+ "name",
+ "startcat",
+ "funs"
+ ],
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "startcat": {
+ "type": "string"
+ },
+ "funs": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object",
+ "required": [
+ "args",
+ "cat"
+ ],
+ "properties": {
+ "args": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "cat": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "concretes": {
+ "type": "object",
+ "additionalProperties": {
+ "required": [
+ "flags",
+ "productions",
+ "functions",
+ "sequences",
+ "startCats",
+ "totalFIds"
+ ],
+ "properties": {
+ "flags": {
+ "type": "object",
+ "additionalProperties": {
+ "type": ["string", "number"]
+ }
+ },
+ "productions": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/apply"
+ },
+ {
+ "$ref": "#/definitions/coerce"
+ }
+ ]
+ }
+ }
+ },
+ "functions": {
+ "type": "array",
+ "items": {
+ "title": "CncFun",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "lins": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ }
+ }
+ },
+ "sequences": {
+ "type": "array",
+ "items": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/sym"
+ }
+ }
+ },
+ "startCats": {
+ "type": "object",
+ "additionalProperties": {
+ "title": "CncCat",
+ "type": "object",
+ "required": [
+ "s",
+ "e"
+ ],
+ "properties": {
+ "s": {
+ "type": "integer"
+ },
+ "e": {
+ "type": "integer"
+ }
+ }
+ }
+ },
+ "totalFIds": {
+ "type": "integer"
+ }
+ }
+ }
+ }
+ },
+ "definitions": {
+ "apply": {
+ "required": [
+ "type",
+ "fid",
+ "args"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": ["Apply"]
+ },
+ "fid": {
+ "type": "integer"
+ },
+ "args": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/parg"
+ }
+ }
+ }
+ },
+ "coerce": {
+ "required": [
+ "type",
+ "arg"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": ["Coerce"]
+ },
+ "arg": {
+ "type": "integer"
+ }
+ }
+ },
+ "parg": {
+ "required": [
+ "type",
+ "hypos",
+ "fid"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": ["PArg"]
+ },
+ "hypos": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ },
+ "fid": {
+ "type": "integer"
+ }
+ }
+ },
+ "sym": {
+ "title": "Sym",
+ "required": [
+ "type",
+ "args"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "SymCat",
+ "SymLit",
+ "SymVar",
+ "SymKS",
+ "SymKP",
+ "SymNE"
+ ]
+ },
+ "args": {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "integer"
+ },
+ {
+ "$ref": "#/definitions/sym"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file