json-model-compiler 2.0.61__tar.gz → 2.0.63__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/BACKLOG.md +4 -8
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/BENCH.md +9 -6
- json_model_compiler-2.0.63/COMP.md +75 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/DOC.md +4 -2
- {json_model_compiler-2.0.61/json_model_compiler.egg-info → json_model_compiler-2.0.63}/PKG-INFO +1 -1
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/SPEC.md +5 -2
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/VERSION.md +36 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/about.sh +1 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/bench.sh +6 -3
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/analyze.py +5 -3
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/clang.py +9 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/convert.py +6 -0
- json_model_compiler-2.0.63/json_model/data/VERSION +1 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/javascript_exe.js +0 -1
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/jmc.pod +22 -0
- json_model_compiler-2.0.63/json_model/irep.py +624 -0
- json_model_compiler-2.0.61/json_model/irep.py → json_model_compiler-2.0.63/json_model/iroptim.py +2 -632
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/java.py +9 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/javascript.py +16 -2
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/language.py +25 -2
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/objops.py +2 -2
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/optim.py +64 -8
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/perl.py +9 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/plpgsql.py +10 -1
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/predefs.py +2 -1
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/python.py +9 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/pom.xml +3 -3
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/script.py +15 -7
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/utils.py +6 -13
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/xstatic.py +44 -104
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63/json_model_compiler.egg-info}/PKG-INFO +1 -1
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/SOURCES.txt +2 -0
- json_model_compiler-2.0.61/json_model/data/VERSION +0 -1
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/.github/workflows/docs.yml +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/.github/workflows/sanity.yml +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/.gitignore +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/.gitmodules +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/API.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/DESIGN.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/DEV.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/HOWTO.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/INTEGRATION.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/MANIFEST.in +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/Makefile +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/PUBS.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/README.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/TUTO.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/README.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/__init__.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/clang_entry.c +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/clang_free.c +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/clang_init.c +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/clang_pcre2_fun.c +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/clang_re2_fun.c +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/java_free.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/java_init.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/javascript_foot.js +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/javascript_free.js +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/javascript_head.js +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/javascript_init.js +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/javascript_main.js +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/perl_entry.pl +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/perl_exe.pl +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/perl_free.pl +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/perl_init.pl +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/perl_main.pl +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/perl_pkg.pl +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/plpgsql_entry.sql +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/python_entry.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/python_exe.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/python_free.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/python_init.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/data/python_main.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/export.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/model.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/mtypes.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/recurse.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/regex.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/resolver.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/Makefile +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/__init__.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/c/Makefile +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/c/json-model.c +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/c/json-model.h +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/c/main.c +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/.gitignore +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/Makefile +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/README.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/env.sh +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Checker.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/GSON.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/JSON.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/JSONP.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Jackson.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Main.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/ModelChecker.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Path.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Report.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Runtime.java +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/js/README.md +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/js/index.js +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/js/main.js +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/js/package.json +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/.gitignore +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/Changes +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/LICENSE +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/MANIFEST +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/Makefile.PL +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/README +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/env.sh +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/ignore.txt +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/lib/JSON/JsonModel.pm +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/t/00-load.t +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/t/manifest.t +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/t/pod-coverage.t +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/t/pod.t +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/pl/xt/boilerplate.t +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/sql/META.json +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/sql/Makefile +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/sql/json_model--2.0.sql +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/sql/json_model.control +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/support.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/runtime/types.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/submodel.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/ts_export.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model/url_cache.py +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/dependency_links.txt +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/entry_points.txt +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/not-zip-safe +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/requires.txt +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/top_level.txt +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/package.json +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/pyproject.toml +0 -0
- {json_model_compiler-2.0.61 → json_model_compiler-2.0.63}/setup.cfg +0 -0
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Current Tasks
|
|
4
4
|
|
|
5
|
-
- [ ]
|
|
5
|
+
- [ ] java-runtime: consider automatic updates?
|
|
6
|
+
- [ ] bench: re-build corvus image automatically
|
|
7
|
+
- [ ] bench: run cron bench with corvus (wip)
|
|
8
|
+
- [ ] pr: improve compiler page, list and describe optimizations?
|
|
6
9
|
- [ ] bench: better count should ignore bads
|
|
7
10
|
- [ ] bench: handle case failures for radar (wip, ajv handling)
|
|
8
11
|
- [ ] bench: collect error runs?
|
|
9
|
-
- [ ] bench: add corvus reference?
|
|
10
12
|
- [ ] bench: add stddev performance computation
|
|
11
13
|
- [ ] bench: improve resilience to bad overhead estimation
|
|
12
|
-
- [ ] bench: add case names to generated radar
|
|
13
14
|
- [ ] bench: collect JSON parse times for comparison with validation times
|
|
14
15
|
- [ ] export: generate a [katydid](https://katydid.github.io/) expression, for a compatible subset
|
|
15
16
|
- [ ] pr: add _known limitations_ stuff
|
|
@@ -22,15 +23,12 @@
|
|
|
22
23
|
- [ ] static: check for common object part?
|
|
23
24
|
- [ ] front: generate valid minimal, maximal and random values from a model
|
|
24
25
|
- [ ] front: generate invalid minimal values from a model
|
|
25
|
-
- [ ] optim: simplify some '!=' cases
|
|
26
26
|
- [ ] optim: collect and display stats about what works
|
|
27
27
|
- [ ] spec: allow to _remove_ definitions, eg `{ "$stuff": {"/": "$foo"}}`
|
|
28
28
|
- [ ] spec: restrict regex syntax to a smaller subset
|
|
29
|
-
- [ ] perf: add another loop over performance collection?
|
|
30
29
|
- [ ] perf: drop and/or merge identical results when comparing
|
|
31
30
|
- [ ] backend: check `mv-34/mu` test case which may require some utf normalization
|
|
32
31
|
- [ ] runtime: count graphemes instead of characters? for Java, see `java.text.BreakIterator`
|
|
33
|
-
- [ ] pr: better document optimizations, eg add compiler optimization page
|
|
34
32
|
- [ ] static: improve startswith pattern recognition `/^xyz.*/`
|
|
35
33
|
- [ ] js: implement cset as an or-expression
|
|
36
34
|
- [ ] c-backend: factor out str extraction in or-list in more cases
|
|
@@ -81,7 +79,6 @@
|
|
|
81
79
|
- [ ] backend: optimize pattern "{ decl X = ... ; res = f(X (once) ) }"
|
|
82
80
|
- [ ] backend: simplify assignment patterns with ternary operator when available?
|
|
83
81
|
- [ ] backend: consider applying language-specific formatting tools? `clang-format`, `black`…
|
|
84
|
-
- [ ] backend: actually remove ignore code and sequences
|
|
85
82
|
- [ ] c-backend: get pval string into a variable for strcmp unrolling and inlining
|
|
86
83
|
- [ ] c-backend: add number of chunks limit to strcmp optimization
|
|
87
84
|
- [ ] c-backend: strcmp to const inlining and unrolling for all instances
|
|
@@ -90,7 +87,6 @@
|
|
|
90
87
|
- [ ] static: optimize not string cst test?
|
|
91
88
|
- [ ] static: close may/must? merge with open?
|
|
92
89
|
- [ ] static: add a dynamic test for different strategies in object checking
|
|
93
|
-
- [ ] backend: refactor ir optimizations
|
|
94
90
|
- [ ] artifact: make work with dind (docker compose?)
|
|
95
91
|
- [ ] static: recognize already compile objects and reuse function esp under no-reporting?
|
|
96
92
|
- [ ] tests: add non regression tests to docker build
|
|
@@ -36,7 +36,7 @@ which will spawn the necessary containers:
|
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
38
|
JMC=latest JMC_OPTS="--predef --cc=clang" \
|
|
39
|
-
nohup ./start_bench.sh latest -p 12 -l 1000 -r 5 -c &
|
|
39
|
+
nohup ./start_bench.sh latest -p 12 -l 1000 -r 5 -L -c &
|
|
40
40
|
# in the generated directory, look for the summary markdown and radar json files.
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -59,12 +59,15 @@ misplaced keywords or bad regex, or better native models), and induce small
|
|
|
59
59
|
differences in the validated results, in which case they are manually
|
|
60
60
|
validated and discussed.
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
-
|
|
66
|
-
over 300 µs for validating one value), a relative comparison ratio is shown.
|
|
62
|
+
- Performance elapsed times for each test are collected over a loop to compute
|
|
63
|
+
an average and standard deviation. The repetition also intends to catch hidden costs
|
|
64
|
+
such as JIT compilation, GC runs and lazy initializations.
|
|
65
|
+
- Several independent runs are performed to reduce host load effects.
|
|
67
66
|
- Compilation times and performance times are the _median_ encountered over the runs.
|
|
67
|
+
- Runs are usually performed in _fast_ mode: the rejection reasons are not collected,
|
|
68
|
+
and the run stops as soon as possible.
|
|
69
|
+
- The benchmark presents relative comparison ratios to smooth out the wide range of
|
|
70
|
+
collected performances (from 10 ns to over 300 µs for validating one value).
|
|
68
71
|
|
|
69
72
|
Note that performance figures **must** be taken with a pinch of salt, please consider
|
|
70
73
|
the following caveats, and others:
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# JSON Model Compiler
|
|
2
|
+
|
|
3
|
+
This page documents the JSON Model Compiler (JMC), accessible from the `jmc` command.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The compiler is composed of 8 parts:
|
|
8
|
+
|
|
9
|
+
1. Parser from JSON, YAML or JS
|
|
10
|
+
2. Preprocessor
|
|
11
|
+
3. Model Optimizations
|
|
12
|
+
4. Static Compilation to IR
|
|
13
|
+
5. Export to TS, JSON Schema or Pydantic
|
|
14
|
+
6. IR Optimizations
|
|
15
|
+
7. Target Source Code Generation in Python, C, JavaScript, Java, Perl, PL/pgSQL
|
|
16
|
+
8. Target Runtime for each target language
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart LR
|
|
20
|
+
filein(json
|
|
21
|
+
yaml
|
|
22
|
+
js)
|
|
23
|
+
parser[parser]
|
|
24
|
+
preproc[preproc]
|
|
25
|
+
m-optim[optim]
|
|
26
|
+
compile[static]
|
|
27
|
+
export[export]
|
|
28
|
+
ir-optim["IR
|
|
29
|
+
optim"]
|
|
30
|
+
codegen["code
|
|
31
|
+
gen"]
|
|
32
|
+
code(py
|
|
33
|
+
c
|
|
34
|
+
js
|
|
35
|
+
java
|
|
36
|
+
pl
|
|
37
|
+
sql)
|
|
38
|
+
filein --> parser --> preproc --> m-optim --> compile --> ir-optim --> codegen --> code
|
|
39
|
+
fileout(schema
|
|
40
|
+
ts
|
|
41
|
+
py)
|
|
42
|
+
m-optim --> export --> fileout
|
|
43
|
+
runtime[runtime]
|
|
44
|
+
runtime --> code
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Parser
|
|
48
|
+
|
|
49
|
+
Read a model, possibly resolving remote references, from JSON, YAML or JS syntaxes.
|
|
50
|
+
|
|
51
|
+
## Preprocessor
|
|
52
|
+
|
|
53
|
+
Apply model transformations (`%`), check references (`$`) and eliminate object merges (`+`).
|
|
54
|
+
|
|
55
|
+
## Model Optimization
|
|
56
|
+
|
|
57
|
+
Perform optimizations at the model level, including partial evaluation,
|
|
58
|
+
various simplifications and normalizations.
|
|
59
|
+
|
|
60
|
+
## Static Compiler
|
|
61
|
+
|
|
62
|
+
Generate a language-agnostic AST (Abstract Syntax Tree) IR (Intermediate Representation) for the evaluator.
|
|
63
|
+
|
|
64
|
+
## IR Optimization
|
|
65
|
+
|
|
66
|
+
Optimize the AST, which results in simpler source code.
|
|
67
|
+
|
|
68
|
+
## Code Generator
|
|
69
|
+
|
|
70
|
+
Generate actual target source code from the AST.
|
|
71
|
+
This includes target-specific optimizations.
|
|
72
|
+
|
|
73
|
+
## Runtime
|
|
74
|
+
|
|
75
|
+
Per-language runtimes provide support functions.
|
|
@@ -4,12 +4,14 @@ Following the [diátaxis](https://diataxis.fr/) approach, this project provides:
|
|
|
4
4
|
|
|
5
5
|
## Explanations and discussions
|
|
6
6
|
|
|
7
|
-
See [introduction](README.md)
|
|
7
|
+
See [introduction](README.md), [compiler documentation](COMP.md)
|
|
8
|
+
and [research papers](PUBS#research-papers).
|
|
8
9
|
|
|
9
10
|
## Tutorial
|
|
10
11
|
|
|
11
12
|
See [tutorial](TUTO.md) about JSON Model and the `jmc` command,
|
|
12
|
-
using a [docker](DOCKER.md)
|
|
13
|
+
using a [docker](DOCKER.md)
|
|
14
|
+
[image](https://hub.docker.com/r/zx80/jmc) for easy deployment.
|
|
13
15
|
|
|
14
16
|
## How To
|
|
15
17
|
|
|
@@ -127,6 +127,7 @@ for all possible values for that type.
|
|
|
127
127
|
- `"$F16"`, `"$F32"`, `"$F64"`: 16/32/64 bit precision
|
|
128
128
|
[IEEE 754](https://standards.ieee.org/ieee/754/6210/) floats.
|
|
129
129
|
- "`$STRING"`: a string.
|
|
130
|
+
- `"$RATE"`: a float between _0.0_ and _1.0_.
|
|
130
131
|
|
|
131
132
|
In addition, the following string predefs are defined:
|
|
132
133
|
|
|
@@ -196,7 +197,9 @@ Property names are matched as follow:
|
|
|
196
197
|
- `"?XXX"`: optional properties directly provided after the `?`.
|
|
197
198
|
- `"/.../"`: optional property names matching a regular expression:
|
|
198
199
|
eg `{"/^a/": ""}` means property names starting with _a_ must have string values.
|
|
199
|
-
- `"$XXX"`: optional property reference to a **string** [definition](#definitions-and-scope)
|
|
200
|
+
- `"$XXX"`: optional property reference to a **string** [definition](#definitions-and-scope)
|
|
201
|
+
or predef. The target definition type must be resolved as a string according to
|
|
202
|
+
the [typing lattice](#static-typing-lattice).
|
|
200
203
|
- `""` catch all property: any property name matches.
|
|
201
204
|
This is consistent with `""` standing for any string.
|
|
202
205
|
- property names starting with other characters are reserved for future uses and must be rejected.
|
|
@@ -216,7 +219,7 @@ property specifications are **not** cumulative.
|
|
|
216
219
|
|
|
217
220
|
The matching search **should** follow the specification order within these classes
|
|
218
221
|
if the language JSON representation allows it.
|
|
219
|
-
However, a model **should
|
|
222
|
+
However, a model **should not** rely on the fact that the specification order is preserved
|
|
220
223
|
for its expected semantics.
|
|
221
224
|
This allows to hint optimization by putting more likely properties ahead of the check.
|
|
222
225
|
|
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# JSON Model Compiler Versions
|
|
2
2
|
|
|
3
|
+
## 2.0.63 on 2026-10-05
|
|
4
|
+
|
|
5
|
+
- pr: center logo in sidebar
|
|
6
|
+
- optim: handle indirect number models
|
|
7
|
+
- optim: improve partial eval for more num nones
|
|
8
|
+
- optim: simplify some '!=' cases
|
|
9
|
+
- perf: ~add another loop over performance collection?~
|
|
10
|
+
- pr: add simple compiler description page
|
|
11
|
+
- optim: fix xor bad deduplication optimization when 3 models are equal
|
|
12
|
+
- optim: `{"a":"$NONE"}` is `"$NONE"`
|
|
13
|
+
- optim: `{"?a":"$NONE"}` or `{"": "$NONE"}` is `{}`
|
|
14
|
+
- check: prop references must be strings
|
|
15
|
+
- static: shortcut on open may-only props
|
|
16
|
+
- sql: capitalize bool and int type names for consistency
|
|
17
|
+
- backends: refactor language-specific code generation settings to each language
|
|
18
|
+
- bench: add corvus external reference
|
|
19
|
+
- bench: add untested `--collect` option
|
|
20
|
+
- bench: submit `negatives.jsonl` to jsb for sanity checks (wip)
|
|
21
|
+
- bench: always use `latest` tag for external tools (ajv, corvus)
|
|
22
|
+
- java-runtime: update dependent java lib versions (base container, runtime)
|
|
23
|
+
- bench: run negatives to access tool accuracy
|
|
24
|
+
- bench: extract and report tool accuracy, precision, recall…
|
|
25
|
+
- spec: add `$RATE` predef, float in [0.0, 1.0]
|
|
26
|
+
- bench: add build option to cron script
|
|
27
|
+
- bench: disactivate reruns on jsb changes
|
|
28
|
+
|
|
29
|
+
## 2.0.62 on 2026-09-20
|
|
30
|
+
|
|
31
|
+
- bench: add case names to generated radar
|
|
32
|
+
- pr: use case names for radar display if available
|
|
33
|
+
- optim: merge props handling if submodel are equal if possible
|
|
34
|
+
- container: update versions, add bun as a js runtime, use node 26 (10% faster)
|
|
35
|
+
- front: add `--js-runtime` option
|
|
36
|
+
- bench: report "bun" version if appropriate
|
|
37
|
+
- backend: refactor ir optimizations
|
|
38
|
+
|
|
3
39
|
## 2.0.61 on 2026-09-18
|
|
4
40
|
|
|
5
41
|
- ir: ensure that a nope is kept when optimizing sequences
|
|
@@ -31,13 +31,16 @@ for artifact in $(ls site/benchmarks/*.md | sort -r) ; do
|
|
|
31
31
|
jsu=$(get_version jsu $artifact)
|
|
32
32
|
jmc=$(get_version jmc $artifact)
|
|
33
33
|
sbc=$(get_version jsonschema-cli $artifact)
|
|
34
|
+
crv=$(get_version corvus-cli $artifact)
|
|
34
35
|
message=""
|
|
35
36
|
[ "$(grep 'content:.*yes' $artifact)" ] && message+="content" || message+="no content"
|
|
36
37
|
[ "$(grep 'JSU_OPT.*--no-id' $artifact)" ] && message+=", no id" || message+=", id"
|
|
37
38
|
[ "$(grep 'fix:.*yes' $artifact)" ] && message+=", fix" || message+=", no fix"
|
|
38
|
-
echo "- Artifact [$name]($link) using
|
|
39
|
-
echo " [
|
|
40
|
-
echo " [
|
|
39
|
+
echo "- Artifact [$name]($link) using"
|
|
40
|
+
echo " [JMC $jmc]($PYPI/json-model-compiler/$jmc/), "
|
|
41
|
+
echo " [JSU $jsu]($PYPI/json-schema-utils/$jsu/), "
|
|
42
|
+
[ "$sbc" ] && echo " [SBC $sbc](https://github.com/sourcemeta/jsonschema/releases/tag/v$sbc),"
|
|
43
|
+
[ "$crv" ] && echo " [Corvus $crv](https://corvus-oss.org/Corvus.JsonSchema/),"
|
|
41
44
|
echo " $message."
|
|
42
45
|
|
|
43
46
|
[ $nartifacts -eq $MAX ] && break
|
|
@@ -186,14 +186,16 @@ def valid(jm: JsonModel,
|
|
|
186
186
|
else: # check object
|
|
187
187
|
props = set() # check property name collisions
|
|
188
188
|
for p, m in model.items():
|
|
189
|
-
if p == "#":
|
|
189
|
+
if p == "#" or p and p[0] == "#": # skip comments
|
|
190
190
|
continue
|
|
191
191
|
assert isinstance(p, str), f"property name {p} is a string at {spath}"
|
|
192
|
-
if p and p[0] not in
|
|
192
|
+
if p and p[0] not in "$/":
|
|
193
193
|
name = p[1:] if p[0] in ("?", "_", "!") else p
|
|
194
194
|
assert name not in props, f"no property name collison at {spath}"
|
|
195
195
|
props.add(name)
|
|
196
|
-
|
|
196
|
+
elif p and p[0] == "$": # check property name type
|
|
197
|
+
assert ultimate_type(jm, p) is str, f"property name reference {p} is a string at {spath}"
|
|
198
|
+
# else p == "" or p is a regex
|
|
197
199
|
case _:
|
|
198
200
|
assert False, f"unexpected model base type at {spath}"
|
|
199
201
|
return True
|
|
@@ -301,6 +301,15 @@ class CLangJansson(Language):
|
|
|
301
301
|
self._partition_threshold = partition_threshold
|
|
302
302
|
self._byte_order = byte_order
|
|
303
303
|
|
|
304
|
+
self._settings |= {
|
|
305
|
+
"mot": 0,
|
|
306
|
+
"mmo": 0,
|
|
307
|
+
"moo": 3,
|
|
308
|
+
"map": 256,
|
|
309
|
+
"par": 6,
|
|
310
|
+
"omu": 4,
|
|
311
|
+
"aun": 4,
|
|
312
|
+
}
|
|
304
313
|
# instance counter
|
|
305
314
|
self._count = Counter()
|
|
306
315
|
|
|
@@ -9,12 +9,15 @@ from .predefs import PREDEF_RE, PREDEFS
|
|
|
9
9
|
|
|
10
10
|
PREDEF_TYPES: dict[str, str] = {
|
|
11
11
|
"$NUMBER": "number",
|
|
12
|
+
"$RATE": "number",
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
for name, model in PREDEFS.items():
|
|
15
16
|
if name[0] == "o": # skip $oXXX
|
|
16
17
|
continue
|
|
17
18
|
pname = "$" + name
|
|
19
|
+
if pname in PREDEF_TYPES:
|
|
20
|
+
continue
|
|
18
21
|
match model:
|
|
19
22
|
case None:
|
|
20
23
|
PREDEF_TYPES[pname] = "null"
|
|
@@ -146,6 +149,9 @@ def _m2s(model: ModelType, path: ModelPath, defs: Symbols) -> JsonSchema:
|
|
|
146
149
|
schema["contentMediaType"] = "application/json"
|
|
147
150
|
elif model in PREDEF_RE:
|
|
148
151
|
schema["pattern"] = PREDEF_RE[model][1]
|
|
152
|
+
elif model == "$RATE":
|
|
153
|
+
schema["minimum"] = 0.0
|
|
154
|
+
schema["maximum"] = 1.0
|
|
149
155
|
# else: ignore
|
|
150
156
|
elif model[0] == "$":
|
|
151
157
|
if model == "$#":
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.0.63
|
|
@@ -204,6 +204,12 @@ is below the provided threshold, default is depends on target.
|
|
|
204
204
|
Consider must-only object property scheme if the number of mandatory
|
|
205
205
|
properties is below the provided threshold, default depends on target.
|
|
206
206
|
|
|
207
|
+
=item B<--may-only-open-threshold THRESHOLD>
|
|
208
|
+
|
|
209
|
+
Count-based shorcut for may-only open objects if the number of optional
|
|
210
|
+
properties is greater than 1 and below the provided threshold.
|
|
211
|
+
Default is 3, 0 to disable.
|
|
212
|
+
|
|
207
213
|
=item B<--partition-threshold THRESHOLD>
|
|
208
214
|
|
|
209
215
|
Number of properties to trigger partitioning inlined property checks,
|
|
@@ -335,6 +341,22 @@ Java compiler flags.
|
|
|
335
341
|
|
|
336
342
|
=back
|
|
337
343
|
|
|
344
|
+
=head2 JavaScript Compilation
|
|
345
|
+
|
|
346
|
+
=over 4
|
|
347
|
+
|
|
348
|
+
=item B<--js-runtime JS>
|
|
349
|
+
|
|
350
|
+
Set JavaScript runtime for generated executable, eg C<bun>.
|
|
351
|
+
Skip with C<none>.
|
|
352
|
+
Default is C<node>.
|
|
353
|
+
|
|
354
|
+
=item B<--js-direct> or B<--no-js-direct>
|
|
355
|
+
|
|
356
|
+
Use more direct operations in generated JS code.
|
|
357
|
+
|
|
358
|
+
=back
|
|
359
|
+
|
|
338
360
|
=head2 JSON Schema Export
|
|
339
361
|
|
|
340
362
|
=over 4
|