From a2105020460e7720f9318875062e94ce555f7df1 Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 5 Dec 2019 20:57:11 -0500 Subject: [PATCH 01/16] surrounding list(ir0val) of IR0Vcon with square brackets. Aids in reading through output tree (particularly when list is empty) --- srcgen/xint/DATS/interp0_print.dats | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/srcgen/xint/DATS/interp0_print.dats b/srcgen/xint/DATS/interp0_print.dats index f9037b22d..2d3dc3662 100644 --- a/srcgen/xint/DATS/interp0_print.dats +++ b/srcgen/xint/DATS/interp0_print.dats @@ -13,12 +13,12 @@ ** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the ** Free Software Foundation; either version 3, or (at your option) any ** later version. -** +** ** ATS is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ** for more details. -** +** ** You should have received a copy of the GNU General Public License ** along with ATS; see the file COPYING. If not, please write to the ** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA @@ -72,10 +72,10 @@ fprint_val = fprint_ir0val (* ****** ****** *) // implement -print_ir0val(x0) = +print_ir0val(x0) = fprint_ir0val(stdout_ref, x0) implement -prerr_ir0val(x0) = +prerr_ir0val(x0) = fprint_ir0val(stderr_ref, x0) // implement @@ -101,7 +101,7 @@ case+ x0 of | IR0Vcon(d2c, xs) => fprint! ( out - , "IR0Vcon(", d2c, "; ", xs, ")") + , "IR0Vcon(", d2c, "; [", xs, "] )") // | IR0Vfun(fopr) => fprint!(out, "IR0Vfun(", "...", ")") From 4cd366be8d60c285c48b0e5244a54e1c889672f1 Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 5 Dec 2019 21:26:48 -0500 Subject: [PATCH 02/16] adding square brackets --- srcgen/xats/DATS/intrep0_print.dats | 6 +++--- srcgen/xint/DATS/interp0_print.dats | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/srcgen/xats/DATS/intrep0_print.dats b/srcgen/xats/DATS/intrep0_print.dats index 2b5416529..0cf539058 100644 --- a/srcgen/xats/DATS/intrep0_print.dats +++ b/srcgen/xats/DATS/intrep0_print.dats @@ -13,12 +13,12 @@ ** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the ** Free Software Foundation; either version 3, or (at your option) any ** later version. -** +** ** ATS is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ** for more details. -** +** ** You should have received a copy of the GNU General Public License ** along with ATS; see the file COPYING. If not, please write to the ** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA @@ -254,7 +254,7 @@ x0.node() of fprint! ( out , "IR0Edapp(" - , irf0, "; ", npf1, "; ", ires, ")") + , irf0, "; ", npf1, "; [", ires, "])") // | IR0Eproj (ire1, lab2, idx2) => diff --git a/srcgen/xint/DATS/interp0_print.dats b/srcgen/xint/DATS/interp0_print.dats index 2d3dc3662..f3a7e4a3c 100644 --- a/srcgen/xint/DATS/interp0_print.dats +++ b/srcgen/xint/DATS/interp0_print.dats @@ -101,7 +101,7 @@ case+ x0 of | IR0Vcon(d2c, xs) => fprint! ( out - , "IR0Vcon(", d2c, "; [", xs, "] )") + , "IR0Vcon(", d2c, "; [", xs, "])") // | IR0Vfun(fopr) => fprint!(out, "IR0Vfun(", "...", ")") From cc1f1afc18fdfc38f10b61e3d2d55960948ee1bc Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 5 Dec 2019 21:33:46 -0500 Subject: [PATCH 03/16] adding square brackets for list legibility --- srcgen/xats/DATS/intrep0_print.dats | 12 ++++++------ srcgen/xint/DATS/interp0_print.dats | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/srcgen/xats/DATS/intrep0_print.dats b/srcgen/xats/DATS/intrep0_print.dats index 0cf539058..6e3aa1417 100644 --- a/srcgen/xats/DATS/intrep0_print.dats +++ b/srcgen/xats/DATS/intrep0_print.dats @@ -240,14 +240,14 @@ x0.node() of fprint! ( out , "IR0Etcst(" - , d2c1, "; ", ti3a, "; ", ti2s, ")") + , d2c1, "; ", ti3a, "; [", ti2s, "])") | IR0Etimp ( ire1 , targ, irc2, tsub) => fprint! ( out , "IR0Etimp(" - , ire1, "; ", targ, "; ", irc2, "; ", tsub) + , ire1, "; [", targ, "]; ", irc2, "; [", tsub, "])") // | IR0Edapp (irf0, npf1, ires) => @@ -270,14 +270,14 @@ x0.node() of | IR0Ewhere(ire1, irds) => fprint! ( out - , "IR0Ewhere(", ire1, "; ", irds, ")") + , "IR0Ewhere(", ire1, "; [", irds, "])") // | IR0Etuple (knd0, npf1, ires) => fprint! ( out , "IR0Etuple(" - , knd0, "; ", npf1, "; ", ires, ")") + , knd0, "; ", npf1, "; [", ires, "])") // | IR0Eif0 (ire1, ire2, opt3) => @@ -295,13 +295,13 @@ x0.node() of (knd0, farg, body) => fprint! ( out, "IR0Elam(" - , knd0, "; ", farg, "; ", body, ")") + , knd0, "; [", farg, "]; ", body, ")") | IR0Efix (knd0, d2v0, farg, body) => fprint! ( out, "IR0Efix(" , knd0, "; " - , d2v0, "; ", farg, "; ", body, ")") + , d2v0, "; [", farg, "]; ", body, ")") // | IR0Enone0() => ( diff --git a/srcgen/xint/DATS/interp0_print.dats b/srcgen/xint/DATS/interp0_print.dats index f3a7e4a3c..8ccc6fe1b 100644 --- a/srcgen/xint/DATS/interp0_print.dats +++ b/srcgen/xint/DATS/interp0_print.dats @@ -109,7 +109,7 @@ case+ x0 of | IR0Vtuple(knd, irvs) => fprint! ( out - , "IR0Vtuple(", knd, "; ", irvs, ")") + , "IR0Vtuple(", knd, "; [", irvs, "])") // | IR0Vlam (fenv, iras, ire1) => From af297a6d46bd98c0d9f56f83b2e4b7380ed7c64e Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 11 Dec 2019 03:53:20 -0500 Subject: [PATCH 04/16] jsonify ast --- contrib/sparverius/xjsonize/.depend | 36 + .../xjsonize/BUILD/xats/CATS/.gitkeep | 0 .../xjsonize/BUILD/xats/CATS/lexbuf.cats | 89 ++ .../xjsonize/BUILD/xats/CATS/locinfo.cats | 56 + .../xjsonize/BUILD/xats/CATS/parsing.cats | 70 + contrib/sparverius/xjsonize/DATS/basics.dats | 86 ++ contrib/sparverius/xjsonize/DATS/dynexp0.dats | 45 + contrib/sparverius/xjsonize/DATS/dynexp1.dats | 482 ++++++ contrib/sparverius/xjsonize/DATS/dynexp2.dats | 711 +++++++++ contrib/sparverius/xjsonize/DATS/dynexp3.dats | 57 + contrib/sparverius/xjsonize/DATS/interp0.dats | 1334 +++++++++++++++++ contrib/sparverius/xjsonize/DATS/intrep0.dats | 667 +++++++++ contrib/sparverius/xjsonize/DATS/json.dats | 645 ++++++++ contrib/sparverius/xjsonize/DATS/label0.dats | 68 + .../xjsonize/DATS/lexing_token.dats | 267 ++++ contrib/sparverius/xjsonize/DATS/locinfo.dats | 24 + contrib/sparverius/xjsonize/DATS/staexp0.dats | 773 ++++++++++ contrib/sparverius/xjsonize/DATS/staexp1.dats | 170 +++ contrib/sparverius/xjsonize/DATS/staexp2.dats | 444 ++++++ contrib/sparverius/xjsonize/DATS/stamp0.dats | 36 + contrib/sparverius/xjsonize/DATS/statyp2.dats | 244 +++ contrib/sparverius/xjsonize/DATS/symbol.dats | 22 + .../sparverius/xjsonize/DATS/xjsonize.dats | 115 ++ .../sparverius/xjsonize/HATS/libxatsopt.hats | 139 ++ contrib/sparverius/xjsonize/Makefile | 157 ++ contrib/sparverius/xjsonize/SATS/basics.sats | 24 + contrib/sparverius/xjsonize/SATS/dynexp0.sats | 147 ++ contrib/sparverius/xjsonize/SATS/dynexp1.sats | 92 ++ contrib/sparverius/xjsonize/SATS/dynexp2.sats | 81 + contrib/sparverius/xjsonize/SATS/dynexp3.sats | 50 + contrib/sparverius/xjsonize/SATS/fixity.sats | 16 + contrib/sparverius/xjsonize/SATS/interp0.sats | 361 +++++ contrib/sparverius/xjsonize/SATS/intrep0.sats | 40 + contrib/sparverius/xjsonize/SATS/json.sats | 293 ++++ contrib/sparverius/xjsonize/SATS/label0.sats | 8 + contrib/sparverius/xjsonize/SATS/lexing.sats | 12 + contrib/sparverius/xjsonize/SATS/locinfo.sats | 8 + contrib/sparverius/xjsonize/SATS/staexp0.sats | 88 ++ contrib/sparverius/xjsonize/SATS/staexp1.sats | 74 + contrib/sparverius/xjsonize/SATS/staexp2.sats | 60 + contrib/sparverius/xjsonize/SATS/stamp0.sats | 10 + contrib/sparverius/xjsonize/SATS/statyp2.sats | 12 + contrib/sparverius/xjsonize/SATS/symbol.sats | 12 + contrib/sparverius/xjsonize/SATS/trans01.sats | 6 + contrib/sparverius/xjsonize/TEST/gfact.dats | 34 + contrib/sparverius/xjsonize/TEST/kfact.dats | 30 + contrib/sparverius/xjsonize/TEST/kfibo.dats | 26 + contrib/sparverius/xjsonize/TEST/kisevn.dats | 25 + .../sparverius/xjsonize/TEST/mytest01.dats | 88 ++ contrib/sparverius/xjsonize/TEST/staexp2.dats | 0 contrib/sparverius/xjsonize/TEST/test01.dats | 236 +++ 51 files changed, 8570 insertions(+) create mode 100644 contrib/sparverius/xjsonize/.depend create mode 100644 contrib/sparverius/xjsonize/BUILD/xats/CATS/.gitkeep create mode 100644 contrib/sparverius/xjsonize/BUILD/xats/CATS/lexbuf.cats create mode 100644 contrib/sparverius/xjsonize/BUILD/xats/CATS/locinfo.cats create mode 100644 contrib/sparverius/xjsonize/BUILD/xats/CATS/parsing.cats create mode 100644 contrib/sparverius/xjsonize/DATS/basics.dats create mode 100644 contrib/sparverius/xjsonize/DATS/dynexp0.dats create mode 100644 contrib/sparverius/xjsonize/DATS/dynexp1.dats create mode 100644 contrib/sparverius/xjsonize/DATS/dynexp2.dats create mode 100644 contrib/sparverius/xjsonize/DATS/dynexp3.dats create mode 100644 contrib/sparverius/xjsonize/DATS/interp0.dats create mode 100644 contrib/sparverius/xjsonize/DATS/intrep0.dats create mode 100644 contrib/sparverius/xjsonize/DATS/json.dats create mode 100644 contrib/sparverius/xjsonize/DATS/label0.dats create mode 100644 contrib/sparverius/xjsonize/DATS/lexing_token.dats create mode 100644 contrib/sparverius/xjsonize/DATS/locinfo.dats create mode 100644 contrib/sparverius/xjsonize/DATS/staexp0.dats create mode 100644 contrib/sparverius/xjsonize/DATS/staexp1.dats create mode 100644 contrib/sparverius/xjsonize/DATS/staexp2.dats create mode 100644 contrib/sparverius/xjsonize/DATS/stamp0.dats create mode 100644 contrib/sparverius/xjsonize/DATS/statyp2.dats create mode 100644 contrib/sparverius/xjsonize/DATS/symbol.dats create mode 100644 contrib/sparverius/xjsonize/DATS/xjsonize.dats create mode 100644 contrib/sparverius/xjsonize/HATS/libxatsopt.hats create mode 100644 contrib/sparverius/xjsonize/Makefile create mode 100644 contrib/sparverius/xjsonize/SATS/basics.sats create mode 100644 contrib/sparverius/xjsonize/SATS/dynexp0.sats create mode 100644 contrib/sparverius/xjsonize/SATS/dynexp1.sats create mode 100644 contrib/sparverius/xjsonize/SATS/dynexp2.sats create mode 100644 contrib/sparverius/xjsonize/SATS/dynexp3.sats create mode 100644 contrib/sparverius/xjsonize/SATS/fixity.sats create mode 100644 contrib/sparverius/xjsonize/SATS/interp0.sats create mode 100644 contrib/sparverius/xjsonize/SATS/intrep0.sats create mode 100644 contrib/sparverius/xjsonize/SATS/json.sats create mode 100644 contrib/sparverius/xjsonize/SATS/label0.sats create mode 100644 contrib/sparverius/xjsonize/SATS/lexing.sats create mode 100644 contrib/sparverius/xjsonize/SATS/locinfo.sats create mode 100644 contrib/sparverius/xjsonize/SATS/staexp0.sats create mode 100644 contrib/sparverius/xjsonize/SATS/staexp1.sats create mode 100644 contrib/sparverius/xjsonize/SATS/staexp2.sats create mode 100644 contrib/sparverius/xjsonize/SATS/stamp0.sats create mode 100644 contrib/sparverius/xjsonize/SATS/statyp2.sats create mode 100644 contrib/sparverius/xjsonize/SATS/symbol.sats create mode 100644 contrib/sparverius/xjsonize/SATS/trans01.sats create mode 100644 contrib/sparverius/xjsonize/TEST/gfact.dats create mode 100644 contrib/sparverius/xjsonize/TEST/kfact.dats create mode 100644 contrib/sparverius/xjsonize/TEST/kfibo.dats create mode 100644 contrib/sparverius/xjsonize/TEST/kisevn.dats create mode 100644 contrib/sparverius/xjsonize/TEST/mytest01.dats create mode 100644 contrib/sparverius/xjsonize/TEST/staexp2.dats create mode 100644 contrib/sparverius/xjsonize/TEST/test01.dats diff --git a/contrib/sparverius/xjsonize/.depend b/contrib/sparverius/xjsonize/.depend new file mode 100644 index 000000000..a5e6e9b25 --- /dev/null +++ b/contrib/sparverius/xjsonize/.depend @@ -0,0 +1,36 @@ +BUILD/json_sats.o : +BUILD/basics_sats.o : SATS/json.sats +BUILD/stamp0_sats.o : SATS/json.sats +BUILD/symbol_sats.o : SATS/json.sats +BUILD/label0_sats.o : SATS/json.sats +BUILD/locinfo_sats.o : SATS/json.sats +BUILD/lexing_sats.o : SATS/json.sats +BUILD/dynexp0_sats.o : SATS/json.sats +BUILD/staexp0_sats.o : SATS/json.sats +BUILD/dynexp1_sats.o : SATS/json.sats +BUILD/staexp1_sats.o : SATS/json.sats +BUILD/statyp2_sats.o : SATS/json.sats +BUILD/staexp2_sats.o : SATS/json.sats +BUILD/dynexp2_sats.o : SATS/json.sats +BUILD/dynexp3_sats.o : SATS/json.sats +BUILD/fixity_sats.o : SATS/json.sats +BUILD/intrep0_sats.o : SATS/json.sats +BUILD/interp0_sats.o : +BUILD/json_dats.o : SATS/json.sats +BUILD/basics_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/basics.sats +BUILD/stamp0_dats.o : SATS/stamp0.sats SATS/json.sats DATS/json.dats +BUILD/symbol_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/symbol.sats +BUILD/label0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/statyp2.sats SATS/staexp2.sats SATS/intrep0.sats SATS/label0.sats SATS/symbol.sats +BUILD/locinfo_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/locinfo.sats +BUILD/lexing_token_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/symbol.sats +BUILD/staexp0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats +BUILD/dynexp0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats +BUILD/staexp1_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats SATS/staexp1.sats SATS/symbol.sats +BUILD/dynexp1_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats +BUILD/statyp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/staexp2.sats SATS/statyp2.sats SATS/symbol.sats SATS/locinfo.sats SATS/stamp0.sats SATS/label0.sats +BUILD/staexp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/basics.sats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats SATS/staexp1.sats SATS/staexp2.sats SATS/symbol.sats SATS/locinfo.sats SATS/stamp0.sats SATS/label0.sats +BUILD/dynexp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats SATS/dynexp2.sats SATS/staexp2.sats SATS/symbol.sats SATS/stamp0.sats +BUILD/dynexp3_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/statyp2.sats SATS/staexp2.sats +BUILD/intrep0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/statyp2.sats SATS/staexp2.sats SATS/intrep0.sats +BUILD/interp0_dats.o : HATS/libxatsopt.hats SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/intrep0.sats DATS/json.dats DATS/basics.dats DATS/label0.dats DATS/locinfo.dats DATS/lexing_token.dats DATS/staexp0.dats DATS/dynexp0.dats DATS/stamp0.dats DATS/symbol.dats DATS/staexp1.dats DATS/dynexp1.dats DATS/statyp2.dats DATS/staexp2.dats DATS/dynexp2.dats DATS/dynexp3.dats DATS/intrep0.dats DATS/json.dats SATS/interp0.sats +BUILD/xjsonize_dats.o : SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/intrep0.sats SATS/interp0.sats diff --git a/contrib/sparverius/xjsonize/BUILD/xats/CATS/.gitkeep b/contrib/sparverius/xjsonize/BUILD/xats/CATS/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/contrib/sparverius/xjsonize/BUILD/xats/CATS/lexbuf.cats b/contrib/sparverius/xjsonize/BUILD/xats/CATS/lexbuf.cats new file mode 100644 index 000000000..bf9eae13a --- /dev/null +++ b/contrib/sparverius/xjsonize/BUILD/xats/CATS/lexbuf.cats @@ -0,0 +1,89 @@ +/***********************************************************************/ +/* */ +/* Applied Type System */ +/* */ +/***********************************************************************/ + +/* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*/ + +/* ****** ****** */ +// +// Author: Hongwei Xi +// Start Time: May, 2018 +// Authoremail: gmhwxi@gmail.com +// +/* ****** ****** */ + +#ifndef XANADU_SRCGEN_CATS_LEXBUF +#define XANADU_SRCGEN_CATS_LEXBUF + +/* ****** ****** */ + +/* +typedef +lexbuf_tflat = +$extype_struct +"xats_lexbuf_struct" of +{ + base_ntot= int +, base_nrow= int +, base_ncol= int +(* +, char= int +*) +, cbuf= string +// +, begp= ptr +, endp= ptr, curp= ptr +// +, cbhead= cblist, cbtail= cblist +// +} (* end of [lexbuf] *) +*/ + +typedef struct { +// + atstype_int ntot ; // char number + atstype_int nrow ; // line number + atstype_int ncol ; // line offset +// +/* + atstype_int char ; // ungetc +*/ + atstype_ptr cbuf ; // prefix +// + atstype_ptr begp ; // start + atstype_ptr endp ; // finish + atstype_ptr curp ; // current +// + atstype_ptr cbhead ; // 1st cblock + atstype_ptr cbtail ; // rest of cblocks +// +} xats_lexbuf_struct ; + +/* ****** ****** */ + +#endif // end of [XANADU_SRCGEN_CATS_LEXBUF] + +/* ****** ****** */ + +/* end of [xats_lexbuf.cats] */ diff --git a/contrib/sparverius/xjsonize/BUILD/xats/CATS/locinfo.cats b/contrib/sparverius/xjsonize/BUILD/xats/CATS/locinfo.cats new file mode 100644 index 000000000..002db0e9d --- /dev/null +++ b/contrib/sparverius/xjsonize/BUILD/xats/CATS/locinfo.cats @@ -0,0 +1,56 @@ +/***********************************************************************/ +/* */ +/* Applied Type System */ +/* */ +/***********************************************************************/ + +/* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*/ + +/* ****** ****** */ +// +// Author: Hongwei Xi +// Start Time: May, 2018 +// Authoremail: gmhwxi@gmail.com +// +/* ****** ****** */ + +#ifndef \ +ATS3_SRCGEN_CATS_XATS_LOCINFO +#define \ +ATS3_SRCGEN_CATS_XATS_LOCINFO + +/* ****** ****** */ + +typedef struct { + atstype_int ntot ; // char number + atstype_int nrow ; // line number + atstype_int ncol ; // line offset +} xats_position_struct ; + +/* ****** ****** */ +// +#endif // end if [ifndef] +// [ATS3_SRCGEN_CATS_XATS_LOCINFO] +// +/* ****** ****** */ + +/* end of [xats_locinfo.cats] */ diff --git a/contrib/sparverius/xjsonize/BUILD/xats/CATS/parsing.cats b/contrib/sparverius/xjsonize/BUILD/xats/CATS/parsing.cats new file mode 100644 index 000000000..4b4d1bd30 --- /dev/null +++ b/contrib/sparverius/xjsonize/BUILD/xats/CATS/parsing.cats @@ -0,0 +1,70 @@ +/***********************************************************************/ +/* */ +/* Applied Type System */ +/* */ +/***********************************************************************/ + +/* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*/ + +/* ****** ****** */ +// +// Author: Hongwei Xi +// Start Time: June, 2018 +// Authoremail: gmhwxi@gmail.com +// +/* ****** ****** */ +// +#ifndef \ +ATS3_SRCGEN_CATS_XATS_PARSING +#define \ +ATS3_SRCGEN_CATS_XATS_PARSING +// +/* ****** ****** */ + +/* +typedef +tokbuf_tflat = +$extype_struct +"xats_tokbuf_struct" of +{ + token *begp; + token *endp; + token *curp; +} (* end of [tokbuf] *) +*/ + +typedef struct { +// + atstype_ptr begp ; // start + atstype_ptr endp ; // finish + atstype_ptr curp ; // current +// +} xats_tokbuf_struct ; + +/* ****** ****** */ +// +#endif // end if [ifndef] +// [ATS3_SRCGEN_CATS_XATS_PARSING] +// +/* ****** ****** */ + +/* end of [xats_parsing.cats] */ diff --git a/contrib/sparverius/xjsonize/DATS/basics.dats b/contrib/sparverius/xjsonize/DATS/basics.dats new file mode 100644 index 000000000..1ddb66b50 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/basics.dats @@ -0,0 +1,86 @@ +#include "share/atspre_staload.hats" +#staload +UN = "prelude/SATS/unsafe.sats" +// +(* ****** ****** *) +// +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + + +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/basics.sats" + +#staload "./../SATS/basics.sats" + + +implement +jsonize_valkind + (vlk) = lab("valkind", res) where +val res = +( +// +case+ vlk of +| VLKval() => jstr("VLKval") +| VLKvalp() => jstr("VLKvalp") +| VLKvaln() => jstr("VLKvaln") +(* +| VLKmcval() => jstr("VLKprval") +*) +| VLKprval() => jstr("VLKprval") +// +) (* end of [fprint_valkind] *) +end + +implement +jsonize_funkind + (fnk) = lab("funkind", res) where +val res = +( +// +case+ fnk of +| FNKfn0() => jsonize("FNKfn0") +| FNKfnx() => jsonize("FNKfnx") +| FNKfn1() => jsonize("FNKfn1") +| FNKfun() => jsonize("FNKfun") +// +| FNKprfn0() => jsonize("FNKprfn0") +| FNKprfn1() => jsonize("FNKprfn1") +| FNKprfun() => jsonize("FNKprfun") +| FNKpraxi() => jsonize("FNKpraxi") +// +| FNKcastfn() => jsonize("FNKcastfn") +// +) (* end of [fprint_funkind] *) +end + + +implement +jsonize_impkind + (knd) = lab("impkind", res) where +val res = +( +case+ knd of +| IMPprf() => jsonize("IMPprf") +| IMPval() => jsonize("IMPval") +| IMPfun() => jsonize("IMPfun") +| IMPtmp() => jsonize("IMPtmp") +| IMPgen() => jsonize("IMPgen") +) (* end of [fprint_impkind] *) +end + + +implement +jsonize_funclo2 + (fc2) = lab("impkind", res) where +val res = +( +case+ fc2 of +| FC2fun() => + jsonize("FC2fun()") +| FC2clo(knd) => + lab("FC2clo", jsonize(knd))(* jsonize("FC2clo(", knd, ")") *) +) +end diff --git a/contrib/sparverius/xjsonize/DATS/dynexp0.dats b/contrib/sparverius/xjsonize/DATS/dynexp0.dats new file mode 100644 index 000000000..4da0f3fd9 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/dynexp0.dats @@ -0,0 +1,45 @@ +#include +"share/atspre_staload.hats" +#staload +UN = "prelude/SATS/unsafe.sats" + +#include +"./../HATS/libxatsopt.hats" + +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/dynexp0.sats" +#staload "{$XATS}/SATS/staexp0.sats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/lexing.sats" + + +implement jsonize_val(x) = jsonize_i0dnt(x) + +implement +jsonize_decmodopt + (x0) = +( +case+ x0 of +// +| DECMODnone() => + jsonify("DECMODnone") +// +| DECMODsing(tok, id0) => + (* fprint!(out, "DECMODsing(", tok, "; ", id0, ")") *) + jsonify("DECMODsing", ("tok", "id0"), rst) where + (* val _ = $showtype(id0) *) + val rst = (jsonize(tok), jsonize(id0)) + end +| DECMODlist(tok, tbeg, ids, tend) => + (* fprint!( out, "DECMODlist(", tok, "; ", tbeg, "; ", ids, "; ", tend, ")") *) + jsonify("DECMODsing", ("tok", "tbeg", "ids", "tend"), rst) where + (* val _ = $showtype(ids) *) + val xys = jsonize_list(ids) + val rst = (jsonize(tok), jsonize(tbeg), xys, jsonize(tend)) + end +) diff --git a/contrib/sparverius/xjsonize/DATS/dynexp1.dats b/contrib/sparverius/xjsonize/DATS/dynexp1.dats new file mode 100644 index 000000000..3c9112938 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/dynexp1.dats @@ -0,0 +1,482 @@ +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#define XATS_targetloc "./../../../../srcgen/xats" +(* +#staload "{$XATS}/SATS/dynexp0.sats" +#staload "{$XATS}/SATS/staexp0.sats" +*) +#staload "{$XATS}/SATS/dynexp1.sats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/lexing.sats" +#staload "./../SATS/dynexp1.sats" +#staload "./../SATS/label0.sats" + + +implement jsonize_val(x) = jsonize_d1exp(x) +implement jsonize_val(x) = jsonize_d1ecl(x) + + +implement +jsonize_d1exp + (x0) = labval2(jsonize("d1exp"), res) where +val res = +( +case+ +x0.node() of +| D1Eid(tok) => + (* labval2(jsonize("D1Eid"), jsonize(tok)) // tok, ")") *) + jsonify("D1Eid", "tok", rst) where + val rst = jsonize(tok) + end +// +| D1Eint(tok) => + (* labval2(jsonize("D1Eint"), jsonize(tok)) // tok, ")") *) + jsonify("D1Eint", "tok", rst) where + val rst = jsonize(tok) + end +| D1Echr(tok) => + (* labval2(jsonize("D1Echr"), jsonize(tok)) // tok, ")") *) + jsonify("D1Echr", "tok", rst) where + val rst = jsonize(tok) + end +| D1Eflt(tok) => + (* labval2(jsonize("D1Eflt"), jsonize(tok)) // tok, ")") *) + jsonify("D1Eflt", "tok", rst) where + val rst = jsonize(tok) + end +| D1Estr(tok) => + (* labval2(jsonize("D1Estr"), jsonize(tok)) // tok, ")") *) + jsonify("D1Estr", "tok", rst) where + val rst = jsonize(tok) + end +// +| D1Eapp() => + jsonify("D1Eapp") +// +| D1Ebs0() => + jsonify("D1Ebs0") +| D1Ebs1(d1e) => +(* + labval2(jsonize("D1Ebs1"), jsonize(d1e)) + (* where val _ = $showtype(d1e) end *) +*) + jsonify("D1Ebs1", "d1e", rst) where + val jd1e = jsonize(d1e) + val rst = jd1e + end +// +| D1Eapp1(d1e0, d1e1) => +(* + labval2(jsonize("D1Eapp1"), lst) // d1e0, "; ", d1e1, ")") + where + val j_d1e0 = jsonize(d1e0) + val j_d1e1 = jsonize(d1e1) + val lst = JSONlist(list_cons(j_d1e0, list_sing(j_d1e1))) + end + (* where val _ = $showtype(d1e1) end *) +*) + jsonify("D1Eapp1", ("d1e0", "d1e1"), rst) where + val jd1e0 = jsonize(d1e0) + val jd1e1 = jsonize(d1e1) + val rst = (jd1e0, jd1e1) + end + +| D1Eapp2(d1e0, d1e1, d1e2) => +(* + labval2(jsonize("D1Eapp2"), lst) // d1e0, "; ", d1e1, "; ", d1e2, ")") + where + val j_d1e0 = jsonize(d1e0) + val j_d1e1 = jsonize(d1e1) + val j_d1e2 = jsonize(d1e2) + val lst = list_cons(j_d1e0, list_cons(j_d1e1, list_sing(j_d1e2))) + val lst = JSONlist(lst) + end +*) + jsonify("D1Eapp2", ("d1e0", "d1e1", "d1e2"), rst) where + val jd1e0 = jsonize(d1e0) + val jd1e1 = jsonize(d1e1) + val jd1e2 = jsonize(d1e2) + val rst = (jd1e0, jd1e1, jd1e2) + end + +// +| D1Esqarg(s1es) => + (* labval2(jsonize("D1Esqarg"), jnul()) // s1es, ")") *) + jsonify("D1Esqarg", "s1es", rst) where + (* val jd1es = jsonize_list(s1es) *) + val rst = jstr("...") + end +| D1Etqarg(s1es) => + (* labval2(jsonize("D1Etqarg"), jnul()) // s1es, ")") *) + jsonify("D1Etqarg", "s1es", rst) where + (* val jd1es = jsonize_list(s1es) *) + val rst = jstr("...") + end +// +| D1Elist(d1es) => +(* + labval2(jsonize("D1Elist1"), jd1es) // d1es, ")") + where + val jd1es = jsonize_list(d1es) + (* val jd1es = jsonize(d1es) *) + end +*) + jsonify("D1Elist", "d1es1", rst) where + val jd1es = jsonize_list(d1es) + val rst = jd1es + end + +| D1Elist(d1es1, d1es2) => +(* + labval2(jsonize("D1Elist2"), lst) // d1es1, "; ", d1es2, ")") + where + val jd1es1 = jsonize_list(d1es1) + val jd1es2 = jsonize_list(d1es2) + (* val jd1es1 = jsonize(d1es1) *) + (* val jd1es2 = jsonize(d1es2) *) + val lst = JSONlist($list{jsonval}(jd1es1,jd1es2)) + end +*) + jsonify("D1Elist", ("d1es1", "d1es2"), rst) where + val jd1es1 = jsonize_list(d1es1) + val jd1es2 = jsonize_list(d1es2) + val rst = (jd1es1, jd1es2) + end +// +| D1Eseqn(d1es1, d1es2) => +(* + labval2(jsonize("D1Eseqn"), con) + where + val jd1es1 = jsonize_list(d1es1) + val jd1es2 = jsonize_list(d1es2) + (* val jd1es1 = jsonize(d1es1) *) + (* val jd1es2 = jsonize(d1es2) *) + val con = jsonval_labval2("d1es1", jd1es1, "d1es2", jd1es2) + (* val lst = JSONlist($list{jsonval}(jd1es1,jd1es2)) *) + end +*) + jsonify("D1Eseqn", ("d1es1", "d1es2"), rst) where + val jd1es1 = jsonize_list(d1es1) + val jd1es2 = jsonize_list(d1es2) + val rst = (jd1es1, jd1es2) + end + +// +| D1Etuple(tok, d1es) => + (* labval2(jsonize("D1Etuple"), con) *) + (* where *) + (* val jd1es = jsonize_list(d1es) *) + (* (* val jd1es = jsonize(d1es) *) *) + (* val con = jsonval_labval2("tok", jsonize(tok), "d1es", jd1es) *) + (* end *) + jsonify("D1Etuple", ("tok", "d1es"), rst) where + val jtok = jsonize(tok) + val jd1es = jsonize_list(d1es) + val rst = (jtok, jd1es) + end + +| D1Etuple(tok, d1es1, d1es2) => + (* labval2(jsonize("D1Etuple"), jnul()) // tok, "; ", d1es1, "; ", d1es2, ")") *) + jsonify("D1Etuple", ("tok", "d1es1", "d1es2"), rst) + where + val jtok = jsonize(tok) + val jd1es1 = jsonize_list(d1es1) + val jd1es2 = jsonize_list(d1es2) + (* val jd1es1 = jsonize(d1es1) *) + (* val jd1es2 = jsonize(d1es2) *) + (* val con = jsonval_labval3("tok", jtok, "d1es1", jd1es1, "d1es2", jd1es2) *) + val rst = (jtok, jd1es1, jd1es2) + end + +// +| D1Ebrack(d1es) => + (* labval2(jsonize("D1Ebrack"), jnul()) // d1es, ")") *) + (* where *) + (* val jd1es = jsonize_list(d1es) *) + (* (* val jd1es = jsonize(d1es) *) *) + (* val con = jsonval_labval1("d1es", jd1es) *) + (* end *) + jsonify("D1Ebrack", "d1es", rst) where + val rst = jsonize_list(d1es) + end + +| D1Edtsel(lab1, arg2) => + (* labval2(jsonize("D1Edtsel"), rst) // lab1, "; ", arg2, ")") *) + (* where *) + (* (* val _ = $showtype(arg2) *) *) + (* (* option_t0ype_bool_type(d1exp_tbox, b 15960): type *) *) + (* val rst = jsonval_labval2("lab1", jsonize(lab1), "arg2", jstr("...")) *) + (* end *) + jsonify("D1Edtsel", ("lab1", "arg2"), rst) where + val rst = (jsonize(lab1), jstr("...")) + end + + +// +| D1Elet(d1cs, d1es) => + jsonify("D1Elet", ("d1cs", "d1es"), json) + (* labval2(jsonize("D1Elet"), jnul()) // d1cs, "; ", d1es, ")") *) + (* where val _ = $showtype(d1es) end // list d1ecl, list d1exp *) + where + val jd1cs = jsonize_list(d1cs) + val jd1es = jsonize_list(d1es) + val json = (jd1cs, jd1es) + (* val rst = jsonval_labval2("d1cs", jd1cs, "d1es", jd1es) *) + end +// +| D1Ewhere(d1e1, d1cs) => + (* labval2(jsonize("D1Ewhere"), jnul()) // d1e1, "; ", d1cs, ")") *) + jsonify("D1Ewhere", ("d1e1", "d1cs"), rst) where + val jd1e1 = jsonize(d1e1) + val jd1cs = jsonize_list(d1cs) + val rst = (jd1e1, jd1cs) + end +// +| D1Eif0(d1e1, d1e2, opt3) => + (* labval2(jsonize("D1Eif0"), jnul()) // d1e1, "; ", d1e2, "; ", opt3, ")") *) + jsonify("D1Eif0", ("d1e1", "d1e2", "opt3"), rst) where + val jd1e1 = jsonize(d1e1) + val jd1e2 = jsonize(d1e1) + val jopt3 = jstr("...") + val rst = (jd1e1, jd1e2, jopt3) + end +// +| D1Ecase(knd, d1e1, dcls) => + (* labval2(jsonize("D1Ecase"), jnul()) // knd, "; ", d1e1, "; ", dcls , ")") *) + jsonify("D1Ecase", ("knd", "d1e1", "dcls"), rst) where + val jknd = jsonize(knd) + val jd1e1 = jsonize(d1e1) + val jdcls = jstr("...") // list(d1clau) + val rst = (jknd, jd1e1, jdcls) + end +// +| D1Elam + (knd, farg, tres, arrw, body) => + (* labval2(jsonize("D1Elam"), jnul()) // knd, "; ", farg, "; ", tres, "; ", arrw, "; ", body, ")") *) + jsonify("D1Elam", ("knd", "farg", "tres", "arrw", "body"), rst) where + val jknd = jsonize(knd) + val jfarg = jnul() + val jtres = jnul() + val jarrw = jnul() + val jbody = jnul() + val rst = (jknd, jfarg, jtres, jarrw, jbody) + end + +| D1Efix + (knd, fid, farg, tres, arrw, body) => + (* labval2(jsonize("D1Efix"), jnul()) // knd, "; ", fid, "; ", farg, "; ", tres, "; ", arrw, "; ", body, ")") *) + jsonify("D1Efix", ("knd", "fid", "farg", "tres", "arrw", "body"), rst) where + val jknd = jsonize(knd) + val jfid = jnul() + val jfarg = jnul() + val jtres = jnul() + val jarrw = jnul() + val jbody = jnul() + val rst = (jknd, jfid, jfarg, jtres, jarrw, jbody) + end + +// +| D1Eanno(d1e1, s1e2) => + ( + (* labval2(jsonize("D1Eanno"), jnul()) // d1e1, "; ", s1e2, ")") *) + jsonify("D1Eanno", ("d1e1", "s1e2"), rst) where + val js1e2 = jstr("...") + val rst = (jsonize(d1e1), js1e2) + end + ) +// +| D1Equal(tok1, d1e2) => + ( + (* labval2(jsonize("D1Equal"), jnul()) // tok1, "; ", d1e2, ")") *) + jsonify("D1Equal", ("tok1", "d1e2"), rst) where + val rst = (jsonize(tok1), jsonize(d1e2)) + end + + ) +// +| D1Enone((*void*)) => jsonize("D1Enone") // ")") +// +) (* jsonize_d1exp *) +end + + +implement +jsonize_d1ecl + (x0) = jnul() +(* +( +case+ x0.node() of +// +| D1Cnone() => + fprint!(out, "D1Cnone(", ")") +| D1Cnone(d0c) => + fprint!(out, "D1Cnone(", d0c, ")") +// +| D1Cstatic(knd, d1c) => + fprint! + (out, "D1Cstatic(", knd, "; ", d1c, ")") +// +| D1Cextern(knd, d1c) => + fprint! + (out, "D1Cextern(", knd, "; ", d1c, ")") +// +| D1Cdefine + (tok, sym, arg, def) => + fprint! + ( out + , "D1Cdefine(" + , tok, "; ", sym, "; ", arg, "; ", def, ")") +| D1Cmacdef + (tok, sym, arg, def) => + fprint! + ( out + , "D1Cmacdef(" + , tok, "; ", sym, "; ", arg, "; ", def, ")") +// +| D1Cinclude + (tok, src, knd, opt, body) => + ( + fprint! + ( out + , "D1Cinclude(" + , tok, "; " + , src, "; " // src: d1exp + , knd, "; ", opt, "; ", body, ")") + ) where + { + val body = + ( + case+ body of + | None _ => "None()" + | Some _ => "Some()"): string + } +// +| D1Cstaload + ( tok, src + , knd, opt, flag, body) => + ( + fprint! + ( out + , "D1Cstaload(" + , tok, "; " + , src, "; " // src: d1exp + , knd, "; " // knd: stadyn + , opt, "; ", flag, "; ", body, ")") + ) where + { + val body = + ( + case+ body of + | None _ => "None()" + | Some _ => "Some()") : string + } +// +| D1Cabssort(tok, tid) => + fprint! + (out, "D1Cabssort(", tok, "; ", tid, ")") +// +| D1Cstacst0 + (tok, sid, tmas, s0t) => + fprint! + ( out + , "D1Cstacst0(" + , tok, "; ", sid, "; ", tmas, "; ", s0t, ")") +// +| D1Csortdef + (knd, tok, def) => + fprint! + ( out + , "D1Csortdef(", knd, "; ", tok, "; ", def, ")") +// +| D1Csexpdef + ( knd, sid + , arg, res, def) => + fprint! + ( out, "D1Csexpdef(" + , knd, "; ", sid, "; ", arg, "; ", res, "; ", def, ")") +// +| D1Cabstype + (knd, sid, arg, res, def) => + fprint! + ( out, "D1Cabstype(" + , knd, "; ", sid, "; ", arg, "; ", res, "; ", def, ")") +// +| D1Cabsimpl + (tok, sqid, smas, res0, def1) => + fprint! + ( out, "D1Cabsimpl(" + , tok, "; ", sqid, "; ", smas, "; ", res0, "; ", def1, ")") +// +| D1Cvaldecl + (tok, mods, d1cs) => + fprint! + ( out + , "D1Cvaldecl(", tok, "; ", mods, "; ", d1cs, ")") +// +| D1Cvardecl(tok, d1cs) => + ( + fprint!(out, "D1Cvardecl(", tok, "; ", d1cs, ")") + ) +// +| D1Cfundecl + (tok, mopt, tqas, d1cs) => + fprint! + ( out + , "D1Cfundecl(", tok, "; ", mopt, "; ", tqas, "; ", d1cs, ")") +// +| D1Cimpdecl + ( tok, mopt, sqas, tqas + , dqid, tias, f1as, res0, teq1, d1e2) => + fprint! + ( out + , "D1Cimpdecl(" + , tok, "; ", mopt, "; ", sqas, "; ", tqas, "; " + , dqid, "; ", tias, "; ", f1as, "; ", res0, "; ", teq1, "; ", d1e2, ")") +// +| D1Csymload + (knd, sym, dqid, tint) => + fprint! + ( out, "D1Csymload(" + , knd, "; ", sym, "; ", dqid, "; ", tint, ")") +// +| D1Cdatasort + (knd, d1tsts) => + fprint! + ( out, "D1Cdatasort(", knd, "; ", d1tsts, ")" ) +// +| D1Cdatatype + (knd, d1typs, wopt) => + fprint! + ( out + , "D1Cdatatype(", knd, "; ", d1typs, "; ", wopt, ")") +// +| D1Cdynconst + (tok, tqas, d1cs) => + fprint! + (out, "D1Cdynconst(", tok, "; ", tqas, "; ", d1cs, ")") +// +| D1Clocal + (d1cs_head, d1cs_body) => + fprint! + (out, "D1Clocal(", d1cs_head, "; ", d1cs_body, ")") +// +| D1Ctokerr(d0c0) => fprint!(out, "D1Ctokerr(", d0c0, ")") +// +(* +| _(*rest-of-d1ecl*) => + fprint!(out, "fprint_d1ecl: D1C...: not-yet-implemented") +*) +// +) (* end of [jsonize_d1ecl] *) +*) diff --git a/contrib/sparverius/xjsonize/DATS/dynexp2.dats b/contrib/sparverius/xjsonize/DATS/dynexp2.dats new file mode 100644 index 000000000..7340bb5ce --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/dynexp2.dats @@ -0,0 +1,711 @@ +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#define XATS_targetloc "./../../../../srcgen/xats" +(* +#staload "{$XATS}/SATS/dynexp0.sats" +#staload "{$XATS}/SATS/staexp0.sats" +*) +#staload "{$XATS}/SATS/dynexp1.sats" +#staload "{$XATS}/SATS/dynexp2.sats" +(* #staload "{$XATS}/SATS/staexp2.sats" *) + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/lexing.sats" +#staload D1 = "./../SATS/dynexp1.sats" +#staload "./../SATS/label0.sats" +#staload "./../SATS/dynexp2.sats" + + +#staload "./../SATS/staexp2.sats" + +#staload SYM_J = "./../SATS/symbol.sats" +#staload STM_J = "./../SATS/stamp0.sats" + +overload jsonize with $D1.jsonize_d1exp +overload jsonize with $D1.jsonize_d1ecl + +overload jsonize with $SYM_J.jsonize_symbol +overload jsonize with $STM_J.jsonize_stamp + + +implement +jsonize_val = jsonize_d2con + +implement +jsonize_d2con + (x0) = +( +(* + labval2(nd,vl) where + { + val nd = jstr("d2con") + val sym = $SYM_J.jsonize_symbol(x0.sym()) + val stamp = $STM_J.jsonize_stamp(x0.stamp()) + val vl = list_cons(sym, list_sing(stamp)) + val vl = JSONlist(vl) + } +*) +(* + jsonval_labval1("d2con", rst) where + { + val sym = $SYM_J.jsonize_symbol(x0.sym()) + val stamp = $STM_J.jsonize_stamp(x0.stamp()) + val rst = JSONlist($list{jsonval}(sym, stamp)) + } +*) + +(* + jsonval_conarg2("d2con", sym, stamp) where + val sym = $SYM_J.jsonize_symbol(x0.sym()) + val stamp = $STM_J.jsonize_stamp(x0.stamp()) + end +*) + jsonval_labval1("d2con", rst) where + (* labval2(jsonize("d2con"), rst) where *) + val lst = $list{labjsonval}($SYM_J.labify_symbol(x0.sym()), $STM_J.labify_stamp(x0.stamp())) + val rst = JSONlablist(lst) + end + +) + +implement +jsonize_val = jsonize_d2cst + +implement +jsonize_d2cst + (x0) = +( +(* + labval2(nd, vl) where + { + val nd = jstr("d2cst") + val sym = $SYM_J.jsonize_symbol(x0.sym()) + val stamp = $STM_J.jsonize_stamp(x0.stamp()) + val vl = list_cons(sym, list_sing(stamp)) + val vl = JSONlist(vl) + } +*) + jsonval_labval1("d2cst", rst) where + (* labval2(jsonize("d2var"), rst) where *) + val lst = $list{labjsonval}( + $SYM_J.labify_symbol(x0.sym()), $STM_J.labify_stamp(x0.stamp()) + ) + val rst = JSONlablist(lst) + end + +) + + + + +implement +jsonize_val = jsonize_d2var + +implement +jsonize_d2var + (x0) = +(* +( + labval2(nd, vl) where + { + val nd = jstr("d2var") + val sym = $SYM_J.jsonize_symbol(x0.sym()) + val stamp = $STM_J.jsonize_stamp(x0.stamp()) + val vl = list_cons(sym, list_sing(stamp)) + val vl = JSONlist(vl) + } +) +*) + jsonval_labval1("d2var", rst) where + (* labval2(jsonize("d2var"), rst) where *) + val lst = $list{labjsonval}( + $SYM_J.labify_symbol(x0.sym()), $STM_J.labify_stamp(x0.stamp()) + ) + val rst = JSONlablist(lst) + end + + +implement +jsonize_val = jsonize_f2arg + +implement +jsonize_f2arg + (x0) = let +in +( +// +case+ +x0.node() of +(* +| F2ARGnone(tok) => + fprint!(out, "F2ARGnone(", tok, ")") +*) +| F2ARGsome_met(s2es) => + (* labval2(jstr("f2arg"), jsonval_sing(jsonize("F2ARGsome_met"))) *) + jsonify("F2ARGsome_met", "s2es", jstr("...")) +(* + let + (* val _ = $showtype(s2es) // s2exp *) + in + ( + labval2(jstr("f2arg"), jsonval_nil()) + ) + end +*) + (* fprint!(out, "F2ARGsome_met(", s2es, ")") *) +| F2ARGsome_dyn(npf, d2ps) => + (* labval2(jstr("f2arg"), jsonval_sing(jsonize("F2ARGsome_dyn"))) *) + jsonify("F2ARGsome_dyn", ("npf", "d2ps"), (jsonize(npf), jstr("..."))) + (* fprint!(out, "F2ARGsome_dyn(", npf, "; ", d2ps, ")") *) +(* + let + (* val _ = $showtype(npf) *) + in + jnul() + end +*) + +| F2ARGsome_sta(s2vs, s2ps) => + (* labval2(jstr("f2arg"), jsonval_sing(jsonize("F2ARGsome_sta"))) *) + jsonify("F2ARGsome_sta", ("s2vs", "s2ps"), (jstr("..."), jstr("..."))) + (* fprint!(out, "F2ARGsome_sta(", s2vs, "; ", s2ps, ")") *) +(* + let + (* val _ = $showtype(s2vs) *) + in + jnul() + end +*) + +) +end + + + + +implement +jsonize_val = jsonize_d2pat + +implement +jsonize_d2pat + (x0) = labval2(jsonize("d2pat"), res) where +val res = +( +case- x0.node() of +// +| D2Pint(tok) => + (* fprint!(out, "D2Pint(", tok, ")") *) + labval2(jsonize("D2Pint"), jnul()) +| D2Pbtf(tok) => + labval2(jsonize("D2Pbtf"), jnul()) // tok, ")") +| D2Pchr(tok) => + labval2(jsonize("D2Pchr"), jnul()) // tok, ")") +| D2Pflt(tok) => + labval2(jsonize("D2Pflt"), jnul()) // tok, ")") +| D2Pstr(tok) => + labval2(jsonize("D2Pstr"), jnul()) // tok, ")") +// +| D2Pvar(d2v) => + labval2(jsonize("D2Pvar"), jnul()) // d2v, ")") +// +| D2Pcon1(d2c0) => + labval2(jsonize("D2Pcon1"), jnul()) // d2c0, ")") +| D2Pcon2(d2cs) => + labval2(jsonize("D2Pcon2"), jnul()) // d2cs, ")") +// +| D2Psym0(sym, d2pis) => + ( + labval2(jsonize("D2Psym0"), jnul()) // sym, ")"); +(* + labval2(jsonize("D2Psym0"), jnul()) // sym, "; ", d2pis, ")"); +*) + ) +// +| D2Psapp(d2f0, s2vs) => + labval2(jsonize("D2Psapp"), jnul()) // d2f0, "; ", s2vs, ")") +| D2Pdapp(d2f0, npf0, d2ps) => + labval2(jsonize("D2Pdapp"), jnul()) // d2f0, "; ", npf0, "; ", d2ps, ")") +// +| D2Ptuple(knd, npf, d2ps) => + labval2(jsonize("D2Ptuple"), jnul()) // knd, "; ", npf, "; ", d2ps, ")") +// +| D2Panno(d2p1, s2e2) => + labval2(jsonize("D2Panno"), jnul()) // d2p1, "; ", s2e2, ")") +// +| D2Pnone0() => + labval2(jsonize("D2Pnone0"), jnul()) // ")") +| D2Pnone1(d1psrc) => + labval2(jsonize("D2Pnone1"), jnul()) // d1psrc, ")") +// +) (* end of [jsonize_d2pat] *) +end + + + + +implement +jsonize_val = jsonize_d2exp + +implement +jsonize_d2exp + (x0) = labval2(jsonize("d2exp"), res) where +val res = +( +case- x0.node() of +// +| D2Eint(tok) => + labval2(jsonize("D2Eint"), jsonize(tok)) // tok, ")") +| D2Ebtf(tok) => + labval2(jsonize("D2Ebtf"), jsonize(tok)) // tok, ")") +| D2Echr(tok) => + labval2(jsonize("D2Echr"), jsonize(tok)) // tok, ")") +| D2Eflt(tok) => + labval2(jsonize("D2Eflt"), jsonize(tok)) // tok, ")") +| D2Estr(tok) => + labval2(jsonize("D2Estr"), jsonize(tok)) // tok, ")") +// +| D2Etop(tok) => + labval2(jsonize("D2Etop"), jsonize(tok)) // tok, ")") +// +| D2Evar(d2v) => + + labval2(jsonize("D2Evar"), jsonize(d2v)) // d2v, ")") +// +| D2Ecst1(d2c) => + labval2(jsonize("D2Ecst1"), jsonize(d2c)) // d2c, ")") +| D2Econ1(d2c) => + labval2(jsonize("D2Econ1"), jsonize(d2c)) // d2c, ")") +| D2Ecst2(d2cs) => + labval2(jsonize("D2Ecst2"), j_d2cs) // d2cs, ")") + where + val j_d2cs = jsonize_list(d2cs) + end +| D2Econ2(d2cs) => + labval2(jsonize("D2Econ2"), j_d2cs) // d2cs, ")") + where + val j_d2cs = jsonize_list(d2cs) + end +// +| D2Esym0 + (d1e1, dpis) => + labval2(jsonize("D2Esym0"), jnul()) // d1e1, ")") + (* where *) + (* val _ = $showtype(d1e1) *) + (* end *) + +(* + fprint! + (out, "D2Esym0"), jnul()) // d1e1, "; ", dpis, ")") +*) +// +| D2Esapp + (d2f0, s2as) => + labval2(jsonize("D2Esapp"), jnul()) // d2f0, "; ", s2as, ")") +| D2Etapp + (d2f0, s2as) => + labval2(jsonize("D2Etapp"), jnul()) // d2f0, "; ", s2as, ")") +| D2Edapp + (d2f0, npf0, d2as) => + labval2(jsonize("D2Edapp"), jnul()) // d2f0, "; ", npf0, "; ", d2as, ")") +// +| D2Elet + (d2cs, d2e2) => + labval2(jsonize("D2Elet"), jnul()) // d2cs, "; ", d2e2, ")") +| D2Ewhere + (d2e1, d2cs) => + labval2(jsonize("D2Ewhere"), jnul()) // d2e1, "; ", d2cs, ")") +// +| D2Eseqn + (d2es, d1e1) => + labval2(jsonize("D2Eseqn"), jnul()) // d2es, "; ", d1e1(*last*), ")") +// +| D2Etuple + (knd, npf, d2es) => + labval2(jsonize("D2Etuple"), jnul()) // knd, "; ", npf, "; ", d2es, ")") +// +| D2Eassgn + (d2e1, d2e2) => + labval2(jsonize("D2Eassgn"), jnul()) // d2e1, "; ", d2e2, ")") +// +| D2Edtsel + ( lab0 + , dpis, npf2, arg3) => + ( + case+ + arg3 of + | + None() => + labval2(jsonize("D2Edtsel"), jnul()) // lab0, "(", dpis, ")", ")") + | + Some(d2es) => + labval2(jsonize("D2Edtsel"), jnul()) // lab0, "(", dpis, ")", "(", npf2, "; ", d2es, ")", ")") + ) +// +| D2Eif0 + (d2e1, d2e2, opt3) => + labval2(jsonize("D2Eif0"), jnul()) // d2e1, "; ", d2e2, "; ", opt3, ")") +// +| D2Ecase + (knd, d2e1, d2cls) => + labval2(jsonize("D2Ecase"), jnul()) // knd, "; ", d2e1, "; ", d2cls, ")") +// +| D2Elam + (knd, f2as, tres, arrw, body) => + labval2(jsonize("D2Elam"), jnul()) // knd, "; ", f2as, "; ", tres, "; ", arrw, "; ", body, ")") +| D2Efix + (knd, fid, f2as, tres, arrw, body) => + labval2(jsonize("D2Efix"), jnul()) // knd, "; ", fid, "; ", f2as, "; ", tres, "; ", arrw, "; ", body, ")") +// +| D2Eaddr(d2e1) => + labval2(jsonize("D2Eaddr"), jnul()) // d2e1, ")") +| D2Efold(d2e1) => + labval2(jsonize("D2Efold"), jnul()) // d2e1, ")") +// +| D2Eanno(d2e1, s2e2) => + labval2(jsonize("D2Eanno"), jnul()) // d2e1, "; ", s2e2, ")") +// +| D2Enone0() => labval2(jsonize("D2Enone0"), jnul()) // ")") +| D2Enone1(d1esrc) => labval2(jsonize("D2Enone1"), jnul()) // d1esrc, ")") +// +) +end // end of where + + + +local + +implement +jsonize_val = jsonize_d2ecl +implement +jsonize_val = jsonize_v2aldecl +implement +jsonize_val = jsonize_v2ardecl +implement +jsonize_val = jsonize_f2undecl + +in (* in-of-local *) + +implement +jsonize_d2ecl + (x0) = +( +case- x0.node() of +// +| D2Cstatic + (tok, d2c) => + jsonify("D2static", "d2c", jsonize(d2c)) +| D2Cextern + (tok, d2c) => + jsonify("D2extern", ("tok", "d2c"), (jsonize(tok), jsonize(d2c))) +// +| D2Cinclude + ( tok + , src, knd + , fopt, body) => + jsonify("D2Cinclude", + ( + "tok", "src", "knd", "fopt", "body" + ), + ( + jsonize(tok), + jsonize(src), + jsonize(knd), + jsonize("..."), + jsonize(body) + ) where + + val body = + ( + case+ body of + | None _ => "None()" + | Some _ => "Some()" + ): string + end + ) +// +| D2Cstaload + ( tok + , src, knd + , fopt, flag, body) => + jsonify("D2Cinclude", + ( + "tok", "src", "knd", "fopt", "flag", "body" + ), + ( + jsonize(tok), + jsonize(src), + jsonize(knd), + jsonize("..."), + jsonize(flag), + jsonize(body) + ) where + val body = + ( + case+ body of + | None _ => "None()" + | Some _ => "Some()" + ): string + end + ) +// +| D2Clocal(head, body) => + jsonify("D2Clocal", ("head", "body"), (jsonize("..."), jsonize("..."))) +// +| D2Cabssort(d1c) => + jsonify("D2Cabssort", "d1c", jsonize("...")) +// +| D2Cstacst0(s2c, s2t) => + jsonify("D2Cstacst0", ("s2c", "s2t"), (jsonize(s2c), jsonize(s2t))) +// +| D2Csortdef(sym, s2tx) => + jsonify("D2Csortdef", ("sym", "s2tx"), (jsonize(sym), jsonize("..."))) +// +| D2Csexpdef(s2c, s2e) => + jsonify("D2Csexpdef", ("s2c", "s2e"), (jsonize(s2c), jsonize(s2e))) +// +| D2Cabstype(s2c, df2) => + jsonify("D2Cabstype", ("s2c", "df2"), (jsonize(s2c), jsonize("..."))) +// +| D2Cabsimpl + (knd, sqid, def0) => + jsonify( + "D2Csymload", + ( + "knd", "sqid", "def0" + ), + ( + jsonize(knd), + jsonize("..."), + jsonize(def0) + ) + ) + +// +| D2Csymload + (tok, sym0, dpi1) => + jsonify( + "D2Csymload", + ( + "tok", "sym0", "dpi1" + ), + ( + jsonize(tok), + jsonize(sym0), + jsonize("...") + ) + ) +// +| D2Cvaldecl + (knd, mopt, v2ds) => + jsonify( + "D2Cvaldecl", + ( + "knd", "mopt", "v2ds" + ), + ( + jsonize(knd), + jsonize(mopt), + jsonize("...") + ) + ) + +| D2Cfundecl + (knd, mopt, tqas, f2ds) => + jsonify( + "D2Cfundecl", + ( + "knd", "mopt", "tqas", "f2ds" + ), + ( + jsonize(knd), + jsonize(mopt), + jsonize("..."), + jsonize("...") + ) + ) + +// +| D2Cvardecl(knd, v2ds) => + jsonify("D2Cvardecl", ("knd", "v2ds"), (jsonize(knd), jsonize("..."))) +// +| D2Cimpdecl1 + ( knd, mopt, sqas, tqas + , dqid, tias, f2as, res0, d2e1) => + jsonify( + "D2Cimpdecl1", + ( + "knd", "mopt", "sqas", "tqas", "dqid", "tias", "f2as", "res0", "d2e1" + ), + ( + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("...") + ) + ) +| D2Cimpdecl2 + ( knd, mopt, sqas, tqas + , dqid, tias, f2as, res0, d2e1) => + jsonify( + "D2Cimpdecl2", + ( + "knd", "mopt", "sqas", "tqas", "dqid", "tias", "f2as", "res0", "d2e1" + ), + ( + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("...") + ) + ) +// +| D2Cdatasort(d1c) => + jsonify("D2Cdatasort", "d1c", jsonize(d1c)) +| D2Cdatatype(d1c) => + jsonify("D2Cdatatype", "d1c", jsonize(d1c)) +// +| D2Cdynconst + (knd, tqas, d2cs) => + jsonify( + "D2Cdynconst", + ( + "knd", "tqas", "d2cs" + ), + ( + jsonize("..."), + jsonize("..."), + jsonize("...") + ) + ) +// +| D2Cnone0() => + jsonify("D2Cnone0") +| D2Cnone1(d1csrc) => + jsonify("D2Csortdef", "d1csrc", jsonize(d1csrc)) +// +) (* end of [fprint_d2ecl] *) + +end // end of [local] + + +(* +implement +fprint_d2itm + (out, x0) = +( +case+ x0 of +// +| D2ITMvar(d2v0) => + fprint!(out, "D2ITMvar(", d2v0, ")") +// +| D2ITMcon(d2cs) => + fprint!(out, "D2ITMcon(", d2cs, ")") +// +| D2ITMcst(d2cs) => + fprint!(out, "D2ITMcst(", d2cs, ")") +// +| D2ITMsym(sym, dpis) => + fprint! + (out, "D2ITMsym(", sym, "; ", dpis, ")") +// +) (* end of [fprint_d2itm] *) +// +implement +fprint_d2pitm + (out, x0) = +( +case+ x0 of +| D2PITMnone(dqid) => + fprint!(out, "D2PITMnone(", dqid, ")") +| D2PITMsome(pval, d2i0) => + fprint! + (out, "D2PITMsome(", pval, "; ", d2i0, ")") +) +*) + + + + +local + +implement +jsonize_val = jsonize_s2var + +in + +implement +jsonize_sq2arg + (x0) = +( + jsonval_labval1("sq2arg", jsonize_list(x0.s2vs())) +) (* end of [fprint_sq2arg] *) + +end + + +implement +jsonize_tq2arg + (x0) = +( + (* fprint!(out, "<", x0.s2vs(), ">") *) + jsonval_labval1("tq2arg", jstr("...")) +) (* end of [jsonize_tq2arg] *) + + +implement +jsonize_ti2arg + (x0) = +( + jsonify("ti2arg", "s2es", rst) + where + val rst = jsonize("...") + (* val _ = $showtype(x0.s2es()) *) + end +) (* end of [jsonize_ti2arg] *) + + +local + +implement jsonize_val = jsonize_d2cst + +in + +implement +jsonize_impld2cst + (x0) = +( +case+ x0 of +| +IMPLD2CST1(dqid, d2cs) => + jsonify("IMPLD2CST1", ("d2qid", "d2cs"), ( + jsonize(dqid), jsonize_list(d2cs)) + ) +| +IMPLD2CST2(dqid, d2cs, opt2) => + jsonify("IMPLD2CST2", ("d2qid", "d2cs", "opt"), ( + jsonize(dqid), jsonize_list(d2cs), jstr("...") + ) + ) +) // end of [fprint_impld2cst] + +end diff --git a/contrib/sparverius/xjsonize/DATS/dynexp3.dats b/contrib/sparverius/xjsonize/DATS/dynexp3.dats new file mode 100644 index 000000000..9b7982f0b --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/dynexp3.dats @@ -0,0 +1,57 @@ + +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#define XATS_targetloc "./../../../../srcgen/xats" +(* +#staload "{$XATS}/SATS/dynexp0.sats" +#staload "{$XATS}/SATS/staexp0.sats" +*) +#staload "{$XATS}/SATS/dynexp1.sats" +#staload "{$XATS}/SATS/dynexp2.sats" +#staload "{$XATS}/SATS/dynexp3.sats" +(* #staload "{$XATS}/SATS/staexp2.sats" *) + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/lexing.sats" +#staload "./../SATS/dynexp1.sats" +#staload "./../SATS/label0.sats" +#staload "./../SATS/dynexp2.sats" +#staload "./../SATS/dynexp3.sats" +#staload "./../SATS/statyp2.sats" + +#staload "./../SATS/staexp2.sats" + +(* +#staload SYM_J = "./../SATS/symbol.sats" +#staload STM_J = "./../SATS/stamp0.sats" +*) + + +local + +implement jsonize_val = jsonize_t2ype + +in + +implement +jsonize_ti3arg + (x0) = +( +case+ x0 of +| TI3ARGnone() => + jsonify("TI3ARGnone") +| TI3ARGsome(t2ps) => + jsonify("TI3ARGnone", "t2ps", jsonize_list(t2ps)) +) + +end diff --git a/contrib/sparverius/xjsonize/DATS/interp0.dats b/contrib/sparverius/xjsonize/DATS/interp0.dats new file mode 100644 index 000000000..b2af8ecc2 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/interp0.dats @@ -0,0 +1,1334 @@ +(***********************************************************************) +(* *) +(* Applied Type System *) +(* *) +(***********************************************************************) + +(* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*) + +(* ****** ****** *) +// +// Author: Hongwei Xi +// Start Time: November, 2019 +// Authoremail: gmhwxiATgmailDOTcom +// +(* ****** ****** *) +// +// HX-2019-11-02: level-1 interpreter +// +(* ****** ****** *) +// +%{^ +// +extern +void +libxatsopt_dynloadall(); +// +%} (* %{^ *) +val () = +$extfcall +(void, "libxatsopt_dynloadall") +// +(* ****** ****** *) +// +#include +"share/atspre_staload.hats" +#staload +UN = "prelude/SATS/unsafe.sats" +// +(* ****** ****** *) +// +#include +"./../HATS/libxatsopt.hats" +// +(* ****** ****** *) +// +#staload "./../SATS/json.sats" +#staload "./../SATS/basics.sats" +#staload "./../SATS/fixity.sats" +#staload "./../SATS/label0.sats" +#staload "./../SATS/locinfo.sats" +#staload "./../SATS/lexing.sats" +#staload "./../SATS/stamp0.sats" +#staload "./../SATS/symbol.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp1.sats" +#staload "./../SATS/dynexp1.sats" +#staload "./../SATS/statyp2.sats" +#staload "./../SATS/staexp2.sats" +#staload "./../SATS/dynexp2.sats" +#staload "./../SATS/dynexp3.sats" +#staload "./../SATS/intrep0.sats" +(* #staload "./../SATS/trans01.sats" *) + + +#staload _ = "./json.dats" +#staload _ = "./basics.dats" +#staload _ = "./label0.dats" +#staload _ = "./locinfo.dats" +#staload _ = "./lexing_token.dats" +#staload _ = "./staexp0.dats" +#staload _ = "./dynexp0.dats" +#staload _ = "./stamp0.dats" +#staload _ = "./symbol.dats" +#staload _ = "./staexp1.dats" +#staload _ = "./dynexp1.dats" +#staload _ = "./statyp2.dats" +#staload _ = "./staexp2.dats" +#staload _ = "./dynexp2.dats" +#staload _ = "./dynexp3.dats" +#staload _ = "./intrep0.dats" + +#staload _ = "./json.dats" + +implement jsonize_val = jsonize_d2ecl + +(* #dynload "./json.dats" *) +(* #dynload "./basics.dats" *) +(* #dynload "./stamp0.dats" *) +(* #dynload "./symbol.dats" *) +(* #dynload "./label0.dats" *) +(* #dynload "./locinfo.dats" *) +(* #dynload "./lexing_token.dats" *) +(* #dynload "./staexp0.dats" *) +(* #dynload "./dynexp0.dats" *) +(* #dynload "./staexp1.dats" *) +(* #dynload "./dynexp1.dats" *) +(* #dynload "./statyp2.dats" *) +(* #dynload "./staexp2.dats" *) +(* #dynload "./dynexp2.dats" *) +(* #dynload "./dynexp3.dats" *) +(* #dynload "./intrep0.dats" *) + +#staload "./../SATS/interp0.sats" +// + +(* ****** ****** *) +// +#staload +STDIO = "libats/libc/SATS/stdio.sats" +// +(* ****** ****** *) +// +datatype +commarg = +| COMMARG of (int, string) +// +typedef +commarglst + (n:int) = list(commarg, n) +// +(* ****** ****** *) +// +extern +fun +parse_commarg +( string +) :<> commarg +and +parse_commarglst + {n:nat} +( argc: int(n) +, argv: !argv(n) +) : commarglst(n) +// +(* ****** ****** *) + +implement +parse_commarg + (inp) = let +// +fun +loop +{n,i:nat|i <= n} .. +( + inp: string n, n: int n, i: int i +) :<> commarg = +( +if +(i < n) +then ( +if (inp[i] != '-') + then COMMARG(i, inp) else loop(inp, n, i+1) +) else COMMARG(n, inp) +// end of [if] +) (* end of [if] *) +// end of [loop] +// +in +// +if +(inp = "-") +then +( +COMMARG(0, inp) +) +else +( + loop(inp, sz2i(len), 0) +) where +{ + val inp = g1ofg0(inp); val len = string_length(inp) +} +// +end // end of [parse_commarg] +// +(* ****** ****** *) + +implement +parse_commarglst + {n}(argc, argv) = let +// +vtypedef +arglst(n:int) = list_vt(commarg, n) +// +fun +loop +{i:nat | i <= n}{l:addr} .. +( pf0: arglst(0) @ l +| argv: !argv(n), i: int i, p0: ptr l +) : (arglst(n-i) @ l | void) = +( +// +if +i < argc +then let + val+~list_vt_nil() = !p0 + val x = parse_commarg(argv[i]) + val () = + ( !p0 := + list_vt_cons(x, list_vt_nil()) + ) (* end of [val] *) + val+@list_vt_cons(_, xs) = !p0 + val (pf | ()) = + loop (view@xs | argv, i+1, addr@xs) // tail-call + // end of [val] +in + fold@(!p0); (pf0 | ()) +end // end of [then] +else (pf0 | ()) // end of [else] +// +) (* end of [loop] *) +// +in +// +list_vt2t +( +res where +{ +var res: ptr? +// +val () = +res := list_vt_nil{commarg}() +val +(pf | ()) = +loop +(view@res | argv, 0, addr@res) +// end of [val] +prval ((*void*)) = view@res := pf +// +} +) (* end of [list_vt2t] *) +// +end // end of [parse_commarglst] + +(* ****** ****** *) +// +extern +fun +print_commarg(commarg): void +extern +fun +prerr_commarg(commarg): void +extern +fun +fprint_commarg +(out: FILEref, x0: commarg): void +// +(* ****** ****** *) +// +implement +print_commarg(x0) = +fprint_commarg(stdout_ref, x0) +implement +prerr_commarg(x0) = +fprint_commarg(stderr_ref, x0) +implement +fprint_commarg(out, x0) = +( +case+ x0 of +| COMMARG(i, k) => + fprint!(out, "COMMARG(", i, ", ", k, ")") +) (* end of [fprint_commarg] *) +// +(* ****** ****** *) +// +extern +fun +xatsopt_usage +( out: FILEref +, arg0: commarg): void +implement +xatsopt_usage + (out, arg0) = let +// +val+COMMARG(_, cmdname) = arg0 +// +in +// +fprintln! +(out, "Usage: ", cmdname, " ... \n"); +fprintln! +(out, "where a is of one of the following forms:\n"); +// +fprintln! (out, " -h (for printing out this help usage)"); +fprintln! (out, " --help (for printing out this help usage)"); +// +fprintln! (out, " -v (for printing out the version)"); +fprintln! (out, " --version (for printing out the version)"); +// +fprintln! (out, " -s (for compiling static filenames)"); +fprintln! (out, " --static (for compiling static filenames)"); +// +fprintln! (out, " -d (for compiling dynamic filenames)"); +fprintln! (out, " --dynamic (for compiling dynamic filenames)"); +// +fprintln! (out, " -o (output into filename)"); +fprintln! (out, " --output (output into filename)"); +fprintln! (out, " --output-w (output-write into filename)"); +fprintln! (out, " --output-a (output-append into filename)"); +// +(* +fprintln! (out, " -cc (for compiling into C)"); +fprintln! (out, " --compile (for compiling into C)"); +*) +// +(* +fprintln! (out, " -tc (for typechecking only)"); +fprintln! (out, " --tycheck (for typechecking only)"); +*) +// +fprint_newline (out); // HX: needed for flushing out the output +// +end // end of [xatsopt_usage] +// +(* ****** ****** *) +// +extern +fun +xatsopt_version + (out: FILEref): void +implement +xatsopt_version + (out) = let + val MAJOR = 0 + val MINOR = 0 + val MICRO = 0 +in + fprint!(out, "ATS/Xanadu version "); + fprint!(out, MAJOR, ".", MINOR, ".", MICRO); + fprintln!(out, " Copyright (c) 2018-20?? Hongwei Xi") +end // end of [xatsopt_version] +// +(* ****** ****** *) +// +extern +fun +the_fixity_load +( +XATSHOME: string +) : void = + "ext#libxatsopt_the_fixity_load" +extern +fun +the_basics_load +( +XATSHOME: string +, +stadyn: int, given: string +) : void = + "ext#libxatsopt_the_basics_load" +// +extern +fun +the_prelude_load +( +XATSHOME: string +, +stadyn: int, given: string +) : void = + "ext#libxatsopt_the_prelude_load" +// +extern +fun +the_preludes_load +( + XATSHOME: string +) : void = + "ext#libxatsopt_the_preludes_load" +extern +fun +the_preludes_load_if +( + XATSHOME: string, flag: &int +) : void = + "ext#libxatsopt_the_preludes_load_if" +// +(* ****** ****** *) +// +datatype +waitknd = + | WTKnone of () + | WTKoutput of () // -o ... + | WTKinpsta of () // -s ... + | WTKinpdyn of () // -d ... + | WTKdefine of () // -DATS ... + | WTKinpath of () // -IATS ... +// end of [waitkind] +// +fun +waitknd_get_stadyn +(knd: waitknd): int = +( +case+ knd of +| WTKinpsta() => 0 +| WTKinpdyn() => 1 +| _ (*rest-of-WTK*) => ~1 +) // end of [waitkind_get_stadyn] +// +(* ****** ****** *) +// +datatype +outchan = +| OUTCHANref of (FILEref) +| OUTCHANptr of (FILEref) +// end of [outchan] + +fun +outchan_get_filref + (x0: outchan): FILEref = +( +case+ x0 of +| OUTCHANref(filr) => filr +| OUTCHANptr(filr) => filr +) (* end of [outchan_get_filref] *) +// +(* ****** ****** *) +// +typedef +cmdstate = @{ +// +arg0= commarg +, +wtk0= waitknd +, +ATSHOME= string +, +prelude= int +, +inpfil0=fpath_t +, +// the number of inputs +ninpfil= int // processed +// +, outmode= fmode +, outchan= outchan +// +// the number of caught +, nxerror= int // errors +// +} (* end of [cmdstate] *) +// +(* ****** ****** *) +// +fun +isinpwait +( + st0: cmdstate +) : bool = +( +case+ +st0.wtk0 +of // case+ + | WTKinpsta() => true + | WTKinpdyn() => true +(* + | WTKinpdyns() => true +*) + | _ (*non-WTKinput*) => false +) // end of [isinpwait] + +fun +isoutwait + (st0: cmdstate): bool = +( +case+ +st0.wtk0 of +| WTKoutput() => true +| _(*non-WTKoutput*) => false +) (* end of [isoutwait] *) + +fun +isdatswait + (st0: cmdstate): bool = +( +case+ +st0.wtk0 of +| WTKdefine() => true +| _(*non-WTKdefine*) => false +) (* end of [isdatswait] *) + +fun +isiatswait + (st0: cmdstate): bool = +( +case+ +st0.wtk0 of +| WTKinpath() => true +| _(*non-WTKinpath*) => false +) (* end of [isiatswait] *) +// +(* ****** ****** *) + +local + +extern +praxi +vbox_make_view_ptr +{a:vt0ype}{l:addr} +// statically allocated reference +(a @ l | ptr(l)):<> vbox(a @ l) + +var +theOutFname: Stropt = stropt_none() +// +prval pf0 = +vbox_make_view_ptr +{Stropt}{..} +(view@theOutFname | addr@theOutFname) +// end of [val] + +in (* in-of-local *) + +fun +theOutFname_get +( +// argless +) : Stropt = out where +{ +// +prval vbox(pf) = pf0 +// + val out = theOutFname +// + val ((*void*)) = + theOutFname := stropt_none() +// +} // end of [theOutFname_get] + +fun +theOutFname_set + (fname: Stropt) = () where +{ +// +prval vbox(pf) = pf0 +// + val () = theOutFname := fname +// +} // end of [theOutFname_set] + +end // end of [local] + +(* ****** ****** *) + +fun +cmdstate_set_outchan +( +st0: &cmdstate >> _, out1: outchan +) : void = let + val out0 = st0.outchan + val ((*void*)) = st0.outchan := out1 +in +// +case+ out0 of +| OUTCHANref _ => () +| OUTCHANptr(filr) => let + val err = $STDIO.fclose0(filr) in (*nothing*) + end // end of [OUTCHANptr] +// +end // end of [cmdstate_set_outchan] + +(* ****** ****** *) +// +extern +fun +outchan_make_fname +( st0 +: &cmdstate, fname: string +) : outchan // end-of-fun +implement +outchan_make_fname + (st0, fname) = +( +case+ fname of +| "-" => OUTCHANref(stdout_ref) +// +| _(*unspecial*) => auxmain(st0, fname) +// +) where +{ +fun +auxmain +( st0 +: &cmdstate, fname: string +) : outchan = let +// +val +filp = +$STDIO.fopen(fname, st0.outmode) +// +in +// +if +$STDIO.iseqz(filp) +then +( + OUTCHANref(stderr_ref) +) where +{ +prval () = +$STDIO.FILEptr_free_null(filp) +} (* end of [then] *) +else +( + OUTCHANptr + ($UN.castvwtp0{FILEref}(filp)) +) (* end of [else] *) +// +end // end of [auxmain] +// +} (* end of [outchan_make_path] *) + +(* ****** ****** *) +// +extern +fun +xatsopt_commarg_warning + (out: FILEref, arg: string): void +implement +xatsopt_commarg_warning + (out, arg) = () where +{ +// +val () = +fprint(out, "WARNING(ATS)") +val () = +fprintln! +( out +, ": unrecognized command-line argument [", arg, "] is skipped." +) (* end of [val] *) +// +} (* end of [xatsopt_commarg_warning] *) +// +(* ****** ****** *) + +local +// +static +fun +process_stdin +(st0: &cmdstate >> _): void +static +fun +process_fpath +( st0 +: &cmdstate >> _, fp0: fpath_t): void +static +fun +process_given +( st0 +: &cmdstate >> _, given: string): void +// +static +fun +process_cmdline + {n:nat} +( st0: &cmdstate >> _ +, args: commarglst(n)): void +and +process_cmdline2 + {n:nat} +( st0: &cmdstate >> _ +, arg0: commarg, args: commarglst(n)): void +// +implement +process_stdin + (st0) = +( +process_fpath(st0, fp0) +) where +{ + val + fp0 = $FP0.the_filpath_stdin +} +implement +process_fpath + (st0, fp0) = let +// +val +wtk0 = st0.wtk0 +val +stadyn = +waitknd_get_stadyn(wtk0) +// +val +XATSHOME = st0.ATSHOME +// +val () = +ifcase +| +$FP0.filpath_is_stdin(fp0) => +$FP0.the_dirpathlst_ppush_cwd() +| _ (* regular filename *) => +let +val +dp0 = +$FP0.dirpath_make +($FP0.filpath_get_dirname(fp0)) +val () = +let +val out = stdout_ref +in +fprint(out, "dirpath = "); +$FP0.fprintln_dirpath(out, dp0) +end +in + $FP0.the_filpathlst_ppush(fp0); + $FP0.the_dirpathlst_ppush(dp0) +end (* let *) // end of [ifcase] +// +in +// +if +( +stadyn >= 0 +) +then +{ +// +val () = +the_preludes_load_if +(XATSHOME, st0.prelude) +// end of [val] +// +val () = (st0.inpfil0 := fp0) +val +(pf0 | ()) = +$FP0.the_filpathlst_push(fp0) +val +d0cs = +let +val opt = +parse_from_filpath_toplevel + (stadyn, fp0) +in +case+ opt of +| ~Some_vt(d0cs) => d0cs +| ~None_vt((*void*)) => list_nil() +end : d0eclist // end-of-val +// +prval () = $UN.castview0{void}(pf0) +(* +val +((*popped*)) = +$FP0.the_filpathlst_pout(pf0 | (*none*)) +*) +// +(* +val () = +println! +("process_fpath: d0cs = ", d0cs) +*) +// +val () = synread_main(d0cs) +// +val +d1cs = trans01_declist(d0cs) +(* +val () = +println! +("process_fpath: d1cs = ", d1cs) +*) +// +val () = t1xread_main(d1cs) +// +val +d2cs = trans12_declist(d1cs) + +(* val _ = $showtype(d2cs) *) +val () = println!("\n\n", "JSONIZED", "\n\n") +val json = jsonize_list(d2cs) +val () = fprint_jsonval(stdout_ref, json) +val () = println!() +(* +(* +val () = +println! +("process_fpath: d2cs = ", d2cs) +*) +// +val () = t2xread_main(d2cs) +// +val +d3cs = trans23_declist(d2cs) +(* +val () = +println! +("process_fpath: d3cs = ", d3cs) +*) +val +d3cs = trans33_declist(d3cs) +(* +val () = +println! +("process_fpath: d3cs = ", d3cs) +*) +val () = t3xread_main(d3cs) +// +val +d3cs = trans3t_program(d3cs) +(* +val () = +println! +("process_fpath: d3cs = ", d3cs) +*) +// +val () = +println! +("process_fpath: the_sortenv:") +val () = +( + the_sortenv_println((*void*)) +) +// +val () = +println! +("process_fpath: the_sexpenv:") +val () = +( + the_sexpenv_println((*void*)) +) +// +val () = +println! +("process_fpath: the_dexpenv:") +val () = +( + the_dexpenv_println((*void*)) +) +// +(* +val +irdcls = irerase_declist(d3cs) +val () = +println! +("process_fpath: irdcls = ", irdcls) +*) +// +(* val () = *) +(* interp0_program(irdcls) *) + +(* val () = println!("process_fpath: jsonized d2varmap = ") *) +(* val xys = interp0_jsonize_d2varmap() *) +(* val () = fprint_jsonval(stdout_ref, xys) *) + +(* val () = fprint_newline(stdout_ref) *) + +(* val () = *) +(* interp0_fprint_d2varmap(stdout_ref) *) +*) + + +val () = fprint_newline(stdout_ref) +// +} (* end of [then] *) +else +{ +// ~(stadyn >= 0) // not for loading code +} (* end of [else] *) +// +end // end of [process_fpath] +// +implement +process_given + (st0, arg0) = let +// +val fp0 = +let +val given = arg0 +val fname = arg0 +in +fpath_make(given, fname) +end +// +(* +val () = +println! +("process_given: arg0 = ", arg0) +*) +// +in + process_fpath(st0, fp0) +end // end of [process_given] +// +implement +process_cmdline + (st0, args) = let +in +// +case+ args of +// +| list_nil() => + ( + if + st0.ninpfil = 0 + then process_stdin(st0) else () + ) +// +| list_cons + (arg0, args) => + ( + process_cmdline2(st0, arg0, args) + ) +// +end // end of [process_cmdline] +// +implement +process_cmdline2 + (st0, arg0, args) = let +// +(* +val () = +println! +("process_cmdline2: arg0 = ", arg0) +*) +// +fun +auxkey1 +( st0: + &cmdstate >> _ +, key: string): void = let +// +val () = +(st0.wtk0 := WTKnone()) +// +val () = +( +case+ key of +// +| "-o" => + { + val () = + (st0.wtk0 := WTKoutput()) + } (* end of [-o] *) +| "-s" => + { + val () = + (st0.ninpfil := 0) + val () = + (st0.wtk0 := WTKinpsta()) + } (* end of [-s] *) +| "-d" => + { + val () = + (st0.ninpfil := 0) + val () = + (st0.wtk0 := WTKinpdyn()) + } (* end of [-d] *) +(* +| "-dd" => + { + val () = + (st0.ninpfil := 0) + val () = + (st0.waitknd := WTKinpdyns()) + } (* end of [-dd] *) +*) +// +(* +| "-cc" => (st0.tcflag := 0) +| "-tc" => (st0.tcflag := 1) +*) +// +(* +| "-dep" => (st0.depgen := 1) +| "-tag" => (st0.taggen := 1) +*) +// +(* +| _ when + is_DATS_flag(key) => let + val def = DATS_extract(key) + val issome = stropt_is_some(def) + in + if + issome + then + ( + process_DATS_def(def) where + { + val def = stropt_unsome(def) + } + ) + else let + val () = + (st0.wtk0 := WTKdefine(*void*)) + // end of [val] + in + // nothing + end // end of [else] // end of [if] + end // end of [is_DATS_flag] +*) +(* +| _ when + is_IATS_flag(key) => let + val path = IATS_extract(key) + val issome = stropt_is_some(path) + in + if + issome + then + ( + process_IATS_dir(path) where + { + val path = stropt_unsome(path) + } + ) + else let + val () = + (st0.wtk0 := WTKinclude(*void*)) + // end of [val] + in + // nothing + end // end of [else] // end of [if] + end // end of [is_IATS_flag] +*) +// +| "-h" => + ( + xatsopt_usage + (stdout_ref, st0.arg0) + // xatsopt_usage + ) +| "-v" => + ( + xatsopt_version(stdout_ref) + ) +// +| _ (*rest*) => + ( // + // HX: unrecognized key + // + xatsopt_commarg_warning(stderr_ref, key) + ) (* end of [rest] *) +// +) : void // end of [val] +// +in + process_cmdline(st0, args) +end // end of [auxkey1] +// +fun +auxkey2 +( st0: + &cmdstate >> _ +, key: string): void = let +// +val () = + (st0.wtk0 := WTKnone()) +// +val () = +( +case+ key of +// +| "--output" => + ( + st0.wtk0 := WTKoutput() + ) +| "--output-w" => + { + val () = st0.wtk0 := WTKoutput() + val () = st0.outmode := file_mode_w + } // end of [--output-w] +| "--output-a" => + { + val () = st0.wtk0 := WTKoutput() + val () = st0.outmode := file_mode_a + } // end of [--output-a] +// +| "--static" => + { + val () = st0.wtk0 := WTKinpsta() + } // end of [--static] +| "--dynamic" => + { + val () = st0.wtk0 := WTKinpdyn() + } // end of [--dynamic] +// +(* +| "--dynamics" => + { + val () = st0.wtk0 := WTKinpdyns() + } // end of [--dynamics] +*) +// +(* +| "--compile" => (st0.tycheckflag := 0) +| "--tycheck" => (st0.tycheckflag := 1) +*) +// +(* +| "--gline" => + { + val () = + $GLOB.the_DEBUGATS_dbgline_set(1) + } // end of [--gline] // mostly for debugging +*) +// +(* +| "--debug1" => + { + val () = debug_flag_set(1) + } // end of [--debug] // more informative errmsgs +| "--debug2" => { + val () = debug_flag_set(1) + val () = $GLOB.the_DEBUGATS_dbgflag_set(1) + } // end of [--debug2] // for generating debugging info +*) +// +(* +| "--depgen" => (st0.depgen := 1) +| "--taggen" => (st0.taggen := 1) +*) +// +(* +| "--codegen-2" => + { + val () = st0.codegen2 := 2 + } +| "--jsonize-2" => + { + val () = st0.jsonize2 := 2 + } +*) +// +(* +| "--no-tailcallopt" => + { + val () = + $GLOB.the_CCOMPATS_tailcallopt_set(0) + } +*) +// +(* +| "--constraint-export" => + { + val () = st0.constraint := 1 + } +| "--constraint-ignore" => + { + val () = st0.constraint := ~1 + } +*) +// +| "--help" => + ( + xatsopt_usage + (stdout_ref, st0.arg0) + // xatsopt_usage + ) +| "--version" => + ( + xatsopt_version(stdout_ref) + ) +// +| _ (*rest-of-key2*) => + ( // + // HX: unrecognized key + // + xatsopt_commarg_warning(stderr_ref, key) + ) (* end of [rest-of-key2] *) +// +) : void // end of [val] +// +in + process_cmdline(st0, args) +end // end of [auxkey2] +// +in +// +case+ arg0 of +| _ when + isinpwait(st0) => let + val + stadyn = + waitknd_get_stadyn(st0.wtk0) + val nif = st0.ninpfil + in + case+ arg0 of +// + | COMMARG(1, key) + when nif > 0 => + ( + auxkey1(st0, key) + ) + | COMMARG(2, key) + when nif > 0 => + ( + auxkey2(st0, key) + ) +// + | COMMARG(_, "-") => + ( + process_cmdline(st0, args) + ) where + { + val () = + (st0.ninpfil := nif+1) + val () = process_stdin(st0) + } (* end of [COMMARG(_,-)] *) +// + | COMMARG(_, given) => + ( + process_cmdline(st0, args) + ) where + { + val () = + (st0.ninpfil := nif+1) + val () = + ( + process_given(st0, given) + ) + } (* end of [COMMARG(_,_)] *) + end // end of [isinpwait] +// +| _ when + isoutwait(st0) => let + val () = + st0.wtk0 := WTKnone() +// + val+COMMARG(_, given) = arg0 +// + val ((*void*)) = + ( + theOutFname_set(opt) + ) where + { + val opt = stropt_some(given) + } +// + val _new_ = + outchan_make_fname(st0, given) + val ((*void*)) = + cmdstate_set_outchan(st0, _new_) +// + in + process_cmdline(st0, args) + end // end of [_ when isoutwait] +// +| COMMARG(1, key) => auxkey1(st0, key) +| COMMARG(2, key) => auxkey2(st0, key) +// +| COMMARG(_, key) => + ( + process_cmdline(st0, args) + ) where + { + val () = + st0.wtk0 := WTKnone() + val () = + xatsopt_commarg_warning(stderr_ref, key) + } (* end of [COMMARG] *) +// +end // end of [process_cmdline2] +// +in (* in-of-local *) + +implement +interp0_main0 + (argc, argv) = let +// +val +XATSHOME = +$GLO.the_XATSHOME_get((*void*)) +// +val () = +$FP0.the_includes_push(XATSHOME) +// +val+ +list_cons +(arg0, args) = args where +{ + val + args = + parse_commarglst(argc, argv) +} (* end of [val] *) +// +var +st0: cmdstate = +@{ + arg0= arg0 +, wtk0= WTKnone() +// +, ATSHOME= XATSHOME +// +, prelude= 0(*~loaded*) +// +, inpfil0= + $FP0.the_filpath_dummy +// +, ninpfil= 0(*initset*) +// +// load status of prelude files +// +, outmode= file_mode_w +, outchan= OUTCHANref(stdout_ref) +// +, nxerror= 0(*initset*) +// +} (* end of [var] *) +// +val () = +process_cmdline(st0, args) +// +in +// +if (st0.nxerror > 0) then $ERR.abort() +// +end // end of [xatsopt_main0] + +end // end of [local] + +(* ****** ****** *) + +(* end of [xint_interp0.dats] *) diff --git a/contrib/sparverius/xjsonize/DATS/intrep0.dats b/contrib/sparverius/xjsonize/DATS/intrep0.dats new file mode 100644 index 000000000..a9f9a6111 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/intrep0.dats @@ -0,0 +1,667 @@ +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#define XATS_targetloc "./../../../../srcgen/xats" +(* +#staload "{$XATS}/SATS/dynexp0.sats" +#staload "{$XATS}/SATS/staexp0.sats" +*) +#staload "{$XATS}/SATS/dynexp1.sats" +#staload "{$XATS}/SATS/dynexp2.sats" +#staload "{$XATS}/SATS/dynexp3.sats" +(* #staload "{$XATS}/SATS/staexp2.sats" *) + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/lexing.sats" +#staload "./../SATS/dynexp1.sats" +#staload "./../SATS/label0.sats" +#staload "./../SATS/dynexp2.sats" +#staload "./../SATS/dynexp3.sats" +#staload "./../SATS/statyp2.sats" + +#staload "./../SATS/staexp2.sats" +#staload "./../SATS/intrep0.sats" + + +implement +jsonize_ir0pat + (x0) = +( +case+ x0.node() of +// +| IR0Pint(tok) => + (* fprint!(out, "IR0Pint(", tok, ")") *) + jsonify("IR0Pint", "tok", jsonize(tok)) +| IR0Pbtf(tok) => + (* fprint!(out, "IR0Pbtf(", tok, ")") *) + jsonify("IR0Pbtf", "tok", jsonize(tok)) +// +| IR0Pany() => + (* fprint!(out, "IR0Pany(", ")") *) + jsonify("IR0Pany") +| IR0Pvar(d2v) => + (* fprint!(out, "IR0Pvar(", d2v, ")") *) + jsonify("IR0Pvar", "d2v", jsonize(d2v)) +// +| IR0Pcapp(d2c0, irps) => +(* + fprint! + ( out + , "IR0Pcapp(", d2c0, "; ", irps, ")") +*) + jsonify("IR0Pcapp", ("d2c0", "irps"), rst) where + val jd2c0 = jsonize(d2c0) + val jirps = jstr("...") + val rst = (jd2c0, jirps) + end +// +| IR0Ptuple(knd, irps) => + (* fprint! *) + (* ( out *) + (* , "IR0Ptuple(", knd, "; ", irps, ")") *) + jsonify("IR0Ptuple", ("knd", "irps"), rst) where + val jd2c0 = jsonize(knd) + val jirps = jstr("...") + val rst = (jd2c0, jirps) + end + +// +| IR0Pnone0() => + (* fprint!(out, "IR0Pnone0(", ")") *) + jsonify("IR0Pnone0") + // end of [IR0Pnone0] +| IR0Pnone1(d3p) => + (* fprint!(out, "IR0Pnone1(", d3p, ")") *) + jsonify("IR0Pnone1", "d3p", rst) where + val rst = jstr("...") + end + // end of [IR0Pnone1] +// +) + + +implement jsonize_val(x) = jsonize_ir0pat(x) + +implement +jsonize_ir0arg + (x0) = +let +val+IR0ARGsome(npf, irps) = x0 +in +(* +fprint! +(out, "IR0ARGsome(", npf, "; ", irps, ")") +*) +jsonify("IR0ARGsome", ("npf", "irps"), rst) where + val jnpf = jsonize(npf) + val jirps = jsonize_list(irps) + val rst = (jnpf, jirps) +end +end + + +local + +implement jsonize_val = jsonize_ir0exp +implement jsonize_val = jsonize_ir0dcl +implement jsonize_val = jsonize_t2ype +implement jsonize_val = jsonize_ir0arg + +in +// +implement +jsonize_ir0exp(x0) = + (* (x0) = jsonval_labval2("node", jsonize("ir0exp"), "val", res) where *) + (* jsonval_labval1("ir0exp", res) where *) + res where +val res = +( +case+ +x0.node() of +// +| IR0Eint(tok) => + jsonval_labval2("node", jsonize("IR0Eint"), "val", JSONlist(list_nil())) + (* jsonize("IR0Eint") //, tok, ")") *) +| IR0Ebtf(tok) => + (* jsonize("IR0Ebtf") //, tok, ")") *) + jsonify("IR0Ebtf", "tok", jsonize(tok)) +(* +| IR0Eflt(tok) => + jsonize("IR0Eflt") //, tok, ")") +*) +| IR0Estr(tok) => + (* let val _ = $showtype(tok) in *) + (* jsonize("IR0Estr") //, tok, ")") *) + jsonify("IR0Estr", "tok", jsonize(tok)) + (* end *) +// +| IR0Evar(d2v) => + (* jsonize("IR0Evar") //, d2v, ")") *) + jsonify("IR0Evar", "d2v", jsonize(d2v)) +// +| IR0Econ1(d2c) => + (* jsonize("IR0Econ1") //, d2c, ")") *) + (* where *) + (* val _ = $showtype(d2c) *) + (* end *) + jsonify("IR0Econ1", "d2c", jsonize(d2c)) + +| IR0Ecst1(d2c) => + (* jsonize("IR0Ecst1") //, d2c, ")") *) + jsonify("IR0Ecst1", "d2c", jsonize(d2c)) +// +| IR0Efcst(d2c) => + (* jsonize("IR0Efcst") //, d2c, ")") *) + jsonify("IR0Efst1", "d2c", jsonize(d2c)) +// +| IR0Etcst + (d2c1, ti3a, ti2s) => + (* jsonize("IR0Etcst") //, d2c1, "; ", ti3a, "; [", ti2s, "])") *) + (* jsonify("IR0Etcst", ("d2c1", "ti3a", "ti2s"), rst) where *) + jsonify("IR0Etcst", args, rst) where + val args = ( + "d2c1", + "ti3a", + "ti2s" + ) + val rst = ( + fst, + snd, + thd + ) where + val fst = jsonize(d2c1) + val snd = jsonize(ti3a) //jstr("...") + (* val _ = $showtype(ti3a) *) + val _ = $showtype(ti2s) + val thd = jstr("...") + end + end +| IR0Etimp + ( ire1 + , targ, irc2, tsub) => + (* jsonize("IR0Etimp") //, ire1, "; [", targ, "]; ", irc2, "; [", tsub, "])") *) + jsonify("IR0Etimp", args, rst) where + (* val _ = $showtype(irc2) *) + val args = ( + "ire1", + "targ", + "irc2", + "tsub" + ) + val rst = ( + fst, + snd, + thd, + frh + ) where + val fst = jsonize(ire1) + val snd = jsonize_list(targ) + val thd = jsonize(irc2) + val frh = jsonize_list(tsub) + end + end +// +| IR0Edapp + (irf0, npf1, ires) => +(* + let + (* val _ = $showtype(irf0) *) + (* val _ = $showtype(npf1) // int *) + (* val _ = $showtype(ires) // int *) + val json_irf0 = jsonize(irf0) + val json_npf1 = jsonize(npf1) + val ires0 = list_map(ires) where + implement + list_map$fopr(x) = jsonize(x) + end + val ires0 = list_of_list_vt(ires0) + val json_ires = JSONlist(ires0) + val xys0 = + list_cons(json_irf0, list_cons(json_npf1, list_cons(json_ires, list_nil()))) + in + (* jsonize("IR0Edapp") //, irf0, "; ", npf1, "; [", ires, "])") *) + jsonval_labval2("node", jsonize("IR0Edapp"), "val", JSONlist(xys0)) + end +*) + (* jsonify("IR0Edapp", ("irf0", "npf1", "ires"), rst) where *) + (* val jirf0 = jsonize(irf0) *) + (* val jnpf1 = jsonize(npf1) *) + (* val jires = jsonize_list(ires) *) + (* val rst = (jirf0, jnpf1, jires) *) + (* end *) + jsonify("IR0Edapp", args, rst) where + val args = ( + "irf0", + "npf1", + "ires" + ) + val rst = ( + fst, + snd, + thd + ) where + val fst = jsonize(irf0) + val snd = jsonize(npf1) + val thd = jsonize_list(ires) + end + end + + +// +| IR0Eproj + (ire1, lab2, idx2) => + (* jsonize("IR0Eproj") //, ire1, "; ", lab2, "; ", idx2, ")") *) + jsonify("IR0Eproj", args, rst) where + val args = ( + "ire1", + "lab2", + "idx2" + ) + val rst = (fst,snd,thd) where + val fst = jsonize(ire1) + (* val _ = $showtype(idx2) *) + val snd = jsonize(lab2) + val thd = jsonize(idx2) + end + end +// +| IR0Elet(irds, ire1) => + (* jsonize("IR0Elet") //, irds, "; ", ire1, ")") *) + jsonify("IR0Elet", args, rst) where + (* val _ = $showtype(irds) *) + val args = ( + "irds", + "ire1" + ) + val rst = ( + fst, + snd + ) where + val fst = jsonize_list(irds) + val snd = jsonize(ire1) + end + end +| IR0Ewhere(ire1, irds) => + (* jsonize("IR0Ewhere") //, ire1, "; [", irds, "])") *) + jsonify("IR0Ewhere", args, rst) where + val args = ( + "ire1", + "irds" + ) + val rst = ( + fst, + snd + ) where + val fst = jsonize(ire1) + val snd = jsonize_list(irds) + end + end +// +| IR0Etuple + (knd0, npf1, ires) => + (* jsonize("IR0Etuple") //, knd0, "; ", npf1, "; [", ires, "])") *) + jsonify("IR0Etuple", args, rst) where + val args = ( + "knd0", + "npf1", + "ires" + ) + val rst = (fst,snd,thd) where + val fst = jstr("...") + val snd = jsonize(npf1) + val thd = jsonize_list(ires) + (* val _ = $showtype(ires) *) + end + end + +// +| IR0Eif0 + (ire1, ire2, opt3) => + (* jsonize("IR0Eif0") //, ire1, "; ", ire2, "; ", opt3, ")") *) + jsonify("IR0Eif0", args, rst) where + val args = ( + "ire1", + "ire2", + "opt3" + ) + val rst = (fst,snd,thd) where + val fst = jsonize(ire1) + val snd = jsonize(ire2) + val thd = jstr("...") + end + end +// +| IR0Ecase + (knd0, ire1, ircls) => + (* jsonize("IR0Ecase") //, knd0, "; ", ire1, "; ", "...", ")") *) + jsonify("IR0Ecase", args, rst) where + (* val _ = $showtype(ircls) *) + val args = ( + "knd0", + "ire1", + "ircls" + ) + val rst = (fst,snd,thd) where + val fst = jstr("...") + val snd = jstr("...") + val thd = jstr("...") + end + end +// +| IR0Elam + (knd0, farg, body) => + (* jsonize("IR0Elam") //, knd0, "; [", farg, "]; ", body, ")") *) + jsonify("IR0Elam", args, rst) where + val args = ( + "knd0", + "farg", + "body" + ) + val rst = (fst,snd,thd) where + val fst = jsonize(knd0) + (* val _ = $showtype(body) *) + val snd = jsonize_list(farg) + val thd = jsonize(body) + end + end +| IR0Efix + (knd0, d2v0, farg, body) => + (* jsonize("IR0Efix") //, knd0, "; ", d2v0, "; [", farg, "]; ", body, ")") *) + jsonify("IR0Efix", args, rst) where + val args = ( + "knd0", + "d2v0", + "farg", + "body" + ) + val rst = ( + fst, + snd, + thd, + frh + ) where + val fst = jstr("...") + val snd = jstr("...") + val thd = jstr("...") + val frh = jstr("...") + end + end +// +| IR0Enone0() => + ( + jsonize("IR0Enone0") //, ")") + ) +| IR0Enone1(d3e1) => + ( + jsonize("IR0Enone1") //, d3e1, ")") + ) +// +) +end + +end + + +implement +jsonize_ir0gua + (x0) = +( +case+ +x0.node() of +| IR0GUAexp(ir0e) => + (* fprint! *) + (* (out, "IR0GUAexp(", ir0e, ")") *) + jsonify("IR0GUAexp", "ir0e", jsonize(ir0e)) +| IR0GUAmat(ir0e, ir0p) => + (* fprint! *) + (* (out, "IR0GUAmat(", ir0e, "; ", ir0p, ")") *) + jsonify("IR0GUAmat", ("ir0e", "ir0p"), + ( + jsonize(ir0e), + jsonize(ir0p) + ) + ) +) (* end of [jsonize_ir0gua] *) + + +implement +jsonize_ir0clau + (x0) = +( +case+ +x0.node() of +// +| +IR0CLAUpat(ir0gp) => +(* fprint! *) +(* (out, "IR0CLAUpat(", ir0gp, ")") *) +jsonify("IR0CLAUpat", "ir0gp", jsonize(ir0gp)) +// +| +IR0CLAUexp(ir0gp, d0e0) => +(* fprint! *) +(* (out, "IR0CLAUexp(", ir0gp, "; ", d0e0, ")") *) +jsonify("IR0CLAUpat", ("ir0gp", "d0e0"), (jstr("..."), jstr("..."))) +// +) (* end of [jsonize_ir0clau] *) + + +implement jsonize_val = jsonize_ir0gua + +implement +jsonize_ir0gpat + (x0) = +( +case+ +x0.node() of +// +| +IR0GPATpat(ir0p) => +(* fprint! *) +(* (out, "IR0GPATpat(", ir0p, ")") *) +jsonify("IR0GPATpat", "ir0p", jsonize(ir0p)) +// +| +IR0GPATgua(ir0p, ir0gs) => +(* fprint! *) +(* (out, "IR0GPATgua(", ir0p, "; ", ir0gs, ")") *) +jsonify("IR0CLAUpat", ("ir0p", "ir0gs"), + ( + (* jstr("..."), *) + (* jstr("...") *) + jsonize(ir0p), + jsonize_list(ir0gs) + ) +) +// +) (* end of [fprint_ir0gpat] *) +// + + +implement jsonize_val = jsonize_ir0dcl +implement jsonize_val = jsonize_ir0fundecl +implement jsonize_val = jsonize_tq2arg +implement jsonize_val = jsonize_sq2arg +implement jsonize_val = jsonize_ti2arg +implement jsonize_val = jsonize_ir0arg +implement jsonize_val = jsonize_ir0valdecl + +implement +jsonize_ir0dcl(x0) = +( +case+ x0.node() of +// +| IR0Cstatic + (tok, irc1) => + (* fprint!(out,"IR0Cstatic(", tok, "; ", irc1, ")") *) + jsonify("IR0Cstatic", ("tok", "irc1"), (jsonize(tok), jstr("..."))) +| IR0Cextern + (tok, irc1) => + (* fprint!(out,"IR0Cextern(", tok, "; ", irc1, ")") *) + jsonify("IR0Cextern", ("tok", "irc1"), (jsonize(tok), jstr("..."))) +// +| IR0Cinclude + (tok, src, knd, fopt, body) => + jsonify("IR0Cinclude", ("tok", "src", "knd", "fopt", "body"), rst) where + (* val _ = $showtype(fopt) // filpath *) + val jsrc = jsonize(src) + val jknd = jsonize(knd) + val jfopt = jstr("...") + val jbody = ( + case+ body of + | Some(x) => jsonize_list(x) + | None() => JSONlist(list_nil()) + ) + val rst = (jsonize(tok), jsrc, jknd, jfopt, jbody) + end +(* + ( + (* fprint!(out,"IR0Cinclude(", "src= ", src, "; ", "knd= ", knd, "; ", fopt, "; ", body, ")") *) + ) where + { + val body = + ( + case+ body of + | None _ => "None()" + | Some _ => "Some()"): string + } +*) +// +| IR0Clocal + (head, body) => + (* fprint!(out,"IR0Clocal(", head, "; ", body, ")") *) + jsonify("IR0Clocal", ("head", "body"), rst) where + val jhead = jstr("...") + val jbody = jstr("...") + val rst = (jhead, jbody) + end +// +| IR0Cvaldecl + (knd, mopt, irds) => + (* fprint!(out,"IR0Cvaldecl(", knd, "; ", mopt, "; ", irds, ")") *) + jsonify("IR0Cvaldecl", ("knd", "mopt", "irds"), rst) where + val jknd = jsonize(knd) + (* val _ = $showtype(mopt) *) + val jmopt = jstr("...") + val jirds = jsonize_list(irds) + val rst = (jknd, jmopt, jirds) + end +// +| IR0Cfundecl + (knd, mopt, tqas, irds) => + (* fprint!(out,"IR0Cfundecl(", knd, "; ", mopt, "; ", tqas, "; ", irds, ")") *) + jsonify("IR0Cfundecl", ("knd", "mopt", "tqas", "irds"), rst) where + val jknd = jsonize(knd) + val jmopt = jsonize(mopt) + (* val _ = $showtype(tqas) // list tq2arg *) + val jtqas = //jstr("...") + jsonize_list(tqas) + (* val _ = $showtype(irds) // list ir0fundecl *) + val jirds = //jstr("...") + jsonize_list(irds) + val rst = (jknd, jmopt, jtqas, jirds) + end +// +| IR0Cimpdecl3 + (knd, mopt, sqas, tqas, id2c, ti3a, ti2s, iras, body) => + (* fprint!(out,"IR0Cimpdecl3(", knd, "; ", mopt, "; ", sqas, "; ", tqas, "; ", id2c, "; ", ti3a, "; ", ti2s, "; ", iras, "; ", body, ")") *) + jsonify("IR0Cimpdecl3", args, rst) where + val args = ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "iras", "body") + val jknd = jsonize(knd)//jstr("...") + val jmopt = jsonize(mopt)//jstr("...") + val jsqas = jsonize_list(sqas) + val jtqas = jsonize_list(tqas) + val jid2c = jsonize(id2c) + val jti3a = jsonize(ti3a) + val jti2s = jsonize_list(ti2s) + val jiras = jsonize_list(iras) where val _ = $showtype(iras) end + val jbody = jsonize(body) + val rst = (jknd, jmopt, jsqas, jtqas, jid2c, jti3a, jti2s, jiras, jbody) + end + +// +| IR0Cnone0() => + (* fprint!(out, "IR0Cnone0(", ")") *) + jsonify("IR0Cnone0") + +| IR0Cnone1(d3cl) => + (* fprint!(out, "IR0Cnone1(", d3cl, ")") *) + jsonify("IR0Cnone1", "d3cl", rst) where + val rst = jstr("...") + end +// +) // end of jsonize_ + + + +implement +jsonize_ir0valdecl + (x0) = let +// +val+IR0VALDECL(rcd) = x0 +// +in + jsonify("IR0VALDECL", ("pat", "def"), ( + jsonize(rcd.pat), + defopt + ) + ) where + val defopt = ( + case+ rcd.def of + | None() => jsonize("None") + | Some(x) => jsonize(x) + ) + end +end // end of [fprint_ir0valdecl] + + +implement jsonize_val = jsonize_f2arg + +implement +jsonize_ir0fundecl + (x0) = let +// +val+IR0FUNDECL(rcd) = x0 +// +in +(* + fprint! + ( out + , "IR0FUNDECL@{" + , ", nam=", rcd.nam + , ", d2c=", rcd.d2c + , ", a2g=", rcd.a2g +(* + , ", a3g=", rcd.a3g +*) + , ", def=", rcd.def, "}") +*) +jsonify("IR0FUNDECL", ("nam", "d2c", "a2g", "a3g", "def"), rst) where + val jnam = jsonize(rcd.nam) + val jd2c = jsonize(rcd.d2c) + (* val _ = $showtype(rcd.a2g) *) + val ja2g = jsonize_list(rcd.a2g) //jstr("...")//jsonize(rcd.a2g) + val ja3g = ( + case+ rcd.a3g of + | None() => JSONlist(list_nil()) + | Some(x) => jsonize_list(rcd.a2g) + ) + val jdef = ( + case+ rcd.def of + | None() => JSONlist(list_nil()) + | Some(x) => jsonize_list(rcd.a2g) + ) + (* val _ = $showtype(rcd.def) *) + + val rst = (jnam, jd2c, ja2g, ja3g, jdef) +end +end diff --git a/contrib/sparverius/xjsonize/DATS/json.dats b/contrib/sparverius/xjsonize/DATS/json.dats new file mode 100644 index 000000000..2a53c5502 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/json.dats @@ -0,0 +1,645 @@ +#staload "./../SATS/json.sats" + +#include +"share/atspre_staload.hats" +#staload +UN = "prelude/SATS/unsafe.sats" + +implement +jsonval_int (i) = JSONint (i) + +(* implement *) +(* jsonval_intinf (i) = JSONintinf (i) *) + +implement +jsonval_bool (b) = JSONbool (b) + +implement +jsonval_double (d) = JSONfloat (d) + +implement +jsonval_string (str) = JSONstring (str) + +(* ****** ****** *) +// +#define nil list_nil +// +#define :: list_cons +#define cons list_cons +// +(* ****** ****** *) + +implement +jsonval_nil() = JSONlist (list_nil()) + +implement +jsonval_sing (x) = JSONlist (list_sing(x)) +implement +jsonval_pair (x1, x2) = JSONlist (list_pair(x1, x2)) + +(* ****** ****** *) +// +implement +jsonval_labval1 (l, x) = + JSONlablist (list_cons((l, x), list_nil)) +implement +jsonval_labval2 (l1, x1, l2, x2) = + JSONlablist (list_cons((l1, x1), list_cons((l2, x2), list_nil))) +implement +jsonval_labval3 +( + l1, x1, l2, x2, l3, x3 +) = JSONlablist ((l1, x1) :: (l2, x2) :: (l3, x3) :: list_nil(*void*)) +implement +jsonval_labval4 +( + l1, x1, l2, x2, l3, x3, l4, x4 +) = JSONlablist ((l1, x1) :: (l2, x2) :: (l3, x3) :: (l4, x4) :: list_nil) +// +implement +jsonval_labval5 +( + l1, x1, l2, x2, l3, x3, l4, x4, l5, x5 +) = JSONlablist +( + (l1, x1) :: (l2, x2) :: (l3, x3) :: (l4, x4) :: (l5, x5) :: list_nil +) +implement +jsonval_labval6 +( + l1, x1, l2, x2, l3, x3, l4, x4, l5, x5, l6, x6 +) = JSONlablist +( + (l1, x1) :: (l2, x2) :: (l3, x3) :: (l4, x4) :: (l5, x5) :: (l6, x6) :: list_nil +) +implement +jsonval_labval7 +( + l1, x1, l2, x2, l3, x3, l4, x4, l5, x5, l6, x6, l7, x7 +) = JSONlablist +( + (l1, x1) :: (l2, x2) :: (l3, x3) :: (l4, x4) :: (l5, x5) :: (l6, x6) :: (l7, x7) :: list_nil +) +implement +jsonval_labval8 +( + l1, x1, l2, x2, l3, x3, l4, x4, l5, x5, l6, x6, l7, x7, l8, x8 +) = JSONlablist +( + (l1, x1) :: (l2, x2) :: (l3, x3) :: (l4, x4) :: (l5, x5) :: (l6, x6) :: (l7, x7) :: (l8, x8) :: list_nil +) +// +(* ****** ****** *) +// +implement +jsonval_conarg0 + (con) = jsonval_conarglst (con, list_nil) +implement +jsonval_conarg1 + (con, arg1) = + jsonval_conarglst (con, list_sing (arg1)) +implement +jsonval_conarg2 + (con, arg1, arg2) = + jsonval_conarglst (con, list_pair (arg1, arg2)) +implement +jsonval_conarg3 + (con, arg1, arg2, arg3) = + jsonval_conarglst (con, arg1 :: arg2 :: arg3 :: list_nil) +implement +jsonval_conarg4 + (con, arg1, arg2, arg3, arg4) = + jsonval_conarglst (con, arg1 :: arg2 :: arg3 :: arg4 :: list_nil()) +// +implement +jsonval_conarglst + (con, arglst) = jsonval_labval1 (con, JSONlist (arglst)) +// end of [jsonval_conarglst] + +(* ****** ****** *) +// +implement +jsonval_none () = JSONoption (None()) +implement +jsonval_some (x) = JSONoption (Some(x)) + +local + +fun +fprint_jsonval_string +( + out: FILEref, str: string +) : void = let +// +fun +auxch +( + out: FILEref, c: char +) : void = let +in +// +case+ c of +| '"' => fprint_string (out, "\\\"") +| '\\' => fprint_string (out, "\\\\") +| '\n' => fprint_string (out, "\\n") +| '\r' => fprint_string (out, "\\r") +| '\t' => fprint_string (out, "\\t") +| '\b' => fprint_string (out, "\\b") +| '\f' => fprint_string (out, "\\f") +| _ (*rest-of-char*) => + ( + if isprint_char(c) + then fprint_char(out, c) + else let + (* val uc = uchar_of_char(c) *) + in + (* fprintf (out, "\\u00%.2X", @($UN.cast2uint(uc))) *) + exit(1); + end // end of [else] + // end of [if] + ) (* end of [_] *) +// +end // end of [auxch] +// +fun +loop +( + out: FILEref, p: ptr +) : void = let +// +val c = $UN.ptr0_get (p) +// +in +// +if c != '\000' +(* +then (auxch(out, c); loop (out, p+sizeof)) else () +*) + then (auxch(out, c); loop (out, nxtptr)) where + val nxtptr = ptr0_add_guint(p, sizeof) + end + else () +// +end // end of [loop] +// +in +// +fprint_char (out, '"'); +loop (out, $UN.cast{ptr}(str)); +fprint_char (out, '"'); +// +end // end of [fprint_jsonval_string] + +in (* in-of-local *) + +implement +fprint_jsonval + (out, x0) = let +// +macdef +prstr (str) = fprint_string (out, ,(str)) +// +in +// +case+ x0 of +// +| JSONnul () => prstr "{}" +// +| JSONint (i) => fprint_int (out, i) +(* | JSONintinf (i) => *) +(* { *) +(* val () = fprint_char (out, '"') *) +(* val () = $INTINF.fprint_intinf (out, i) *) +(* val () = fprint_char (out, '"') *) +(* } *) +// +| JSONbool (b) => fprint_bool (out, b) +| JSONfloat (d) => fprint_double (out, d) +// +| JSONstring (str) => fprint_jsonval_string (out, str) +| JSONlist (xs) => + { + val () = prstr "[" + val () = fprint_jsonvalist (out, xs) + val () = prstr "]" + } +| JSONlablist (lxs) => + { + val () = prstr "{" + val () = fprint_labjsonvalist (out, lxs) + val () = prstr "}" + } +// +| JSONoption (opt) => + { + val () = prstr "[" + val () = + ( + case+ opt of + | Some x => fprint_jsonval (out, x) | None () => () + ) : void // end of [val] + val () = prstr "]" + } +(* +| JSONobject (lst) => + { + val () = prstr "{" +(* + val () = + ( + case+ opt of + | Some x => fprint_jsonval (out, x) | None () => () + ) : void // end of [val] +*) + val () = prstr "}" + } +*) + +// +end // end of [fprint_jsonval] + +end // end of [local] + +(* ****** ****** *) + +implement +fprint_jsonvalist + (out, xs0) = let +// +fun aux +( + out: FILEref +, xs0: jsonvalist, i: int +) : void = let +in +// +case+ xs0 of +| list_nil () => () +| list_cons (x, xs) => let + val () = + if i > 0 + then fprint (out, ", ") + // end of [if] + val () = fprint_jsonval (out, x) + in + aux (out, xs, i+1) + end // end of [list_cons] +// +end // end of [aux] +// +in + aux (out, xs0, 0) +end // end of [fprint_jsonvalist] + +(* ****** ****** *) + +implement +fprint_labjsonvalist + (out, lxs0) = let +// +fun aux +( + out: FILEref +, lxs0: labjsonvalist, i: int +) : void = let +in +// +case+ lxs0 of +| list_nil () => () +| list_cons + (lx, lxs) => let + val () = + if i > 0 + then fprint (out, ", ") + // end of [if] + (* + val () = + fprintf (out, "\"%s\"", @(lx.0)) + *) + val () = + fprintf (out, "\"%s\"", $vararg(lx.0)) + + val () = fprint_string (out, ": ") + val () = fprint_jsonval (out, lx.1) + in + aux (out, lxs, i+1) + end // end of [list_cons] +// +end // end of [aux] +// +in + aux (out, lxs0, 0) +end // end of [fprint_labjsonvalist] + +(* ****** ****** *) + + +(* ****** ****** *) +// +implement +jsonize_ignored(x0) = JSONnul((*void*)) +// +(* ****** ****** *) + +implement +{a}(*tmp*) +jsonize_list_fun(xs, f) = let +// +(* +val () = + println! ("jsonize_list_fun") +*) +// +(* +val +jsvs = list_map_fun (xs, f) +*) +val +jsvs = list_map(xs) where + implement list_map$fopr(a) = f(a) end +val +jsvs = list_of_list_vt(jsvs) + +in + JSONlist (jsvs) +end // end of [jsonize_list_fun] + +(* ****** ****** *) + +implement +{a}(*tmp*) +jsonize_option_fun(opt, f) = let +// +(* +val () = + println! ("jsonize_option_fun") +*) +// +in +// +case+ opt of +| None() => jsonval_none() | Some(x) => jsonval_some(f(x)) +// +end // end of [jsonize_option_fun] + + +implement lab(x:string, rst:jsonval): jsonval = jsonval_labval1(x, rst) + +implement jnul() = JSONnul() + +implement jint(x:int) = JSONint(x) + +implement jbool(x:bool) = JSONbool(x) + +implement jfloat(x:double) = JSONfloat(x) + +implement jstr(x:string) = JSONstring(x) + +implement jsonize_int(x) = JSONint(x) + +implement jsonize_char(x) = JSONstring(tostring_char(x)) + +implement jsonize_string(x) = JSONstring(x) + +implement jsonize_bool(x) = JSONbool(x) + +implement jsonize_double(x) = JSONstring(tostring_val(x)) + +implement jsonize_val(x) = jsonize_int(x) + +implement jsonize_val(x) = jsonize_string(x) + +implement jsonize_val(x) = jsonize_bool(x) + +implement jsonize_val(x) = jsonize_double(x) + +(* implement jsonize_val(x) = jsonize_float(x) *) + + +implement{a} jsonize_list(xs) = JSONlist(res) where +{ + (* val _ = $showtype(xs) *) + val xys = list_map(xs) where + { + implement list_map$fopr(x) = jsonize_val(x) + } + val res = list_of_list_vt{jsonval}(xys) +} + +(* +implement(a:t@ype) jsonize_list(xs) = JSONlist(res) where +{ + (* val _ = $showtype(xs) *) + val xys = list_map(xs) where + { + implement list_map$fopr(x) = jsonize_val(x) + } + val res = list_of_list_vt{jsonval}(xys) +} +*) + +(* implement(a:t@ype) jsonize_val(xs) = jsonize_list(xs) *) + +implement listj(x) = JSONlist(list_sing(x)) + +implement listj2(x, y) = JSONlist(cons(x, cons(y, nil()))) + + +implement labval2(x, y) = jsonval_labval2("node", x, "val", y) + + +implement jsonify0(guard_name) = JSONstring(guard_name) + + +implement jsonify1(guard_name, name, json) = +jsonval_labval1(guard_name, rst) where + val rst = jsonval_labval1(name, json) + val rst = json +end + +implement jsonify2(guard_name, names, json) = +jsonval_labval1(guard_name, rst) where +(* + val rst = jsonval_labval2 ( + names.0, json.0, + names.1, json.1 + ) +*) + + val lst = $list{labjsonval}( + (names.0, json.0), + (names.1, json.1) + ) + val rst = JSONlablist(lst) + val rst = JSONlist($list{jsonval}(json.0, json.1)) +end + +implement jsonify3(guard_name, names, json) = +jsonval_labval1(guard_name, rst) where +(* + val rst = jsonval_labval3 ( + names.0, json.0, + names.1, json.1, + names.2, json.2 + ) +*) + + val lst = $list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2) + ) + val rst = JSONlablist(lst) + val rst = JSONlist($list{jsonval}(json.0, json.1, json.2)) +end + +implement jsonify4(guard_name, names, json) = +jsonval_labval1(guard_name, rst) where +(* + val rst = jsonval_labval4 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3 + ) +*) + val lst = $list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3) + ) + val rst = JSONlablist(lst) + val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3)) +end + +implement jsonify5 (guard_name, names, json) = +jsonval_labval1(guard_name, rst) where +(* + val rst = jsonval_labval5 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4 + ) +*) + val lst = $list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4) + ) + val rst = JSONlablist(lst) + val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4)) +end + +implement jsonify6 (guard_name, names, json) = +jsonval_labval1(guard_name, rst) where +(* + val rst = jsonval_labval6 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4, + names.5, json.5 + ) +*) + val lst = $list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4), + (names.5, json.5) + ) + val rst = JSONlablist(lst) + val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5)) +end + +implement jsonify7 (guard_name, names, json) = +jsonval_labval1(guard_name, rst) where +(* + val rst = jsonval_labval7 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4, + names.5, json.5, + names.6, json.6 + ) +*) + val lst = $list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4), + (names.5, json.5), + (names.6, json.6) + ) + val rst = JSONlablist(lst) + val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6)) +end + +implement jsonify8 (guard_name, names, json) = +jsonval_labval1(guard_name, rst) where +(* + val rst = jsonval_labval8 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4, + names.5, json.5, + names.6, json.6, + names.7, json.7 + ) +*) + val lst = $list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4), + (names.5, json.5), + (names.6, json.6), + (names.7, json.7) + ) + val rst = JSONlablist(lst) + val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6, json.7)) +end + +implement jsonify9 (guard_name, names, json) = +jsonval_labval1(guard_name, rst) where +(* + val rst = jsonval_labval8 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4, + names.5, json.5, + names.6, json.6, + names.7, json.7 + ) +*) + val lst = $list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4), + (names.5, json.5), + (names.6, json.6), + (names.7, json.7), + (names.8, json.8) + ) + val rst = JSONlablist(lst) + val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6, json.7, json.8)) +end + +(* implement jsonify(guard_name: string, args: List(@(string, json))): jsonval = *) diff --git a/contrib/sparverius/xjsonize/DATS/label0.dats b/contrib/sparverius/xjsonize/DATS/label0.dats new file mode 100644 index 000000000..9a67d1211 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/label0.dats @@ -0,0 +1,68 @@ +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#define XATS_targetloc "./../../../../srcgen/xats" +(* +#staload "{$XATS}/SATS/dynexp0.sats" +#staload "{$XATS}/SATS/staexp0.sats" +*) +#staload "{$XATS}/SATS/label0.sats" +#staload "{$XATS}/DATS/label0.dats" +(* +#staload _ = "{$XATS}/DATS/label0.dats" +*) +(* +#staload "{$XATS}/SATS/dynexp1.sats" +#staload "{$XATS}/SATS/dynexp2.sats" +#staload "{$XATS}/SATS/dynexp3.sats" +*) + +#staload "{$XATS}/SATS/staexp2.sats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/lexing.sats" +#staload "./../SATS/dynexp1.sats" +#staload "./../SATS/label0.sats" +#staload "./../SATS/dynexp2.sats" +#staload "./../SATS/dynexp3.sats" +#staload "./../SATS/statyp2.sats" + +#staload "./../SATS/staexp2.sats" +#staload "./../SATS/intrep0.sats" +#staload "./../SATS/label0.sats" + +#staload SYM_J = "./../SATS/symbol.sats" + +overload jsonize with $SYM_J.jsonize_symbol + +(* +case+ l0 of +| LABint(i0) => +| LABsym(s0) => +*) + +implement +jsonize_label + (l0) = labval2(jsonize("label"), rst) where +val rst = +( + case+ label_get_int(l0) of + | ~None_vt() => ( + case+ label_get_sym(l0) of + | ~None_vt() => jsonize("None") + | ~Some_vt(sym) => + jsonify("LABsym", "s0", jsonize(sym)) + ) + | ~Some_vt(int) => + jsonify("LABint", "i0", jsonize(int)) +) +end diff --git a/contrib/sparverius/xjsonize/DATS/lexing_token.dats b/contrib/sparverius/xjsonize/DATS/lexing_token.dats new file mode 100644 index 000000000..a1b81f915 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/lexing_token.dats @@ -0,0 +1,267 @@ +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#staload "./../SATS/lexing.sats" + +#staload SYM_J = "./../SATS/symbol.sats" + +overload jsonize with $SYM_J.jsonize_symbol + + +implement +jsonize_tnode(tnd) = //labval2(jsonize("tnode"), res) where +jsonval_labval1("tnode", res) where +val res = +( +case+ tnd of +// +| T_EOF() => jsonize("EOF") +| T_ERR() => jsonize("ERR") +// +| T_EOL() => jsonize("EOL") +// +| T_BLANK(x) => + labval2(jsonize("BLANK"), jnul()) // x, ")") +// +| T_CLNLT(x) => + labval2(jsonize("CLNLT"), jnul()) // x, ")") +| T_DOTLT(x) => + labval2(jsonize("DOTLT"), jnul()) // x, ")") +// +| T_IDENT_alp(x) => + labval2(jsonize("IDENT_alp"), jnul()) // x, ")") +| T_IDENT_sym(x) => + labval2(jsonize("IDENT_sym"), jnul()) // x, ")") +// +| T_IDENT_srp(x) => + labval2(jsonize("IDENT_srp"), jnul()) // x, ")") +| T_IDENT_dlr(x) => + labval2(jsonize("IDENT_dlr"), jnul()) // x, ")") +// +| T_IDENT_qual(x) => + labval2(jsonize("IDENT_qual"), jnul()) // x, ")") +// +| T_INT1(rep) => + labval2(jsonize("INT1"), jnul()) // rep, ")") +| T_INT2(base, rep) => + labval2(jsonize("INT3"), jnul()) // base, ", ", rep, ")") +| T_INT3(base, rep, k0(*sfx*)) => + labval2(jsonize("INT3"), jnul()) // base, ", ", rep, ", ", k0, ")") +// +| T_FLOAT1(rep) => + labval2(jsonize("FLOAT1"), jnul()) // rep, ")") +| T_FLOAT2(base, rep) => + labval2(jsonize("FLOAT2"), jnul()) // base, ", ", rep, ")") +| T_FLOAT3(base, rep, k0(*sfx*)) => + labval2(jsonize("FLOAT3"), jnul()) // base, ", ", rep, ", ", k0, ")") +// +(* +| T_CHAR(chr) => + let + val chr = int2char0(chr) + in + labval2(jsonize("CHAR"), jnul()) // chr, ")") + end +*) +| T_CHAR_nil(rep) => + labval2(jsonize("CHAR_nil"), jnul()) // rep, ")") +| T_CHAR_char(rep) => + labval2(jsonize("CHAR_char"), jnul()) // rep, ")") +| T_CHAR_slash(rep) => + labval2(jsonize("CHAR_slash"), jnul()) // rep, ")") +// +| T_STRING_closed(str) => + labval2(jsonize("STRING_closed"), jnul()) // str, ")") +| T_STRING_unclsd(str) => + labval2(jsonize("STRING_unclsd"), jnul()) // str, ")") +// +(* +| T_CDATA(cdata, asz) => labval2(jsonize("CDATA(...)") +*) +// +| T_SPECHAR(c) => + labval2(jsonize("SPECHAR"), jnul()) // int2char0(c), ")") +// +| T_COMMENT_line + (init, content) => + labval2(jsonize("T_COMMENT_line"), jnul()) // init, "; ", "...)") +| T_COMMENT_rest + (init, content) => + labval2(jsonize("T_COMMENT_rest"), jnul()) // init, "; ", "...)") +| T_COMMENT_cblock + (level, content) => + labval2(jsonize("T_COMMENT_cblock"), jnul()) // level, "; ", "...)") +| T_COMMENT_mlblock + (level, content) => + labval2(jsonize("T_COMMENT_mlblock"), jnul()) // level, "; ", "...)") +// +| T_AT() => jsonize("AT") +// +| T_BAR() => jsonize("BAR") +| T_CLN() => jsonize("CLN") +| T_DOT() => jsonize("DOT") +// +| T_EQ() => jsonize("EQ") +// +| T_LT() => jsonize("LT") +| T_GT() => jsonize("GT") +// +| T_DLR() => jsonize("DLR") +| T_SRP() => jsonize("SRP") +// +| T_EQLT() => jsonize("EQLT") +| T_EQGT() => jsonize("EQGT") +// +| T_LTGT() => jsonize("LTGT") +| T_GTLT() => jsonize("GTLT") +// +| T_MSLT() => jsonize("MSLT") +(* +| T_MSGT() => jsonize("MSGT") +| T_MSLTGT() => jsonize("MSLTGT") +*) +// +(* +| T_DOTLT() => jsonize("DOTLT") +*) +| T_GTDOT() => jsonize("GTDOT") +// +| T_COMMA() => jsonize("COMMA") +| T_SMCLN() => jsonize("SMCLN") +// +| T_BSLASH() => jsonize("BSLASH") +// +| T_LPAREN() => jsonize("LPAREN") +| T_RPAREN() => jsonize("RPAREN") +| T_LBRACE() => jsonize("LBRACE") +| T_RBRACE() => jsonize("RBRACE") +// +| T_LBRACK() => jsonize("LBRACK") +| T_RBRACK() => jsonize("RBRACK") +// +| T_EXISTS(knd) => + labval2(jsonize("EXISTS"), jnul()) // knd, ")") +// +| T_TUPLE(knd) => + labval2(jsonize("TUPLE"), jnul()) // knd, ")") +| T_RECORD(knd) => + labval2(jsonize("RECORD"), jnul()) // knd, ")") +(* +| T_STRUCT() => jsonize("STRUCT") +*) +// +| T_AS() => jsonize("AS") +// +| T_OF() => jsonize("OF") +// +| T_OP() => jsonize("OP") +// +| T_OP_par() => + jsonize("OP_par()") +| T_OP_sym(id) => + labval2(jsonize("OP_sym"), jnul()) // id, ")") +// +| T_IN() => jsonize("IN") +// +| T_AND() => jsonize("AND") +| T_END() => jsonize("END") +// +| T_IF() => jsonize("IF") +| T_SIF() => jsonize("SIF") +| T_THEN() => jsonize("THEN") +| T_ELSE() => jsonize("ELSE") +// +| T_WHEN() => jsonize("WHEN") +| T_WITH() => jsonize("WITH") +// +| T_CASE(k0) => + labval2(jsonize("CASE"), jnul()) // k0, ")") +// +| T_SCASE() => jsonize("SCASE()") +// +| T_ENDIF() => jsonize("ENDIF") +| T_ENDSIF() => jsonize("ENDSIF") +| T_ENDCASE() => jsonize("ENDCASE") +| T_ENDSCASE() => jsonize("ENDSCASE") +// +| T_LAM(knd) => + labval2(jsonize("LAM"), jnul()) // knd, ")") +| T_FIX(knd) => + labval2(jsonize("FIX"), jnul()) // knd, ")") +// +| T_LET() => jsonize("LET") +| T_WHERE() => jsonize("WHERE") +| T_LOCAL() => jsonize("LOCAL") +// +| T_ENDLAM() => jsonize("ENDLAM") +| T_ENDLET() => jsonize("ENDLET") +| T_ENDWHERE() => jsonize("ENDWHERE") +| T_ENDLOCAL() => jsonize("ENDLOCAL") +// +| T_VAL(vlk) => + labval2(jsonize("VAL"), jnul()) // vlk, ")") +| T_VAR() => jsonize("VAR") +// +| T_FUN(fnk) => + labval2(jsonize("FUN"), jnul()) // fnk, ")") +// +| T_IMPLMNT(knd) => + labval2(jsonize("IMPLMNT"), jnul()) // knd, ")") +// +| T_ABSSORT() => + jsonize("ABSSORT") +// +| T_SORTDEF() => + labval2(jsonize("SORTDEF"), jnul()) // ")") +// +| T_SEXPDEF(srt) => + labval2(jsonize("SEXPDEF"), jnul()) // srt, ")") +// +| T_ABSTYPE(srt) => + labval2(jsonize("ABSTYPE"), jnul()) // srt, ")") +// +| T_ABSIMPL() => + jsonize("ABSIMPL") +| T_ABSOPEN() => + jsonize("ABSOPEN") +// +| T_DATASORT() => + jsonize("DATASORT") +| T_DATATYPE(srt) => + labval2(jsonize("DATATYPE"), jnul()) // srt, ")") +// +| T_WITHTYPE(srt) => + labval2(jsonize("WITHTYPE"), jnul()) // srt, ")") +// +| T_SRP_NONFIX() => + jsonize("#NONFIX") +| T_SRP_FIXITY(knd) => + labval2(jsonize("#FIXIXTY"), jnul()) // knd, ")") +// +| T_SRP_STACST() => jsonize("#STACST") +// +| T_SRP_STATIC() => jsonize("#STATIC") +| T_SRP_EXTERN() => jsonize("#EXTERN") +// +| T_SRP_DEFINE() => jsonize("#DEFINE") +| T_SRP_MACDEF() => jsonize("#MACDEF") +// +| T_SRP_INCLUDE() => jsonize("#INCLUDE") +// +| T_SRP_STALOAD() => jsonize("#STALOAD") +| T_SRP_DYNLOAD() => jsonize("#DYNLOAD") +// +| T_SRP_SYMLOAD() => jsonize("#SYMLOAD") +// +) (* end of [jsonize_tnode] *) +end + +implement +jsonize_token(tok) = + (* labval2(jsonize("token"), jsonize_tnode(tok.node())) *) + jsonval_labval1("token", jsonize_tnode(tok.node())) diff --git a/contrib/sparverius/xjsonize/DATS/locinfo.dats b/contrib/sparverius/xjsonize/DATS/locinfo.dats new file mode 100644 index 000000000..dc42d82e9 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/locinfo.dats @@ -0,0 +1,24 @@ +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + + +#define XATS_targetloc "./../../../../srcgen/xats" + + +#staload "{$XATS}/SATS/locinfo.sats" + + +#staload "./../SATS/locinfo.sats" + + +implement +jsonize_location(loc) = res where + val fp0 = location_filpath(loc) + val jfil = jsonize($FIL.filpath_get_full1(fp0)) + val res = jsonval_labval1("loc", jfil) +end diff --git a/contrib/sparverius/xjsonize/DATS/staexp0.dats b/contrib/sparverius/xjsonize/DATS/staexp0.dats new file mode 100644 index 000000000..3f8d7b5aa --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/staexp0.dats @@ -0,0 +1,773 @@ + +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/staexp0.sats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/label0.sats" +#staload "./../SATS/lexing.sats" + + +implement +jsonize_t0int + (x0) = +( +case+ x0.node() of +| T0INTnone(tok) => + jsonify("T0INTnone", "tok", jsonize(tok)) +| T0INTsome(tok) => + jsonify("T0INTsome", "tok", jsonize(tok)) +) + +implement +jsonize_t0chr + (x0) = +( +case+ x0.node() of +| T0CHRnone(tok) => + jsonify("T0CHRnone", "tok", jsonize(tok)) +| T0CHRsome(tok) => + jsonify("T0CHRsome", "tok", jsonize(tok)) +) + + +implement +jsonize_t0flt + (x0) = +( +case+ x0.node() of +| T0FLTnone(tok) => + jsonify("T0FLTnone", "tok", jsonize(tok)) +| T0FLTsome(tok) => + jsonify("T0FLTsome", "tok", jsonize(tok)) +) + + +implement +jsonize_t0str + (x0) = +( +case+ x0.node() of +| T0STRnone(tok) => + jsonify("T0STRnone", "tok", jsonize(tok)) +| T0STRsome(tok) => + jsonify("T0STRsome", "tok", jsonize(tok)) +) + + +implement +jsonize_i0dnt + (x0) = +( +case+ x0.node() of +| I0DNTnone(tok) => + (* fprint!(out, "I0DNTnone(", tok, ")") *) + jsonify("I0DNTnone", "tok", jsonize(tok)) +| I0DNTsome(tok) => + (* fprint!(out, "I0DNTsome(", tok, ")") *) + jsonify("I0DNTsome", "tok", jsonize(tok)) +) + + +implement +jsonize_l0abl + (l0) = +( +case+ +l0.node() of +| L0ABLsome(lab) => + jsonify("L0ABLsome", "lab", jsonize(lab)) +| L0ABLnone(tok) => + jsonify("L0ABLnone", "tok", jsonize(tok)) +) + + +implement +jsonize_s0ymb + (x0) = +( +case+ +x0.node() of +// +| S0YMBi0dnt(id0) => + jsonify("S0YMBi0dnt", "id0", jsonize(id0)) +// +| S0YMBdtlab(dot1, lab2) => + jsonify("S0YMBdtlab", ("dot1", "lab2"), (jsonize(dot1), jsonize(lab2))) +| S0YMBbrack(tok1, tok2) => + jsonify("S0YMBbrack", ("tok1", "tok2"), (jsonize(tok1), jsonize(tok2))) +// +) (* end of [jsonize_s0ymb] *) + + + +implement +jsonize_sq0eid + (x0) = +( +case+ x0 of +| SQ0EIDnone(sid) => + jsonify("SQ0EIDnone", "sid", jsonize(sid)) +| SQ0EIDsome(tok, sid) => + jsonify("SQ0EIDsome", ("tok", "sid"), (jsonize(tok), jsonize(sid))) +) + + +implement +jsonize_dq0eid + (x0) = +( +case+ x0 of +| DQ0EIDnone(sid) => + jsonify("DQ0EIDnone", "sid", jsonize(sid)) +| DQ0EIDsome(tok, sid) => + jsonify("DQ0EIDsome", ("tok", "sid"), (jsonize(tok), jsonize(sid))) +) + + + +local + +implement +jsonize_val = jsonize_g0exp + +in (* in-of-local *) + +implement +jsonize_g0exp + (x0) = +( +case+ x0.node() of +// +| G0Eid(tid) => + jsonify("GOEid", "tid", jsonize(tid)) +// +| G0Eint(int) => + jsonify("GOEint", "int", jsonize(int)) +// +| G0Eapps(s0ts) => + (* fprint!(out, "G0Eapps(", s0ts, ")") *) + jsonify("GOEapps", "s0ts", rst) where + (* val rst = jsonize_list<() *) + (* val rst = jnul() where val _ = $showtype(s0ts) end *) + val rst = jsonize_list(s0ts) + end +// +| G0Elist(t0, g0es, t1) => + (* fprint! *) + (* (out, "G0Elist(", t0, "; ", g0es, "; ", t1, ")") *) + jsonify("GOElist", ("t0", "g0es", "t1"), rst) where + val jt0 = jsonize(t0) + val jg0es = jsonize_list(g0es) + val jt1 = jsonize(t1) + val rst = (jt0, jg0es, jt1) + end +// +| G0Enone(tok) => + (* fprint!( out, "G0Enone(", tok, ")" ) *) + jsonify("G0Enone", "tok", jsonize(tok)) + // end of [G0Enone] +// +) (* end of [fprint_g0exp] *) + +end + + +local + +implement +jsonize_val = jsonize_i0dnt + +in (* in-of-local *) + +implement +jsonize_g0marg + (x0) = +( +case+ +x0.node() of +| G0MARGnone(tok) => + jsonify("G0MARGnone", "tok", jsonize(tok)) +| G0MARGsarg(tbeg, g0as, tend) => + jsonify("G0MARGsarg", ("tbeg", "g0as", "tend"), rst) where + val rst = (jsonize(tbeg), jsonize_list(g0as), jsonize(tend)) + end +| G0MARGdarg(tbeg, g0as, tend) => + jsonify("G0MARGdarg", ("tbeg", "g0as", "tend"), rst) where + val rst = (jsonize(tbeg), jsonize_list(g0as), jsonize(tend)) + end +) (* jsonize_g0marg *) + +end // end of [local] + + +local + +implement +jsonize_val = jsonize_sort0 + +in (* in-of-local *) + +implement +jsonize_sort0 + (x0) = +( +case+ x0.node() of +// +| S0Tid(tid) => + jsonify("S0Tid", "tid", jsonize(tid)) +// +| S0Tint(int) => + jsonify("S0Tint", "tid", jsonize(int)) +// +| S0Tapps(s0ts) => + jsonify("S0Tapps", "s0ts", jsonize_list(s0ts)) +// +| S0Tlist(t0, s0ts, t1) => + jsonify("S0Tlist", ("t0", "s0ts", "t1"), rst) where + val js0ts = jsonize_list(s0ts) + val rst = (jsonize(t0), js0ts, jsonize(t1)) + end +// +| S0Tqual(q0, s0t) => + jsonify("S0Tqid", ("q0", "s0t"), (jsonize(q0), jsonize(s0t))) +// +| S0Tnone(tok) => + jsonify("S0Tnone", "tok", jsonize(tok)) +// +) (* end of [jsonize_sort0] *) + +end // end of [local] + + + +implement +jsonize_s0rtcon + (x0) = +( +case+ x0.node() of +| S0RTCON(sid, opt) => + (* fprint!(out, "S0RTCON(", sid, ", ", opt, ")") *) + jsonify("S0RTCON", ("sid", "opt"), (jsonize(sid), jsonize("..."))) +) (* end of [fprint_s0rtcon] *) + + +local + +implement jsonize_val = jsonize_s0rtcon + +in + +implement +jsonize_d0tsort + (x0) = +( +case+ x0.node() of +| D0TSORT(tid, tok, s0cs) => + (* fprint! *) + (* (out, "D0TSORT(", tid, "; ", tok, "; ", s0cs, ")") *) + jsonify("D0RTCON", ("tid", "tok", "s0cs"), ( + jsonize(tid), + jsonize(tok), + jsonize_list(s0cs) + ) + ) +) (* end of [jsonize_d0tsort] *) + +end + + + +implement +jsonize_s0rtdef + (x0) = +( +case+ x0.node() of +| S0RTDEFsort(s0t) => + jsonify("S0RTDEFsort", "s0t", jsonize(s0t)) +| S0RTDEFsbst(tbeg, s0a0, tbar, s0es, tend) => + jsonify("S0RTDEFsbst", args, rst) where + val args = ("tbeg", "s0a0", "tbar", "s0es", "tend") + val rst = ( + jsonize(tbeg), + jsonize(s0a0), + jsonize(tbar), + jstr("..."), + jsonize(tend) + ) + end +) (* end of [jsonize_s0rtdef] *) + + +implement +jsonize_s0arg + (x0) = +( +case+ +x0.node() of +| S0ARGnone(tok) => + jsonify("S0ARGnone", "tok", jsonize(tok)) +| S0ARGsome(sid, opt) => + jsonify("S0ARGsome", ("sid", "opt"), (jsonize(sid), jsonize("..."))) +) (* jsonize_s0arg *) + +implement +jsonize_s0marg + (x0) = +( +case+ +x0.node() of +| S0MARGnone(tok) => + jsonify("S0MARGnone", "tok", jsonize(tok)) +| S0MARGsing(tid) => + jsonify("S0MARGsing", "tid", jsonize(tid)) +| S0MARGlist(tbeg, s0as, tend) => + jsonify("S0MARGlist", ("tbeg", "s0as", "tend"), + ( + jsonize(tbeg), + jstr("..."), + jsonize(tend) + ) + ) +) (* jsonize_s0marg *) + + +implement +jsonize_t0arg + (x0) = +( +case+ +x0.node() of +| T0ARGsome(tid, opt) => + jsonify("T0ARGsome", ("sid", "opt"), (jsonize(tid), jsonize("..."))) +) (* jsonize_t0arg *) + +implement +jsonize_t0marg + (x0) = +( +case+ +x0.node() of +| T0MARGnone(tok) => + jsonify("T0MARGnone", "tok", jsonize(tok)) +| T0MARGlist(tbeg, t0as, tend) => + jsonify("T0MARGlist", ("tbeg", "s0as", "tend"), + ( + jsonize(tbeg), + jstr("..."), + jsonize(tend) + ) + ) +) (* jsonize_t0marg *) + + + +implement +jsonize_s0qua + (x0) = +( +case+ x0.node() of +| S0QUAprop(s0e) => + jsonify("S0QUAprop", "s0e", jsonize(s0e)) +| S0QUAvars(ids, opt) => + jsonify("S0QUAprop", ("ids", "opt"), (jstr("..."),jstr("..."))) +) + + +implement +jsonize_s0uni + (x0) = +( +case+ x0.node() of +| S0UNInone(tok) => + jsonify("S0UNInone", "tok", jsonize(tok)) +| S0UNIsome(tbeg, s0qs, tend) => + jsonify("S0UNIsome", ("tbeg", "s0qs", "tend"), ( + jsonize(tbeg), + jstr("..."), + jsonize(tend) + ) + ) +) + + +implement +{a}(*tmp*) +jsonize_sl0abled + (x0) = let +// +val+SL0ABLED(l0, t0, x1) = x0 +// +in + jsonify("SL0ABLED", ("l0", "t0", "x1"), rst) where + val rst = ( + jsonize(l0), + jsonize(t0), + jsonize_val(x1) + ) + end +end // end of [fprint_sl0abled] + + + +local + +implement jsonize_val = jsonize_s0exp +implement jsonize_val = jsonize_s0marg +(* +implement(a:t@ype) +jsonize_val = jsonize_sl0abled +*) + +in (* in-of-local *) + +implement +jsonize_s0exp + (x0) = +( +case+ x0.node() of +// +| S0Eid(sid) => + jsonify("S0Eid", "sid", jsonize(sid)) +// +| S0Eop1(opid) => + jsonify("S0Eop1", "opid", jsonize(opid)) +| S0Eop2(tbeg, opid, tend) => + jsonify( + "S0Eop1", ( + "tbeg", + "opid", + "tend" + ), ( + jsonize(tbeg), + jsonize(opid), + jsonize(tend) + ) + ) +// +| S0Eint(i0) => + (* fprint!(out, "S0Eint(", i0, ")") *) + jsonify("S0Eint", "i0", jsonize(i0)) +| S0Echr(c0) => + jsonify("S0Echr", "c0", jsonize(c0)) +| S0Eflt(f0) => + jsonify("S0Eflt", "f0", jsonize(f0)) +| S0Estr(s0) => + (* fprint!(out, "S0Estr(", s0, ")") *) + jsonify("S0Estr", "s0", jsonize(s0)) +// +| S0Eapps(s0es) => + jsonify("S0Eapps", "s0es", jsonize_list(s0es)) +// +| S0Eimp(tbeg, s0es, tend) => + (* jsonify("S0Eimp", "s0es", jsonize_list(s0es))// *) + jsonify( + "S0Eimp", ( + "tbeg", + "s0es", + "tend" + ), ( + jsonize(tbeg), + jsonize_list(s0es), + jsonize(tend) + ) + ) +| S0Eparen + (tbeg, s0es, tend) => + (* fprint! *) + (* ( out *) + (* , "S0Eparen(", tbeg, "; ", s0es, "; ", tend, ")") *) + jsonify( + "S0Eparen", ( + "tbeg", + "s0es", + "tend" + ), ( + jsonize(tbeg), + jsonize_list(s0es), + jsonize(tend) + ) + ) + +// +| S0Eforall(tbeg, s0qs, tend) => + (* fprint! *) + (* ( out *) + (* , "S0Eforall(", tbeg, "; ", s0qs, "; ", tend, ")") *) + jsonify( + "S0Eforall", ( + "tbeg", + "s0qs", + "tend" + ), ( + jsonize(tbeg), + jsonize("..."), //jsonize_list(s0es), + jsonize(tend) + ) + ) + +| S0Eexists(tbeg, s0qs, tend) => + jsonify( + "S0Eexists", ( + "tbeg", + "s0qs", + "tend" + ), ( + jsonize(tbeg), + jsonize("..."), //jsonize_list(s0es), + jsonize(tend) + ) + ) +// +| S0Etuple + (tbeg, topt, s0es, tend) => + jsonify( + "S0Etuple", ( + "tbeg", + "topt", + "s0es", + "tend" + ), ( + jsonize(tbeg), + jsonize("..."), + jsonize_list(s0es), + jsonize(tend) + ) + ) +| S0Erecord + (tbeg, topt, s0es, tend) => + jsonify( + "S0Erecord", ( + "tbeg", + "topt", + "s0es", + "tend" + ), ( + jsonize(tbeg), + jsonize("..."), + jsonize("..."), (* jsonize_list(s0es) *) + jsonize(tend) + ) + ) +// +| S0Elam + ( tbeg + , arg0, res1 + , tok1, s0e0, tend) => + jsonify( + "S0Elam", ( + "tbeg", + "arg0", + "res1", + "tok1", + "s0e0", + "tend" + ), ( + jsonize(tbeg), + jsonize_list(arg0), + jsonize("..."), //jsonize(res1), + jsonize(tok1), + jsonize(s0e0), + jsonize("...") //jsonize(tend) + ) + ) + where + (* val _ = showtype(res1) *) + (* val _ = showtype(tend) *) + end +// +| S0Eanno + (s0e, ann) => + jsonify( + "S0Eanno", ( + "s0e", + "ann" + ), ( + jsonize(s0e), + jsonize(ann) + ) + ) +// +| S0Equal + (tok, s0e) => + jsonify( + "S0Equal", ( + "tok", + "s0e" + ), ( + jsonize(tok), + jsonize(s0e) + ) + ) +// +| S0Enone(tok) => + jsonify("S0Enone", "tok", jsonize(tok)) +// +) (* end of [jsonize_s0exp] *) + +end // end of [local] + + + +local + +implement +jsonize_val = jsonize_s0exp + +in (* in-of-local *) + +implement +jsonize_s0exp_RPAREN + (x0) = +( +case+ x0 of +| s0exp_RPAREN_cons0(tok) => + jsonify("s0exp_RPAREN_cons0", "tok", jsonize(tok)) +| s0exp_RPAREN_cons1(tok1, s0es, tok2) => + jsonify("s0exp_RPAREN_cons1", ( + "tok1", + "s0es", + "tok2" + ), ( + jsonize(tok1), + jsonize_list(s0es), + jsonize(tok2) + ) + ) +) (* end of [jsonize_s0exp_RPAREN] *) + +end // end of [local] + + + +local + +implement +jsonize_val = jsonize_s0exp + +in (* in-of-local *) + +implement +jsonize_labs0exp_RBRACE + (x0) = +( +case+ x0 of +| labs0exp_RBRACE_cons0(tok) => + jsonify("labs0exp_RBRACE_cons0", "tok", jsonize(tok)) +| labs0exp_RBRACE_cons1(tok1, ls0es, tok2) => + jsonify("labs0exp_RBRACE_cons0", ( + "tok1", + "ls0es", + "tok2" + ), ( + jsonize(tok1), + jsonize("..."), (* jsonize_list(ls0es) *) + jsonize(tok2) + ) + ) +) (* end of [jsonize_labs0exp_RBRACE] *) + +end // end of [local] + + + +implement +jsonize_effs0expopt + (x0) = +( +case+ x0 of +| EFFS0EXPnone() => + jsonify("EFFS0EXPnone") +| EFFS0EXPsome(s0e) => + jsonify("EFFS0EXPsome", "s0e", jsonize(s0e)) +(* +| EFFS0EXPsome(s0f, s0e) => + fprint! + ( out + , "EFFS0EXPsome(", s0f, "; ", s0e, ")") +*) +) (* end of [fprint_effs0expopt] *) + + + +implement jsonize_val = jsonize_t0marg +implement jsonize_val = jsonize_d0atcon + +implement +jsonize_d0atype + (x0) = +( +case+ x0.node() of +| D0ATYPE(tid, arg, res, teq, d0cs) => + jsonify ( + "D0ATYPE", + ( + "tid", + "arg", + "res", + "teq", + "d0cs" + ), + ( + jsonize(tid), + jsonize_list(arg), //jsonize(arg), + jsonize("..."), // jsonize(res), + jsonize(teq), + jsonize_list(d0cs) + ) + ) +) (* end of [jsonize_d0atype] *) + + +local + +implement jsonize_val = jsonize_s0uni +implement jsonize_val = jsonize_s0exp + +in + +implement +jsonize_d0atcon + (x0) = +( +case+ x0.node() of +| D0ATCON(s0us, dcon, s0is, argopt) => + jsonify( + "D0ATCON", + ( + "s0us", + "dcon", + "s0is", + "argopt" + ), + ( + jsonize_list(s0us), + jsonize(dcon), + jsonize_list(s0is), + jsonize("...") + ) + ) + where + (* val _ = $showtype(s0us) *) + (* val _ = $showtype(s0is) *) + (* val _ = $showtype(argopt) *) + val jargopt = ( + case+ argopt of + | None() => jsonize("None") + | Some(x) => jsonize(x) + ) + end +) (* end of [jsonize_d0atcon] *) + +end diff --git a/contrib/sparverius/xjsonize/DATS/staexp1.dats b/contrib/sparverius/xjsonize/DATS/staexp1.dats new file mode 100644 index 000000000..f81f33ac0 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/staexp1.dats @@ -0,0 +1,170 @@ + +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/staexp0.sats" +#staload "{$XATS}/SATS/staexp1.sats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/label0.sats" +#staload "./../SATS/lexing.sats" + +#staload "./../SATS/staexp1.sats" + +#staload SYM_J = "./../SATS/symbol.sats" +overload jsonize with $SYM_J.jsonize_symbol + + +local + +implement +jsonize_val = jsonize_sort1 + +in (* in-of-local *) + +implement +jsonize_sort1 + (x0) = +( +case+ x0.node() of +// +| S1Tid(id) => + jsonify("S1Tid", "id", jsonize(id)) +// +| S1Tint(int) => + jsonify("S1Tapp", "int", jsonize(int)) +// +| S1Tapp() => + jsonify("S1Tapp") +// +(* +| S1Ttype(knd) => + fprint!(out, "S1Ttype", knd, ")") +*) +// +(* +| S1Tapp(s1t0, s1ts) => + fprint! + (out, "S1Tapp(", s1t0, "; ", s1ts, ")") +*) +// +| S1Tapp1 + (s1t0, s1t1) => + jsonify("S1Tapp1", ("s1t0", "s1t1"), (jsonize(s1t0), jsonize(s1t1))) +| S1Tapp2 + (s1t0, s1t1, s1t2) => + jsonify("S1Tapp2", ("s1t0", "s1t1", "s1t2"), + ( + jsonize(s1t0), + jsonize(s1t1), + jsonize(s1t2) + ) + ) +// +| S1Tlist(s1ts) => + jsonify("S1Tlist", "s1ts", jsonize_list(s1ts)) +// +| S1Tqual(tok0, s1t1) => + jsonify("S1Tnone", ("tok0", "s1t1"), (jsonize(tok0), jsonize(s1t1))) +// +| S1Tnone((*void*)) => + jsonify("S1Tnone") +// +) (* end of [jsonize_sort1] *) + +end // end of [local] + + + +local + +implement +jsonize_val = jsonize_s1exp + +in (* in-of-local *) + +implement +jsonize_s1exp + (x0) = +( +case+ x0.node() of +// +| S1Eid(sid) => + jsonize("S1Eid") +// +| S1Eint(tok) => + jsonize("S1Eint") +| S1Echr(tok) => + jsonize("S1Echr") +| S1Eflt(tok) => + jsonize("S1Eflt") +| S1Estr(tok) => + jsonize("S1Estr") +// +| S1Eapp() => + jsonize("S1Eapp") +// +| S1Eapp1 + (s1e0, s1e1) => + jsonize("S1Eapp1") +| S1Eapp2 + (s1e0, s1e1, s1e2) => + jsonize("S1Eapp2") +// +| S1Ebs0() => + jsonize("S1Ebs0") +| S1Ebs1(s1e) => + jsonize("S1Ebs1") +// +| S1Eimp(s1es) => + jsonize("S1Eimp") +// +(* +| S1Eapp(s1e0, s1es) => +*) +// +| S1Elist(s1es) => + jsonize("S1Elist") +| S1Elist(s1es1, s1es2) => + jsonize("S1Elist") +// +| S1Etuple(k0, s1es) => + jsonize("S1Etuple") +| S1Etuple(k0, s1es1, s1es2) => + jsonize("S1Etuple") +// +| S1Erecord(k0, ls1es) => + jsonize("S1Erecord") +| S1Erecord(k0, ls1es1, ls1es2) => + jsonize("S1Erecord") +// +| S1Eforall(s1qs) => + jsonize("S1Eforall") +| S1Eexists(k0, s1qs) => + jsonize("S1Eexists") +// +| S1Elam(arg, res, s1e) => + jsonize("S1Elam") +// +| S1Eanno(s1e, s1t) => + jsonize("S1Eanno") +// +| S1Equal(tok, s1e) => + jsonize("S1Equal") +// +| S1Enone(loc) => + jsonize("S1Enone") +// +) (* jsonize_s0exp *) + +end // end of [local] diff --git a/contrib/sparverius/xjsonize/DATS/staexp2.dats b/contrib/sparverius/xjsonize/DATS/staexp2.dats new file mode 100644 index 000000000..e2b207344 --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/staexp2.dats @@ -0,0 +1,444 @@ + +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/staexp0.sats" +#staload "{$XATS}/SATS/staexp1.sats" +#staload "{$XATS}/SATS/staexp2.sats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#staload "./../SATS/basics.sats" + + +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/label0.sats" +#staload "./../SATS/lexing.sats" + +#staload "./../SATS/staexp1.sats" +#staload "./../SATS/staexp2.sats" + +#staload SYM = "./../SATS/symbol.sats" +#staload LOC = "./../SATS/locinfo.sats" +#staload STM = "./../SATS/stamp0.sats" +#staload LAB = "./../SATS/label0.sats" + +overload jsonize with $LOC.jsonize_location +overload jsonize with $SYM.jsonize_symbol +overload jsonize with $STM.jsonize_stamp + +overload jsonize with $LAB.jsonize_label + + +local + +implement +jsonize_val = jsonize_sort2 + +in (* in-of-local *) + +implement +jsonize_sort2 + (s2t0) = +( +case+ s2t0 of +// +| S2Tid(id) => + jsonify("S2Tid", "id", jsonize(id)) +| S2Tint(i0) => + jsonify("S2Tint", "i0", jsonize(i0)) +| S2Tbas(s2tb) => + jsonify("S2Tbas", "s2tb", jsonize(s2tb)) +| S2Ttup() => + jsonify("S2Ttup") +| S2Ttup(s2ts) => + jsonify("S2tup", "s2ts", jsonize_list(s2ts)) +| S2Tfun() => + jsonify("S2Tfun") +| S2Tfun(s2ts, s2t1) => + jsonify("S2fun", + ("s2ts", "s2t1"), + ( + jsonize_list(s2ts), + jsonize(s2t1) + ) + ) +| S2Tapp(s2t1, s2ts) => + jsonify("S2app", + ("s2t1", "s2ts"), + ( + jsonize(s2t1), + jsonize_list(s2ts) + ) + ) +| S2Tnone0() => + jsonify("S2Tnone0") +| S2Tnone1(s1tsrc) => + jsonify("S2Tnone1", "s1tsrc", jsonize(s1tsrc)) +) (* end of [jsonize_sort2] *) + +end // end of [local] + + +implement +jsonize_t2bas + (s2tb) = +( +case+ s2tb of +| T2BASpre(sym) => + jsonify("T2BASpre", "sym", jsonize(sym)) +| T2BASabs(abs) => + jsonify("T2BASabs", "sym", jsonize(abs)) +| T2BASdat(dat) => + jsonify("T2BASabs", "dat", jsonize(dat)) +| T2BASimp(knd, sym) => + (* fprint!(out, "T2BASimp(", knd, "; ", sym, ")") *) + jsonify("T2BASimp", ("knd", "sym"), (jsonize(knd), jsonize(sym))) +) + + +implement +jsonize_t2abs(x0) = +jsonval_labval1("t2abs", jsonize(x0.sym())) + + +implement +jsonize_t2dat(x0) = +jsonval_labval1("t2dat", $SYM.jsonize_symbol(x0.sym())) + + +implement +jsonize_s2cst + (x0) = + jsonval_labval1("s2cst", rst) where + val lst = $list{labjsonval}( + $SYM.labify_symbol(x0.sym()), $STM.labify_stamp(x0.stamp()) + ) + val rst = JSONlablist(lst) + end +// (* end of [jsonize_s2cst] *) + + +implement +jsonize_s2var + (x0) = +jsonval_labval2("s2var", rst, "sort", jsrt) where + val lst = $list{labjsonval}( + $SYM.labify_symbol(x0.sym()), + $STM.labify_stamp(x0.stamp()) + ) + val rst = JSONlablist(lst) + val jsrt = jsonize(x0.sort()) + end + + +implement +jsonize_tyrec + (knd) = +( +case+ knd of +// +| TYRECbox0() => + jsonify("TYRECbox0") +| TYRECbox1() => + jsonify("TYRECbox1") +// +| TYRECflt0() => + jsonify("TYRECflt0") +(* +| TYRECflt1(stm) => + fprint!(out, "TYRECflt1(", stm, ")") +*) +| TYRECflt2(nam) => + jsonify("TYRECflt2", "nam", jsonize(nam)) +// +) (* end of [fprint_tyrec] *) + + + + +local + +implement +jsonize_val = jsonize_s2exp +implement +jsonize_val = jsonize_s2var +implement +jsonize_val = jsonize_labs2exp + +in (* in-of-local *) + +implement +jsonize_s2exp + (s2e0) = +( +case+ +s2e0.node() of +// +| S2Eint(i0) => + jsonify("S2Eint", "i0", jsonize(i0)) +| S2Echr(c0) => + jsonify("S2Echr", "c0", jsonize(c0)) +// +| S2Estr(s0) => + jsonify("S2Estr", "s0", jsonize(s0)) +// +| S2Ecst(s2c) => + jsonify("S2Ecst", "s2c", jsonize(s2c)) +(* + fprint! + (out, "S2Ecst(", s2c, "; ", s2c.sort(), ")") +*) +| S2Evar(s2v) => + jsonify("S2Evar", "s2v", jsonize(s2v)) +(* + fprint! + (out, "S2Evar(", s2v, "; ", s2v.sort(), ")") +*) +// +| S2Extv(xtv) => + let +(* + val s2e = "..." +*) + val s2e = s2xtv_get_sexp(xtv) + in + (* fprint!(out, "S2Extv(", s2e, ")") *) + jsonify("S2Extv", "xtv", jsonize(s2e)) + end +// +| S2Eapp + (s2fn, s2es) => + jsonify ( + "S2Eapp", + ( + "s2fn", + "s2es" + ), + ( + jsonize(s2fn), + jsonize_list(s2es) + ) + ) +| S2Elam + (s2vs, body) => + jsonify ( + "S2Elam", + ( + "s2vs", + "body" + ), + ( + jsonize("..."), + jsonize("...") + ) + ) +// +| S2Eany(knd) => + jsonify("S2Eany", "knd", jsonize(knd)) +// +| S2Etop(knd, s2e) => + jsonify("S2Eany", ("knd", "s2e"), (jsonize(knd), jsonize(s2e))) +// +| S2Earg(knd, s2e) => + jsonify("S2Earg", ("knd", "s2e"), (jsonize(knd), jsonize(s2e))) +| S2Eatx(bef, aft) => + jsonify("S2Eatx", ("bef", "aft"), (jsonize(bef), jsonize(aft))) +// +| S2Efun + (fc2, npf, arg, res) => + jsonify( + "S2Efun", + ( + "fc2", + "npf", + "arg", + "res" + ), + ( + jsonize(fc2), + jsonize(npf), + jsonize_list(arg), + jsonize(res) + ) + ) + +// +| S2Ecimp(loc, s2e) => + jsonify( + "S2Ecimp", + ( + "loc", + "s2e" + ), + ( + jsonize(loc), + jsonize(s2e) + ) + ) +| S2Ecprf(loc, s2e) => + jsonify( + "S2Ecprf", + ( + "loc", + "s2e" + ), + ( + jsonize(loc), + jsonize(s2e) + ) + ) + +| S2Ectcd(loc, s2e) => + jsonify( + "S2Ectcd", + ( + "loc", + "s2e" + ), + ( + jsonize(loc), + jsonize(s2e) + ) + ) + +| S2Ecast(loc, s2e, s2t) => + jsonify( + "S2Ecast", + ( + "loc", + "s2e", + "s2t" + ), + ( + jsonize(loc), + jsonize(s2e), + jsonize(s2t) + ) + ) +(* + fprint! + ( out + , "S2Ecast(" + , loc, "; ", s2e, "; ", s2t, ")") +*) +// +| S2Emet + (s2es, body) => + jsonify("S2Emet", ("s2es", "body"), (jsonize_list(s2es), jsonize(body))) +// +| S2Eexi + (s2vs, s2ps, body) => + jsonify( + "S2Eexi", + ( + "s2vs", + "s2ps", + "body" + ), + ( + jsonize_list(s2vs), + jsonize_list(s2ps), + jsonize(body) + ) + ) +| S2Euni + (s2vs, s2ps, body) => + jsonify( + "S2Euni", + ( + "s2vs", + "s2ps", + "body" + ), + ( + jsonize_list(s2vs), + jsonize_list(s2ps), + jsonize(body) + ) + ) + +// +(* +| S2Elist(s2es) => + fprint!(out, "S2Elist(", s2es, ")") +*) +// +| S2Etyrec + (knd, npf, ls2es) => + jsonify( + "S2Etyrec", + ( + "knd", + "npf", + "ls2es" + ), + ( + jsonize(knd), + jsonize(npf), + jsonize_list(ls2es) + ) + ) + + (* where val _ = $showtype(ls2es) end *) +// +| S2Etyext(tnm1, s2es) => + jsonify("S2Etyext", + ( + "tnm1", + "s2es" + ), + ( + jsonize(tnm1), + jsonize_list(s2es) + ) + ) +// +| S2Enone0() => + jsonify("S2Enone") +| S2Enone1(s1esrc) => + jsonify("S2Enone1", "s1esrc", jsonize(s1esrc)) +) (* end of [jsonize_s2exp] *) + +end // end of [local] + + +implement +jsonize_labs2exp + (ls2e) = +( +case+ ls2e of +| SLABELED(l0, s2e) => + jsonify("SLABELED", ("l0", "s2e"), ( + jsonize(l0), + jsonize(s2e)) + ) +) (* end of [jsonize_labs2exp] *) + + +local implement jsonize_val = jsonize_s2cst in + +implement +jsonize_s2itm + (x0) = +( +case+ x0 of +// +| S2ITMvar(s2v) => + jsonify("S2ITMvar", "s2v", jsonize(s2v)) +// +| S2ITMcst(s2cs) => + jsonify("S2ITMcst", "s2cs", jsonize_list(s2cs)) +// +| S2ITMfmodenv(fmod) => + jsonify("S2ITMcst", "fmod", jsonize("...")) +) +end diff --git a/contrib/sparverius/xjsonize/DATS/stamp0.dats b/contrib/sparverius/xjsonize/DATS/stamp0.dats new file mode 100644 index 000000000..c906f28da --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/stamp0.dats @@ -0,0 +1,36 @@ + + +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +(* +#include "./../HATS/libxatsopt.hats" +*) +#staload "./../SATS/stamp0.sats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + + +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/stamp0.sats" +#staload _ = "{$XATS}/DATS/stamp0.dats" + + + + +implement +jsonize_stamp(x0) = +( +(* + jsonval_labval2("node", nd, "val", vl) where + { + val nd = jstr("stamp") + val vl = jsonize(tostring_uint(stamp2uint(x0))) + } +*) +jsonval_labval1("stamp", jsonize(tostring_uint(stamp2uint(x0)))) +) + +implement +labify_stamp(x0) = ("stamp", jsonize(tostring_uint(stamp2uint(x0)))) diff --git a/contrib/sparverius/xjsonize/DATS/statyp2.dats b/contrib/sparverius/xjsonize/DATS/statyp2.dats new file mode 100644 index 000000000..8ad60f53c --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/statyp2.dats @@ -0,0 +1,244 @@ +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/staexp0.sats" +#staload "{$XATS}/SATS/staexp1.sats" +#staload "{$XATS}/SATS/staexp2.sats" +#staload "{$XATS}/SATS/statyp2.sats" + +#staload "./../SATS/staexp2.sats" +#staload "./../SATS/statyp2.sats" + +#staload SYM = "./../SATS/symbol.sats" +#staload LOC = "./../SATS/locinfo.sats" +#staload STM = "./../SATS/stamp0.sats" +#staload LAB = "./../SATS/label0.sats" + +overload jsonize with $LOC.jsonize_location +overload jsonize with $SYM.jsonize_symbol +overload jsonize with $STM.jsonize_stamp + +overload jsonize with $LAB.jsonize_label + + +local + +implement +jsonize_val = jsonize_labt2ype +implement +jsonize_val = jsonize_t2ype +implement +jsonize_val = jsonize_s2var + +in (* in-of-local *) +// +implement +jsonize_t2ype + (x0) = +( +case+ +x0.node() of +// +| T2Pbas(sym) => + (* fprint!(out, "T2Pbas(", sym, ")") *) + jsonify("T2Pbas", "sym", $SYM.jsonize_symbol(sym)) + (* where val _ = $showtype(sym) end *) +| T2Pcst(s2c) => + (* fprint!(out, "T2Pcst(", s2c, ")") *) + jsonify("T2Pcst", "s2c", jsonize(s2c)) +| T2Pvar(s2v) => + (* fprint!(out, "T2Pvar(", s2v, ")") *) + jsonify("T2Pvar", "s2v", jsonize(s2v)) +// +| T2Pxtv(xtv) => + let +(* + val t2p = "..." +*) + val t2p = t2xtv_get_type(xtv) + in + case+ + t2p.node() of + | T2Pnone0() => + ( + jsonify("T2Pxtv", "xtv", rst) + (* end *) + (* fprint! *) + (* (out, "T2Pxtv(", stm, ")") *) + (* ) *) + where + { + val stm = xtv.stamp((*void*)) + val rst = $STM.jsonize_stamp(stm) + } + ) + | _ (* else *) => + (* fprint!(out, "T2Pxtv(", t2p, ")") *) + jsonify("T2Pxtv", "xtv", rst) + where + { + val rst = jsonize(t2p) + } + + end +// +| T2Papp(t2p1, t2ps) => + (* fprint!(out, "T2Papp(", t2p1, "; ", t2ps, ")") *) + jsonify("T2Papp", args, rst) where + val args = ( + "t2p1", + "t2ps" + ) + val rst = ( + fst, + snd + ) where + val fst = jsonize(t2p1) + val snd = jsonize_list(t2ps) + end + end + +| T2Plam(s2vs, t2p1) => + (* fprint!(out, "T2Plam(", s2vs, "; ", t2p1, ")") *) + jsonify("T2Plam", args, rst) where + val args = ( + "s2vs", + "t2p1" + ) + val rst = ( + fst, + snd + ) where + val fst = jsonize_list(s2vs) + val snd = jsonize(t2p1) + end + end +// +| T2Pfc2(fc2) => + (* fprint! *) + (* (out, "T2Pfc2(", fc2, ")") *) + jsonify("T2pfc2", "fc2", jstr("...")) +| T2Pfun(fc2, npf, arg, res) => + (* fprint! *) + (* ( out, "T2Pfun(" *) + (* , fc2, "; ", npf, "; ", arg, "; ", res, ")") *) + jsonify("T2Pfun", args, rst) where + (* val _ = $showtype(fc2) *) + (* val _ = $showtype(res) *) + val args = ( + "fc2", + "npf", + "arg", + "res" + ) + val rst = ( + fst, + snd, + thd, + frh + ) where + val fst = jsonize(fc2) + val snd = jsonize(npf) + val thd = jsonize_list(arg) + val frh = jsonize(res) + end + end + +// +| T2Pexi(s2vs, body) => + (* fprint!(out, "T2Pexi(", s2vs, "; ", body, ")") *) + jsonify("T2Pexi", args, rst) where + (* val _ = $showtype(s2vs) *) + val args = ( + "s2vs", + "body" + ) + val rst = ( + fst, + snd + ) where + val fst = jsonize_list(s2vs) + val snd = jsonize(body) + end + end + +| T2Puni(s2vs, body) => + (* fprint!(out, "T2Puni(", s2vs, "; ", body, ")") *) + jsonify("T2Puni", args, rst) where + val args = ( + "s2vs", + "body" + ) + val rst = ( + fst, + snd + ) where + val fst = jsonize_list(s2vs) + val snd = jsonize(body) + end + end +// +| T2Ptyext(tnm1, t2ps) => + (* fprint!(out, "T2Ptyext(", tnm1, "; ", t2ps, ")") *) + jsonify("T2Ptyext", args, rst) where + val args = ( + "tnm1", + "t2ps" + ) + val rst = ( + fst, + snd + ) where + val fst = jsonize(tnm1) + val snd = jsonize_list(t2ps) + end + end// +| T2Ptyrec(knd1, npf2, lt2ps) => + (* fprint! *) + (* ( out *) + (* , "T2Ptyrec(", knd1, "; ", npf2, "; ", lt2ps, ")") *) + jsonify("T2Ptyrec", args, rst) where + val args = ( + "knd", + "npf2", + "lt2ps" + ) + val rst = ( + fst, + snd, + thd + ) where + (* val _ = $showtype(knd1) *) + val fst = jstr("...")//jsonize(knd1) + val snd = jsonize(npf2) + val thd = jsonize_list(lt2ps) + end + end// + +// +| T2Pnone0() => //fprint!(out, "T2Pnone0(", ")") + jsonify("T2Pnone0") +| T2Pnone1(s2e) => //fprint!(out, "T2Pnone1(", s2e, ")") + jsonify("T2Pnone1", "s2e", jsonize(s2e)) + +// +) + +end + + +implement +jsonize_labt2ype + (lt2p) = +( +case+ lt2p of +| TLABELED(l0, t2p) => //fprint!(out, l0, "=", t2p) + jsonify("TLABELED", ("l0", "t2p"), ($LAB.jsonize_label(l0), jsonize(t2p))) + (* where val _ = $showtype(l0) end *) +) (* end of [fprint_labt2ype] *) diff --git a/contrib/sparverius/xjsonize/DATS/symbol.dats b/contrib/sparverius/xjsonize/DATS/symbol.dats new file mode 100644 index 000000000..f736d73aa --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/symbol.dats @@ -0,0 +1,22 @@ +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/symbol.sats" + +#staload "./../SATS/symbol.sats" + + +implement +jsonize_symbol(x0) = +(* jsonval_labval2("node", jstr("symbol"), "val", jsonize(x0.name())) *) +jsonval_labval1("symbol", jsonize(x0.name())) + +implement +labify_symbol(x0) = ("symbol", jsonize(x0.name())) +(* jsonval_labval2("node", jstr("symbol"), "val", jsonize(x0.name())) *) diff --git a/contrib/sparverius/xjsonize/DATS/xjsonize.dats b/contrib/sparverius/xjsonize/DATS/xjsonize.dats new file mode 100644 index 000000000..11d6a778c --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/xjsonize.dats @@ -0,0 +1,115 @@ +(***********************************************************************) +(* *) +(* Applied Type System *) +(* *) +(***********************************************************************) + +(* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*) + +(* ****** ****** *) +// +// Author: Hongwei Xi +// Start Time: November, 2019 +// Authoremail: gmhwxiATgmailDOTcom +// +(* ****** ****** *) +// +#include +"share/atspre_staload.hats" +#staload +UN = "prelude/SATS/unsafe.sats" +// +(* ****** ****** *) +// + +#staload "./../SATS/json.sats" +#staload "./../SATS/basics.sats" +#staload "./../SATS/fixity.sats" +#staload "./../SATS/label0.sats" +#staload "./../SATS/locinfo.sats" +#staload "./../SATS/lexing.sats" +#staload "./../SATS/stamp0.sats" +#staload "./../SATS/symbol.sats" +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/dynexp0.sats" +#staload "./../SATS/staexp1.sats" +#staload "./../SATS/dynexp1.sats" +#staload "./../SATS/statyp2.sats" +#staload "./../SATS/staexp2.sats" +#staload "./../SATS/dynexp2.sats" +#staload "./../SATS/dynexp3.sats" +#staload "./../SATS/intrep0.sats" +#staload "./../SATS/interp0.sats" +(* #staload "./../SATS/trans01.sats" *) + +(* #staload _ = "./json.dats" *) +(* #staload _ = "./basics.dats" *) +(* #staload _ = "./label0.dats" *) +(* #staload _ = "./locinfo.dats" *) +(* #staload _ = "./lexing_token.dats" *) +(* #staload _ = "./staexp0.dats" *) +(* #staload _ = "./dynexp0.dats" *) +(* #staload _ = "./stamp0.dats" *) +(* #staload _ = "./symbol.dats" *) +(* #staload _ = "./staexp1.dats" *) +(* #staload _ = "./dynexp1.dats" *) +(* #staload _ = "./statyp2.dats" *) +(* #staload _ = "./staexp2.dats" *) +(* #staload _ = "./dynexp2.dats" *) +(* #staload _ = "./dynexp3.dats" *) +(* #staload _ = "./intrep0.dats" *) + + +#dynload "./json.dats" +#dynload "./basics.dats" +#dynload "./stamp0.dats" +#dynload "./symbol.dats" +#dynload "./label0.dats" +#dynload "./locinfo.dats" +#dynload "./lexing_token.dats" +#dynload "./staexp0.dats" +#dynload "./dynexp0.dats" +#dynload "./staexp1.dats" +#dynload "./dynexp1.dats" +#dynload "./statyp2.dats" +#dynload "./staexp2.dats" +#dynload "./dynexp2.dats" +#dynload "./dynexp3.dats" +#dynload "./intrep0.dats" +#dynload "./interp0.dats" +// +(* ****** ****** *) +// +implement +main0(argc, argv) = +( +// +if +(argc >= 2) +then interp0_main0(argc, argv) +else prerrln! ("Hello from ATS3(xinterp)!") +// end of [if] +) (* end of [main] *) +// +(* ****** ****** *) + +(* end of [xjsonize.dats] *) diff --git a/contrib/sparverius/xjsonize/HATS/libxatsopt.hats b/contrib/sparverius/xjsonize/HATS/libxatsopt.hats new file mode 100644 index 000000000..3d5ccbd61 --- /dev/null +++ b/contrib/sparverius/xjsonize/HATS/libxatsopt.hats @@ -0,0 +1,139 @@ +(* ****** ****** *) +// +#staload +ERR = +"./../../../../srcgen/xats/SATS/xerrory.sats" +// +(* ****** ****** *) +// +#staload +STM = +"./../../../../srcgen/xats/SATS/stamp0.sats" +#staload +SYM = +"./../../../../srcgen/xats/SATS/symbol.sats" +// +(* ****** ****** *) +// +#staload +FP0 = +"./../../../../srcgen/xats/SATS/filpath.sats" +// + typedef + fpath_t = $FP0.filpath + macdef + dirbase = + $FP0.filpath_dirbase + macdef + fpath_make = $FP0.filpath_make +// +(* ****** ****** *) +// +#staload +GLO = +"./../../../../srcgen/xats/SATS/global.sats" +#staload +FS0 = +"./../../../../srcgen/xats/SATS/filsrch.sats" +// +(* ****** ****** *) +// +(* +#staload +"./../../../../srcgen/xats/SATS/json.sats" +*) +#staload +"./../../../../srcgen/xats/SATS/lexing.sats" +// +#staload +"./../../../../srcgen/xats/SATS/parsing.sats" +// +#staload +"./../../../../srcgen/xats/SATS/synread.sats" +// +#staload +"./../../../../srcgen/xats/SATS/trans01.sats" +#staload +"./../../../../srcgen/xats/SATS/t1xread.sats" +// +#staload +"./../../../../srcgen/xats/SATS/trans12.sats" +#staload +"./../../../../srcgen/xats/SATS/t2xread.sats" +// +#staload +"./../../../../srcgen/xats/SATS/trans23.sats" +#staload +"./../../../../srcgen/xats/SATS/trans33.sats" +// +#staload +"./../../../../srcgen/xats/SATS/t3xread.sats" +// +#staload +"./../../../../srcgen/xats/SATS/trans3t.sats" +// +#staload +"./../../../../srcgen/xats/SATS/intrep0.sats" +// +(* ****** ****** *) +// +#staload S2E = +"./../../../../srcgen/xats/SATS/staexp2.sats" +#staload D2E = +"./../../../../srcgen/xats/SATS/dynexp2.sats" +// +(* ****** ****** *) +// +#staload IR0 = +"./../../../../srcgen/xats/SATS/intrep0.sats" +// +(* ****** ****** *) +// +(* +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/json.dats" +*) +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/staexp0_print.dats" +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/dynexp0_print.dats" +// +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/staexp1_print.dats" +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/dynexp1_print.dats" +// +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/staexp2_print.dats" +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/statyp2_print.dats" +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/dynexp2_print.dats" +// +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/dynexp3_print.dats" +// +(* ****** ****** *) +// +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/intrep0_print.dats" +// +(* ****** ****** *) +// +#staload +_(*TMP*) = +"./../../../../srcgen/xats/DATS/trans12_envmap.dats" +// +(* ****** ****** *) + +(* end of [libxatsopt.hats] *) diff --git a/contrib/sparverius/xjsonize/Makefile b/contrib/sparverius/xjsonize/Makefile new file mode 100644 index 000000000..9f51562de --- /dev/null +++ b/contrib/sparverius/xjsonize/Makefile @@ -0,0 +1,157 @@ +###### +# +# For building xjsonize +# +###### + +CC=gcc +SED=sed +RMF=rm -f + +###### + +PATSCC=$(PATSHOME)/bin/patscc +PATSOPT=$(PATSHOME)/bin/patsopt + +###### +# +CFLAGS= +# +# CFLAGS=-g +# CFLAGS=-g -O +# CFLAGS=-g -O2 +# +GCFLAG= +GCFLAG=-DATS_MEMALLOC_LIBC +GCFLAG=-DATS_MEMALLOC_GCBDW +# +LIBGC= +LIBGC=-lgc +# +###### + +SRCSATS := \ +json.sats \ +basics.sats \ +stamp0.sats \ +symbol.sats \ +label0.sats \ +locinfo.sats \ +lexing.sats \ +dynexp0.sats \ +staexp0.sats \ +dynexp1.sats \ +staexp1.sats \ +statyp2.sats \ +staexp2.sats \ +dynexp2.sats \ +dynexp3.sats \ +fixity.sats \ +intrep0.sats \ +interp0.sats \ + +SRCDATS := \ +json.dats \ +basics.dats \ +stamp0.dats \ +symbol.dats \ +label0.dats \ +locinfo.dats \ +lexing_token.dats \ +staexp0.dats \ +dynexp0.dats \ +staexp1.dats \ +dynexp1.dats \ +statyp2.dats \ +staexp2.dats \ +dynexp2.dats \ +dynexp3.dats \ +intrep0.dats \ +interp0.dats \ + +# SRCSATS := \ +# interp0.sats +# SRCDATS := \ +# interp0.dats \ +# interp0_print.dats \ +# interp0_envmap.dats \ +# interp0_dynexp.dats \ + +###### + +OBJSATS := \ +$(patsubst %.sats, BUILD/%_sats.o, $(SRCSATS)) +OBJDATS := \ +$(patsubst %.dats, BUILD/%_dats.o, $(SRCDATS)) + +###### + +INCLUDE:= +INCLUDE+=-I"." +INCLUDE+=-I"./BUILD/xats" +LIBRARY:=-L./../../../lib/ -lxatsopt + +###### +# +all: \ +xjsonize +xjsonize: \ +DATS/xjsonize.dats \ +$(OBJSATS) $(OBJDATS) ; \ +$(PATSCC) -cleanaft -o xjsonize \ +$(INCLUDE) $(CFLAGS) $(GCFLAG) $^ $(LIBGC) $(LIBRARY) +# +###### + +BUILD/%_sats.c: \ +./SATS/%.sats ; $(PATSOPT) -o $@ --static $< +BUILD/%_dats.c: \ +./DATS/%.dats ; $(PATSOPT) -o $@ --dynamic $< + +###### + +BUILD/%_sats.o: \ +BUILD/%_sats.c; \ +$(PATSCC) $(INCLUDE) $(CFLAGS) -o $@ -c $< +BUILD/%_dats.o: \ +BUILD/%_dats.c; \ +$(PATSCC) $(INCLUDE) $(CFLAGS) $(GCFLAG) -o $@ -c $< + +###### +# +# HX-2018-10-07: +# '--output-a .depend' means +# appending instead of overwriting +# +SATS_SRCSATS := \ +$(patsubst %.sats, SATS/%.sats, $(SRCSATS)) +DATS_SRCDATS := \ +$(patsubst %.dats, DATS/%.dats, $(SRCDATS)) +# +depend:: ; $(RMF) .depend +# +depend:: ; \ +$(PATSOPT) --output-a .depend --depgen -s $(SATS_SRCSATS) +depend:: ; \ +$(PATSOPT) --output-a .depend --depgen -d $(DATS_SRCDATS) +depend:: ; \ +$(PATSOPT) --output-a .depend --depgen -d DATS/xjsonize.dats +# +depend:: ; \ +$(SED) -i -e 's/^SATS/BUILD/' -e 's/^DATS/BUILD/' .depend +# +-include .depend +# +###### + +clean:: ; $(RMF) BUILD/*_?ats.c +clean:: ; $(RMF) BUILD/*_?ats.o +clean:: ; $(RMF) xjsonize_dats.o +clean:: ; $(RMF) xjsonize_dats.c + +cleanall:: clean +cleanall:: ; $(RMF) xjsonize + +###### + +###### end of [Makefile] ###### diff --git a/contrib/sparverius/xjsonize/SATS/basics.sats b/contrib/sparverius/xjsonize/SATS/basics.sats new file mode 100644 index 000000000..cfe45d628 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/basics.sats @@ -0,0 +1,24 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload BAS = "{$XATS}/SATS/basics.sats" + +#staload "./json.sats" + +fun +jsonize_dctkind : jsonize_type($BAS.dctkind) +overload jsonize with jsonize_dctkind + +fun +jsonize_valkind : jsonize_type($BAS.valkind) +overload jsonize with jsonize_valkind + +fun +jsonize_funkind : jsonize_type($BAS.funkind) +overload jsonize with jsonize_funkind + +fun +jsonize_impkind : jsonize_type($BAS.impkind) +overload jsonize with jsonize_impkind + +fun +jsonize_funclo2: jsonize_type($BAS.funclo2) +overload jsonize with jsonize_funclo2 diff --git a/contrib/sparverius/xjsonize/SATS/dynexp0.sats b/contrib/sparverius/xjsonize/SATS/dynexp0.sats new file mode 100644 index 000000000..0e29ce41e --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/dynexp0.sats @@ -0,0 +1,147 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/dynexp0.sats" + +#staload "./json.sats" + +(* +fun{a:type} +jsonize_dl0abeled : jsonize_type(dl0abled(a)) +*) + +fun +jsonize_decmodopt: jsonize_type(decmodopt) +overload jsonize with jsonize_decmodopt + +(* +fun +jsonize_q0arg : jsonize_type(q0arg) +overload jsonize with jsonize_q0arg + +fun +jsonize_sq0arg : jsonize_type(sq0arg) +overload jsonize with jsonize_sq0arg + +fun +jsonize_tq0arg : jsonize_type(tq0arg) +overload jsonize with jsonize_tq0arg + +fun +jsonize_ti0arg : jsonize_type(ti0arg) +overload jsonize with jsonize_ti0arg + +fun +jsonize_a0typ : jsonize_type(a0typ) +overload jsonize with jsonize_a0typ + +fun +jsonize_d0arg : jsonize_type(d0arg) +overload jsonize with jsonize_d0arg + +fun +jsonize_f0arg : jsonize_type(f0arg) +overload jsonize with jsonize_f0arg + +fun +jsonize_d0pat : jsonize_type(d0pat) +overload jsonize with jsonize_d0pat + +fun +jsonize_d0pat_RPAREN : jsonize_type(d0pat_RPAREN) +overload jsonize with jsonize_d0pat_RPAREN + +fun +jsonize_labd0pat_RBRACE : jsonize_type(labd0pat_RBRACE) +overload jsonize with jsonize_labd0pat_RBRACE + +fun +jsonize_d0exp : jsonize_type(d0exp) +overload jsonize with jsonize_d0exp + +fun +jsonize_d0exp_RPAREN : jsonize_type(d0exp_RPAREN) +overload jsonize with jsonize_d0exp_RPAREN + +fun +jsonize_labd0exp_RBRACE : jsonize_type(labd0exp_RBRACE) +overload jsonize with jsonize_labd0exp_RBRACE + +fun +jsonize_d0exp_THEN : jsonize_type(d0exp_THEN) +overload jsonize with jsonize_d0exp_THEN + +fun +jsonize_d0exp_ELSE : jsonize_type(d0exp_ELSE) +overload jsonize with jsonize_d0exp_ELSE + +fun +jsonize_endwhere : jsonize_type(endwhere) +overload jsonize with jsonize_endwhere + +fun +jsonize_d0eclseq_WHERE : jsonize_type(d0eclseq_WHERE) +overload jsonize with jsonize_d0eclseq_WHERE + +fun +jsonize_f0unarrow : jsonize_type(f0unarrow) +overload jsonize with jsonize_f0unarrow + +fun +jsonize_d0gua : jsonize_type(d0gua) +overload jsonize with jsonize_d0gua + +fun +jsonize_decmodopt : jsonize_type(decmodopt) +overload jsonize with jsonize_decmodopt + +fun +jsonize_teqd0expopt : jsonize_type(teqd0expopt) +overload jsonize with jsonize_teqd0expopt + +fun +jsonize_wths0expopt : jsonize_type(wths0expopt) +overload jsonize with jsonize_wths0expopt + +fun +jsonize_v0aldecl : jsonize_type(v0aldecl) +overload jsonize with jsonize_v0aldecl + +fun +jsonize_v0ardecl : jsonize_type(v0ardecl) +overload jsonize with jsonize_v0ardecl + +fun +jsonize_f0undecl : jsonize_type(f0undecl) +overload jsonize with jsonize_f0undecl + +fun +jsonize_d0cstdecl : jsonize_type(d0cstdecl) +overload jsonize with jsonize_d0cstdecl + +fun +jsonize_d0ecl : jsonize_type(d0ecl) +overload jsonize with jsonize_d0ecl + +fun +jsonize_precopt : jsonize_type(precopt) +overload jsonize with jsonize_precopt + +fun +jsonize_precmod : jsonize_type(precmod) +overload jsonize with jsonize_precmod + +fun +jsonize_signint : jsonize_type(signint) +overload jsonize with jsonize_signint + +fun +jsonize_g0expdef : jsonize_type(g0expdef) +overload jsonize with jsonize_g0expdef + +fun +jsonize_d0macdef : jsonize_type(d0macdef) +overload jsonize with jsonize_d0macdef + +fun +jsonize_wd0eclseq : jsonize_type(wd0eclseq) +overload jsonize with jsonize_wd0eclseq +*) diff --git a/contrib/sparverius/xjsonize/SATS/dynexp1.sats b/contrib/sparverius/xjsonize/SATS/dynexp1.sats new file mode 100644 index 000000000..8325908e1 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/dynexp1.sats @@ -0,0 +1,92 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/dynexp1.sats" + +#staload "./json.sats" + +fun +jsonize_q1arg : jsonize_type(q1arg) +overload jsonize with jsonize_q1arg + +fun +jsonize_sq1arg : jsonize_type(sq1arg) +overload jsonize with jsonize_sq1arg + +fun +jsonize_tq1arg : jsonize_type(tq1arg) +overload jsonize with jsonize_tq1arg + +fun +jsonize_ti1arg : jsonize_type(ti1arg) +overload jsonize with jsonize_ti1arg + +fun +jsonize_a1typ : jsonize_type(a1typ) +overload jsonize with jsonize_a1typ + +fun +jsonize_d1arg : jsonize_type(d1arg) +overload jsonize with jsonize_d1arg + +fun +jsonize_f1arg : jsonize_type(f1arg) +overload jsonize with jsonize_f1arg + +fun +jsonize_d1pat : jsonize_type(d1pat) +overload jsonize with jsonize_d1pat + +fun +jsonize_d1gua : jsonize_type(d1gua) +overload jsonize with jsonize_d1gua + +fun +jsonize_d1clau : jsonize_type(d1clau) +overload jsonize with jsonize_d1clau + +fun +jsonize_d1gpat : jsonize_type(d1gpat) +overload jsonize with jsonize_d1gpat + +fun +jsonize_d1exp : jsonize_type(d1exp) +overload jsonize with jsonize_d1exp + +fun +jsonize_f1unarrow : jsonize_type(f1unarrow) +overload jsonize with jsonize_f1unarrow + +fun +jsonize_teqd1expopt : jsonize_type(teqd1expopt) +overload jsonize with jsonize_teqd1expopt + +fun +jsonize_wths1expopt : jsonize_type(wths1expopt) +overload jsonize with jsonize_wths1expopt + +fun +jsonize_v1aldecl : jsonize_type(v1aldecl) +overload jsonize with jsonize_v1aldecl + +fun +jsonize_v1ardecl : jsonize_type(v1ardecl) +overload jsonize with jsonize_v1ardecl + +fun +jsonize_f1undecl : jsonize_type(f1undecl) +overload jsonize with jsonize_f1undecl + +fun +jsonize_d1cstdecl : jsonize_type(d1cstdecl) +overload jsonize with jsonize_d1cstdecl + +fun +jsonize_d1ecl : jsonize_type(d1ecl) +overload jsonize with jsonize_d1ecl + +fun +jsonize_abstdf1 : jsonize_type(abstdf1) +overload jsonize with jsonize_abstdf1 + +fun +jsonize_wd1eclseq : jsonize_type(wd1eclseq) +overload jsonize with jsonize_wd1eclseq diff --git a/contrib/sparverius/xjsonize/SATS/dynexp2.sats b/contrib/sparverius/xjsonize/SATS/dynexp2.sats new file mode 100644 index 000000000..c360a6b87 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/dynexp2.sats @@ -0,0 +1,81 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/dynexp2.sats" + +#staload "./json.sats" + + +fun +jsonize_sq2arg : jsonize_type(sq2arg) +overload jsonize with jsonize_sq2arg + +fun +jsonize_tq2arg : jsonize_type(tq2arg) +overload jsonize with jsonize_tq2arg + +fun +jsonize_d2con : jsonize_type(d2con) +overload jsonize with jsonize_d2con + +fun +jsonize_d2cst : jsonize_type(d2cst) +overload jsonize with jsonize_d2cst + +fun +jsonize_d2var : jsonize_type(d2var) +overload jsonize with jsonize_d2var + +fun +jsonize_d2itm : jsonize_type(d2itm) +overload jsonize with jsonize_d2itm + +fun +jsonize_d2pat : jsonize_type(d2pat) +overload jsonize with jsonize_d2pat + +fun +jsonize_f2arg : jsonize_type(f2arg) +overload jsonize with jsonize_f2arg + +fun +jsonize_ti2arg : jsonize_type(ti2arg) +overload jsonize with jsonize_ti2arg + +fun +jsonize_d2gua : jsonize_type(d2gua) +overload jsonize with jsonize_d2gua + +fun +jsonize_d2clau : jsonize_type(d2clau) +overload jsonize with jsonize_d2clau + +fun +jsonize_d2gpat : jsonize_type(d2gpat) +overload jsonize with jsonize_d2gpat + +fun +jsonize_d2exp : jsonize_type(d2exp) +overload jsonize with jsonize_d2exp + +fun +jsonize_v2aldecl : jsonize_type(v2aldecl) +overload jsonize with jsonize_v2aldecl + +fun +jsonize_v2ardecl : jsonize_type(v2ardecl) +overload jsonize with jsonize_v2ardecl + +fun +jsonize_f2undecl : jsonize_type(f2undecl) +overload jsonize with jsonize_f2undecl + +fun +jsonize_d2ecl : jsonize_type(d2ecl) +overload jsonize with jsonize_d2ecl + +fun +jsonize_impls2cst : jsonize_type(impls2cst) +overload jsonize with jsonize_impls2cst + +fun +jsonize_impld2cst : jsonize_type(impld2cst) +overload jsonize with jsonize_impld2cst diff --git a/contrib/sparverius/xjsonize/SATS/dynexp3.sats b/contrib/sparverius/xjsonize/SATS/dynexp3.sats new file mode 100644 index 000000000..64812543c --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/dynexp3.sats @@ -0,0 +1,50 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/dynexp3.sats" + +#staload "./json.sats" + +fun +jsonize_ti3arg : jsonize_type(ti3arg) +overload jsonize with jsonize_ti3arg + +(* +fun +jsonize_f3arg : jsonize_type(f3arg) +overload jsonize with jsonize_f3arg + +fun +jsonize_d3gua : jsonize_type(d3gua) +overload jsonize with jsonize_d3gua + +fun +jsonize_d3clau : jsonize_type(d3clau) +overload jsonize with jsonize_d3clau + +fun +jsonize_d3gpat : jsonize_type(d3gpat) +overload jsonize with jsonize_d3gpat + +fun +jsonize_d3exp : jsonize_type(d3exp) +overload jsonize with jsonize_d3exp + +fun +jsonize_t2pcast : jsonize_type(t2pcast) +overload jsonize with jsonize_t2pcast + +fun +jsonize_v3aldecl : jsonize_type(v3aldecl) +overload jsonize with jsonize_v3aldecl + +fun +jsonize_v3ardecl : jsonize_type(v3ardecl) +overload jsonize with jsonize_v3ardecl + +fun +jsonize_f3undecl : jsonize_type(f3undecl) +overload jsonize with jsonize_f3undecl + +fun +jsonize_d3ecl : jsonize_type(d3ecl) +overload jsonize with jsonize_d3ecl +*) diff --git a/contrib/sparverius/xjsonize/SATS/fixity.sats b/contrib/sparverius/xjsonize/SATS/fixity.sats new file mode 100644 index 000000000..526c5dc72 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/fixity.sats @@ -0,0 +1,16 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/fixity.sats" + +#staload "./json.sats" + +fun +jsonize_assoc: jsonize_type(assoc) +overload jsonize with jsonize_assoc + +fun +jsonize_prcdv: jsonize_type(prcdv) +overload jsonize with jsonize_prcdv + +fun +jsonize_fixty: jsonize_type(fixty) +overload jsonize with jsonize_fixty diff --git a/contrib/sparverius/xjsonize/SATS/interp0.sats b/contrib/sparverius/xjsonize/SATS/interp0.sats new file mode 100644 index 000000000..64b471b37 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/interp0.sats @@ -0,0 +1,361 @@ +(***********************************************************************) +(* *) +(* Applied Type System *) +(* *) +(***********************************************************************) + +(* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*) + +(* ****** ****** *) +// +// Author: Hongwei Xi +// Start Time: November, 2019 +// Authoremail: gmhwxiATgmailDOTcom +// +(* ****** ****** *) +// +// HX-2019-11-02: level-1 interpreter +// +(* ****** ****** *) + +#define XATS_targetloc "./../../../../srcgen/xats" + +(* ****** ****** *) + +#staload +D2E = "{$XATS}/SATS/dynexp2.sats" + +(* ****** ****** *) + +typedef d2var = $D2E.d2var +typedef d2con = $D2E.d2con +typedef d2cst = $D2E.d2cst + +(* ****** ****** *) + +#staload +INT = "{$XATS}/SATS/intrep0.sats" + +(* ****** ****** *) + +typedef ir0pat = $INT.ir0pat +typedef ir0arg = $INT.ir0arg +typedef ir0exp = $INT.ir0exp +typedef ir0dcl = $INT.ir0dcl + +typedef ir0gua = $INT.ir0gua +typedef ir0gpat = $INT.ir0gpat +typedef ir0clau = $INT.ir0clau + +typedef ir0patlst = $INT.ir0patlst +typedef ir0arglst = $INT.ir0arglst +typedef ir0explst = $INT.ir0explst +typedef ir0expopt = $INT.ir0expopt +typedef ir0dclist = $INT.ir0dclist + +typedef ir0gualst = $INT.ir0gualst +typedef ir0claulst = $INT.ir0claulst + +typedef ir0valdecl = $INT.ir0valdecl +typedef ir0fundecl = $INT.ir0fundecl +typedef ir0valdeclist = $INT.ir0valdeclist +typedef ir0fundeclist = $INT.ir0fundeclist + +(* ****** ****** *) + +(* +abstype ir0env_tbox = ptr +typedef ir0env = ir0env_tbox + +fun jsonize_ir0env: jsonize_type(ir0env) +overload jsonize with jsonize_ir0env + +(* ****** ****** *) +// +datatype +ir0val = +// +| IR0Vnil of () +// +| IR0Vint of int +| IR0Vbtf of bool +| IR0Vchr of char +| IR0Vflt of double +| IR0Vstr of string +// +(* +| IR0Vvar of d2var +| IR0Vcon of d2con +| IR0Vcst of d2cst +*) +// +| IR0Vcon of + (d2con, ir0valist) +// +| IR0Vfun of ir0valfun +// +| IR0Vtuple of + (int(*knd*), ir0valist) +// +| IR0Vlam of + (ir0env, ir0arglst, ir0exp) +| IR0Vfix of + (ir0env, d2var, ir0arglst, ir0exp) +(* +| IR0Vfix2 of + (ir0env, d2var, ir0arglst, ir0exp, ir0exp) +*) +| IR0Vfixs of + (ir0env, d2var, ir0arglst, ir0exp, ir0explst) +// +| IR0Vnone0 of () | IR0Vnone1 of (ir0exp) +// +where +// +ir0valist = List0(ir0val) +and +ir0valopt = Option(ir0val) +and +ir0valfun = (ir0valist - ir0val) +// +(* ****** ****** *) +// +fun +print_ir0val: print_type(ir0val) +fun +prerr_ir0val: prerr_type(ir0val) +overload print with print_ir0val +overload prerr with prerr_ir0val +// +fun +fprint_ir0val: fprint_type(ir0val) +overload fprint with fprint_ir0val +// +fun +jsonize_ir0val: jsonize_type(ir0val) +overload jsonize with jsonize_ir0val +// +(* ****** ****** *) + +absvtype intpenv_vtbox = ptr +vtypedef intpenv = intpenv_vtbox + +(* ****** ****** *) +// +fun +ir0env_make_nil(): ir0env +// +fun +intpenv_make_nil(): intpenv +fun +intpenv_make_fun(ir0env): intpenv +// +(* ****** ****** *) +// +fun +intpenv_take_env(!intpenv): ir0env +// +(* ****** ****** *) +// +fun +intpenv_bind_fix(!intpenv, ir0val): void +fun +intpenv_bind_fixs(!intpenv, ir0val): void +// +(* ****** ****** *) +// +fun +intpenv_pop0_let1(!intpenv): void +fun +intpenv_push_let1(!intpenv): void +// +(* ****** ****** *) +// +fun +intpenv_free_nil(env: intpenv): void +fun +intpenv_free_fun(env: intpenv): void +// +(* ****** ****** *) + +fun +interp0_search_d2cst +(d2c: d2cst): Option_vt(ir0val) +fun +interp0_search_d2var +( env +: !intpenv +, d2v: d2var): Option_vt(ir0val) + +(* ****** ****** *) +// +fun +interp0_insert_d2cst +(d2c: d2cst, irv: ir0val): void +// +fun +interp0_insert_d2var +( env +: !intpenv +, d2v: d2var, irv: ir0val): void +// +(* ****** ****** *) +// +fun +interp0_irdcl +(env: !intpenv, irc: ir0dcl): void +fun +interp0_irdclist +(env: !intpenv, ircs: ir0dclist): void +// +fun +interp0_irexp +(env: !intpenv, ire: ir0exp): ir0val +fun +interp0_irexplst +(env: !intpenv, ires: ir0explst): ir0valist +fun +interp0_irexpopt +(env: !intpenv, opt0: ir0expopt): ir0valopt +// +(* ****** ****** *) +// +fun +interp0_fcall_lam +(irf0: ir0val, irvs: ir0valist): ir0val +fun +interp0_fcall_fix +(irf0: ir0val, irvs: ir0valist): ir0val +fun +interp0_fcall_fixs +(irf0: ir0val, irvs: ir0valist): ir0val +// +(* ****** ****** *) +// +fun +interp0_irpat_ck0 +(irp0: ir0pat, irv0: ir0val): bool +fun +interp0_irpatlst_ck0 +(irps: ir0patlst, irvs: ir0valist): bool +// +fun +interp0_irpat_ck1 +( env +: !intpenv +, irp0: ir0pat, irv0: ir0val): void +fun +interp0_irpatlst_ck1 +( env +: !intpenv +, irps: ir0patlst, irvs: ir0valist): void +// +(* ****** ****** *) +// +fun +interp0_irgpat_ck2 +( env +: !intpenv +, irgp: ir0gpat, irv0: ir0val): bool +// +fun +interp0_irgua_ck2 +(env: !intpenv, irg0: ir0gua): bool +fun +interp0_irgualst_ck2 +(env: !intpenv, irgs: ir0gualst): bool +// +(* ****** ****** *) +// +fun +interp0_irclau +( env +: !intpenv +, irv0: ir0val +, ircl: ir0clau): Option_vt(ir0val) +fun +interp0_irclaulst +( env +: !intpenv +, irv0: ir0val +, ircls: ir0claulst): Option_vt(ir0val) +// +(* ****** ****** *) + +fun +interp0_ir0valdecl +(env: !intpenv, irvd: ir0valdecl): void +fun +interp0_ir0valdeclist +(env: !intpenv, irvds: ir0valdeclist): void + +(* ****** ****** *) + +fun +interp0_ir0fundecl +(env: !intpenv, irfd: ir0fundecl): void +fun +interp0_ir0fundeclist +(env: !intpenv, irfds: ir0fundeclist): void + +(* ****** ****** *) +// +fun +interp0_ir0impdecl3 +(env: !intpenv, irdcl: ir0dcl(*impdecl3*)): void +// +(* ****** ****** *) + +// +fun +interp0_initize(): void +// +fun +interp0_initize_gint(): void +// +(* ****** ****** *) + +fun +interp0_program(xs: ir0dclist): void + +(* ****** ****** *) +// +fun +interp0_fprint_d2cstmap(FILEref): void +fun +interp0_fprint_d2varmap(FILEref): void +// +fun +interp0_jsonize_d2cstmap(): jsonval +fun +interp0_jsonize_d2varmap(): jsonval +*) +// +(* ****** ****** *) +// +fun +interp0_main0 +{n:int | n >= 1}(int(n), !argv(n)): void +// +(* ****** ****** *) + +(* end of [xint_interp0.sats] *) diff --git a/contrib/sparverius/xjsonize/SATS/intrep0.sats b/contrib/sparverius/xjsonize/SATS/intrep0.sats new file mode 100644 index 000000000..fc41fcabc --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/intrep0.sats @@ -0,0 +1,40 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/intrep0.sats" + +#staload "./json.sats" + +fun +jsonize_ir0pat : jsonize_type(ir0pat) +overload jsonize with jsonize_ir0pat + +fun +jsonize_ir0arg : jsonize_type(ir0arg) +overload jsonize with jsonize_ir0arg + +fun +jsonize_ir0exp : jsonize_type(ir0exp) +overload jsonize with jsonize_ir0exp + +fun +jsonize_ir0gua : jsonize_type(ir0gua) +overload jsonize with jsonize_ir0gua + +fun +jsonize_ir0clau : jsonize_type(ir0clau) +overload jsonize with jsonize_ir0clau + +fun +jsonize_ir0gpat : jsonize_type(ir0gpat) +overload jsonize with jsonize_ir0gpat + +fun +jsonize_ir0valdecl : jsonize_type(ir0valdecl) +overload jsonize with jsonize_ir0valdecl + +fun +jsonize_ir0fundecl : jsonize_type(ir0fundecl) +overload jsonize with jsonize_ir0fundecl + +fun +jsonize_ir0dcl : jsonize_type(ir0dcl) +overload jsonize with jsonize_ir0dcl diff --git a/contrib/sparverius/xjsonize/SATS/json.sats b/contrib/sparverius/xjsonize/SATS/json.sats new file mode 100644 index 000000000..b6ad5a95b --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/json.sats @@ -0,0 +1,293 @@ +datatype +jsonval = +// + | JSONnul of () + | JSONint of (int) + | JSONbool of (bool) + | JSONfloat of (double) + | JSONstring of (string) +// + | JSONlist of (jsonvalist) + | JSONlablist of labjsonvalist + | JSONoption of (jsonvalopt) +// + (* | JSONintinf of (intinf) *) +// +// end of [jsonval] +where +jsonvalist = List (jsonval) +and +labjsonval = @(string, jsonval) +and +labjsonvalist = List0 (labjsonval) +and +jsonvalopt = Option (jsonval) + +typedef jsonize_type(a:t@ype) = a -> jsonval +typedef labify_type(a:t@ype) = a -> (string, jsonval) + +(* ****** ****** *) +// +fun jsonval_int (x: int): jsonval +(* fun jsonval_intinf (x: intinf): jsonval *) +// +fun jsonval_bool (x: bool): jsonval +fun jsonval_double (x: double): jsonval +fun jsonval_string (x: string): jsonval +// +(* ****** ****** *) +// +fun jsonval_nil (): jsonval +fun jsonval_sing (x: jsonval): jsonval +fun jsonval_pair (x1: jsonval, x2: jsonval): jsonval +// +(* ****** ****** *) +// +fun jsonval_labval1 + (l1: string, x1: jsonval): jsonval +// +fun jsonval_labval2 +( + l1: string, x1: jsonval +, l2: string, x2: jsonval +) : jsonval // end of [jsonval_labval2] +// +fun +jsonval_labval3 +( + l1: string, x1: jsonval +, l2: string, x2: jsonval +, l3: string, x3: jsonval +) : jsonval // end of [jsonval_labval3] +// +fun +jsonval_labval4 +( + l1: string, x1: jsonval +, l2: string, x2: jsonval +, l3: string, x3: jsonval +, l4: string, x4: jsonval +) : jsonval // end of [jsonval_labval4] +// +fun +jsonval_labval5 +( + l1: string, x1: jsonval +, l2: string, x2: jsonval +, l3: string, x3: jsonval +, l4: string, x4: jsonval +, l5: string, x5: jsonval +) : jsonval // end of [jsonval_labval5] +// +fun +jsonval_labval6 +( + l1: string, x1: jsonval +, l2: string, x2: jsonval +, l3: string, x3: jsonval +, l4: string, x4: jsonval +, l5: string, x5: jsonval +, l6: string, x6: jsonval +) : jsonval // end of [jsonval_labval6] +// +fun +jsonval_labval7 +( + l1: string, x1: jsonval +, l2: string, x2: jsonval +, l3: string, x3: jsonval +, l4: string, x4: jsonval +, l5: string, x5: jsonval +, l6: string, x6: jsonval +, l7: string, x7: jsonval +) : jsonval // end of [jsonval_labval7] +// +fun +jsonval_labval8 +( + l1: string, x1: jsonval +, l2: string, x2: jsonval +, l3: string, x3: jsonval +, l4: string, x4: jsonval +, l5: string, x5: jsonval +, l6: string, x6: jsonval +, l7: string, x7: jsonval +, l8: string, x8: jsonval +) : jsonval // end of [jsonval_labval8] +// +(* ****** ****** *) +// +fun +jsonval_conarglst + (con: string, arglst: jsonvalist): jsonval +// +(* ****** ****** *) +// +fun +jsonval_conarg0 (con: string): jsonval +fun +jsonval_conarg1 (con: string, arg: jsonval): jsonval +fun +jsonval_conarg2 + (con: string, arg1: jsonval, arg2: jsonval): jsonval +// +fun +jsonval_conarg3 +( + con: string, arg1: jsonval, arg2: jsonval, arg3: jsonval +) : jsonval // end of [jsonval_conarg3] +fun +jsonval_conarg4 +( + con: string +, arg1: jsonval, arg2: jsonval, arg3: jsonval, arg4: jsonval +) : jsonval // end of [jsonval_conarg4] +// +(* ****** ****** *) +// +fun jsonval_none (): jsonval +fun jsonval_some (x: jsonval): jsonval +// +(* ****** ****** *) +// +fun fprint_jsonval + (out: FILEref, x: jsonval): void +fun fprint_jsonvalist + (out: FILEref, xs: jsonvalist): void +fun fprint_labjsonvalist + (out: FILEref, lxs: labjsonvalist): void +// +overload fprint with fprint_jsonval +overload fprint with fprint_jsonvalist +overload fprint with fprint_labjsonvalist +// +(* +fun print_jsonval(x: jsonval): void +fun print_jsonvalist(xs: jsonvalist): void +fun print_labjsonvalist(lxs: labjsonvalist): void +*) +// +(* ****** ****** *) + +typedef +jsonize_ftype (a:t@ype) = (a) -> jsonval +typedef +labify_ftype (a:t@ype) = (a) -> @() + +(* ****** ****** *) + +fun jsonize_ignored{a:type} (x: a): jsonval + +(* ****** ****** *) +// +fun{a:t@ype} +jsonize_list_fun + (* (xs: List0 (a), f: jsonize_ftype (a)): jsonval *) + (xs: List (a), f: jsonize_ftype (a)): jsonval +// end of [jsonize_list_fun] +// +fun{a:t@ype} +jsonize_option_fun + (xs: Option (a), f: jsonize_ftype (a)): jsonval + +(* ****** ****** *) + +symintr jsonize +symintr labify +(* symintr jsonize_list *) + +fun{a:t@ype} jsonize_val: (a) -> jsonval + +fun{a:t@ype} jsonize_list: (List(a)) -> jsonval + +fun jsonize_int(x:int): jsonval + +fun jsonize_char(x:char): jsonval + +fun jsonize_string(x:string): jsonval + +fun jsonize_bool(x:bool): jsonval + +fun jsonize_double(x:double): jsonval + +(* fun jsonize_float(x:float): jsonval = JSONstring(tostring_val(x)) *) + +overload jsonize with jsonize_int + +overload jsonize with jsonize_char + +overload jsonize with jsonize_string + +overload jsonize with jsonize_bool + +overload jsonize with jsonize_double + +(* overload jsonize with jsonize_float *) + +fun lab(x:string, rst:jsonval): jsonval + +fun jnul(): jsonval + +fun jint(x:int): jsonval + +fun jbool(x:bool): jsonval + +fun jfloat(x:double): jsonval + +fun jstr(x:string): jsonval + +fun listj(x: jsonval): jsonval + +fun listj2(x: jsonval, y: jsonval): jsonval + + +fun labval2(x: jsonval, y: jsonval): jsonval + + +fun fprintf {ts:types} ( + out: FILEref, + fmt: string, + args: ts +): void = "mac#fprintf" + + +typedef str_arg2 = (string, string) +typedef str_arg3 = (string, string, string) +typedef str_arg4 = (string, string, string, string) +typedef str_arg5 = (string, string, string, string, string) +typedef str_arg6 = (string, string, string, string, string, string) +typedef str_arg7 = (string, string, string, string, string, string, string) +typedef str_arg8 = (string, string, string, string, string, string, string, string) +typedef str_arg9 = (string, string, string, string, string, string, string, string, string) + +typedef json_arg2 = (jsonval, jsonval) +typedef json_arg3 = (jsonval, jsonval, jsonval) +typedef json_arg4 = (jsonval, jsonval, jsonval, jsonval) +typedef json_arg5 = (jsonval, jsonval, jsonval, jsonval, jsonval) +typedef json_arg6 = (jsonval, jsonval, jsonval, jsonval, jsonval, jsonval) +typedef json_arg7 = (jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval) +typedef json_arg8 = (jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval) +typedef json_arg9 = (jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval) + +fun jsonify0 (guard_name: string): jsonval +fun jsonify1 (guard_name: string, arg_name: string, arg_json: jsonval): jsonval +fun jsonify2 (guard_name: string, arg_names: str_arg2, arg_json: json_arg2): jsonval +fun jsonify3 (guard_name: string, arg_names: str_arg3, arg_json: json_arg3): jsonval +fun jsonify4 (guard_name: string, arg_names: str_arg4, arg_json: json_arg4): jsonval +fun jsonify5 (guard_name: string, arg_names: str_arg5, arg_json: json_arg5): jsonval +fun jsonify6 (guard_name: string, arg_names: str_arg6, arg_json: json_arg6): jsonval +fun jsonify7 (guard_name: string, arg_names: str_arg7, arg_json: json_arg7): jsonval +fun jsonify8 (guard_name: string, arg_names: str_arg8, arg_json: json_arg8): jsonval +fun jsonify9 (guard_name: string, arg_names: str_arg9, arg_json: json_arg9): jsonval + +overload jsonify with jsonify0 +overload jsonify with jsonify1 +overload jsonify with jsonify2 +overload jsonify with jsonify3 +overload jsonify with jsonify4 +overload jsonify with jsonify5 +overload jsonify with jsonify6 +overload jsonify with jsonify7 +overload jsonify with jsonify8 +overload jsonify with jsonify9 +(* fun jsonify(guard_name: string, List(@(string, json))): jsonval *) diff --git a/contrib/sparverius/xjsonize/SATS/label0.sats b/contrib/sparverius/xjsonize/SATS/label0.sats new file mode 100644 index 000000000..ba5ed14c2 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/label0.sats @@ -0,0 +1,8 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/label0.sats" + +#staload "./json.sats" + +fun +jsonize_label : jsonize_type(label) +overload jsonize with jsonize_label diff --git a/contrib/sparverius/xjsonize/SATS/lexing.sats b/contrib/sparverius/xjsonize/SATS/lexing.sats new file mode 100644 index 000000000..895930e28 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/lexing.sats @@ -0,0 +1,12 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/lexing.sats" + +#staload "./json.sats" + +fun +jsonize_tnode : jsonize_type(tnode) +overload jsonize with jsonize_tnode + +fun +jsonize_token : jsonize_type(token) +overload jsonize with jsonize_token diff --git a/contrib/sparverius/xjsonize/SATS/locinfo.sats b/contrib/sparverius/xjsonize/SATS/locinfo.sats new file mode 100644 index 000000000..e45102ad5 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/locinfo.sats @@ -0,0 +1,8 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/locinfo.sats" + +#staload "./json.sats" + +fun +jsonize_location : jsonize_type(location) +overload jsonize with jsonize_location diff --git a/contrib/sparverius/xjsonize/SATS/staexp0.sats b/contrib/sparverius/xjsonize/SATS/staexp0.sats new file mode 100644 index 000000000..470cbaba7 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/staexp0.sats @@ -0,0 +1,88 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/staexp0.sats" + +#staload "./json.sats" + +fun jsonize_t0int : jsonize_type(t0int) +overload jsonize with jsonize_t0int + +fun jsonize_t0chr : jsonize_type(t0chr) +overload jsonize with jsonize_t0chr + +fun jsonize_t0flt : jsonize_type(t0flt) +overload jsonize with jsonize_t0flt + +fun jsonize_t0str : jsonize_type(t0str) +overload jsonize with jsonize_t0str + +fun jsonize_i0dnt : jsonize_type(i0dnt) +overload jsonize with jsonize_i0dnt + +fun jsonize_l0abl : jsonize_type(l0abl) +overload jsonize with jsonize_l0abl + +fun jsonize_s0ymb : jsonize_type(s0ymb) +overload jsonize with jsonize_s0ymb + +fun{a:type} jsonize_sl0abled : jsonize_type(sl0abled(a)) +overload jsonize with jsonize_sl0abled + +fun jsonize_sq0eid : jsonize_type(sq0eid) +overload jsonize with jsonize_sq0eid + +fun jsonize_dq0eid : jsonize_type(dq0eid) +overload jsonize with jsonize_dq0eid + +fun jsonize_g0exp : jsonize_type(g0exp) +overload jsonize with jsonize_g0exp + +fun jsonize_g0marg : jsonize_type(g0marg) +overload jsonize with jsonize_g0marg + +fun jsonize_sort0 : jsonize_type(sort0) +overload jsonize with jsonize_sort0 + +fun jsonize_s0rtcon : jsonize_type(s0rtcon) +overload jsonize with jsonize_s0rtcon + +fun jsonize_d0tsort : jsonize_type(d0tsort) +overload jsonize with jsonize_d0tsort + +fun jsonize_s0rtdef : jsonize_type(s0rtdef) +overload jsonize with jsonize_s0rtdef + +fun jsonize_s0arg : jsonize_type(s0arg) +overload jsonize with jsonize_s0arg + +fun jsonize_s0marg : jsonize_type(s0marg) +overload jsonize with jsonize_s0marg + +fun jsonize_t0arg : jsonize_type(t0arg) +overload jsonize with jsonize_t0arg + +fun jsonize_t0marg : jsonize_type(t0marg) +overload jsonize with jsonize_t0marg + +fun jsonize_s0qua : jsonize_type(s0qua) +overload jsonize with jsonize_s0qua + +fun jsonize_s0uni : jsonize_type(s0uni) +overload jsonize with jsonize_s0uni + +fun jsonize_s0exp : jsonize_type(s0exp) +overload jsonize with jsonize_s0exp + +fun jsonize_s0exp_RPAREN : jsonize_type(s0exp_RPAREN) +overload jsonize with jsonize_s0exp_RPAREN + +fun jsonize_labs0exp_RBRACE : jsonize_type(labs0exp_RBRACE) +overload jsonize with jsonize_labs0exp_RBRACE + +fun jsonize_effs0expopt : jsonize_type(effs0expopt) +overload jsonize with jsonize_effs0expopt + +fun jsonize_d0atcon : jsonize_type(d0atcon) +overload jsonize with jsonize_d0atcon + +fun jsonize_d0atype : jsonize_type(d0atype) +overload jsonize with jsonize_d0atype diff --git a/contrib/sparverius/xjsonize/SATS/staexp1.sats b/contrib/sparverius/xjsonize/SATS/staexp1.sats new file mode 100644 index 000000000..f396d455c --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/staexp1.sats @@ -0,0 +1,74 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/staexp1.sats" + +#staload "./json.sats" + +(* +fun +jsonize_g1exp : jsonize_type(g1exp) +overload jsonize with jsonize_g1exp + +fun +jsonize_g1marg : jsonize_type(g1marg) +overload jsonize with jsonize_g1marg +*) + +fun +jsonize_sort1 : jsonize_type(sort1) +overload jsonize with jsonize_sort1 + +(* +fun +jsonize_s1rtcon : jsonize_type(s1rtcon) +overload jsonize with jsonize_s1rtcon + +fun +jsonize_d1tsort : jsonize_type(d1tsort) +overload jsonize with jsonize_d1tsort + +fun +jsonize_s1arg : jsonize_type(s1arg) +overload jsonize with jsonize_s1arg + +fun +jsonize_s1rtdef : jsonize_type(s1rtdef) +overload jsonize with jsonize_s1rtdef + +fun +jsonize_s1marg : jsonize_type(s1marg) +overload jsonize with jsonize_s1marg + +fun +jsonize_t1arg : jsonize_type(t1arg) +overload jsonize with jsonize_t1arg + +fun +jsonize_t1marg : jsonize_type(t1marg) +overload jsonize with jsonize_t1marg + +fun +jsonize_s1qua : jsonize_type(s1qua) +overload jsonize with jsonize_s1qua + +fun +jsonize_s1uni : jsonize_type(s1uni) +overload jsonize with jsonize_s1uni +*) + +fun +jsonize_s1exp : jsonize_type(s1exp) +overload jsonize with jsonize_s1exp + +(* +fun +jsonize_effs1expopt : jsonize_type(effs1expopt) +overload jsonize with jsonize_effs1expopt + +fun +jsonize_d1atcon : jsonize_type(d1atcon) +overload jsonize with jsonize_d1atcon + +fun +jsonize_d1atype : jsonize_type(d1atype) +overload jsonize with jsonize_d1atype +*) diff --git a/contrib/sparverius/xjsonize/SATS/staexp2.sats b/contrib/sparverius/xjsonize/SATS/staexp2.sats new file mode 100644 index 000000000..0cd29cc12 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/staexp2.sats @@ -0,0 +1,60 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/staexp2.sats" + +#staload "./json.sats" + +fun +jsonize_sort2: jsonize_type(sort2) +overload jsonize with jsonize_sort2 + +fun +jsonize_t2bas: jsonize_type(t2bas) +overload jsonize with jsonize_t2bas + +fun +jsonize_t2abs: jsonize_type(t2abs) +overload jsonize with jsonize_t2abs + +fun +jsonize_t2dat: jsonize_type(t2dat) +overload jsonize with jsonize_t2dat + +fun +jsonize_s2cst: jsonize_type(s2cst) +overload jsonize with jsonize_s2cst + +fun +jsonize_s2var: jsonize_type(s2var) +overload jsonize with jsonize_s2var + +fun +jsonize_tyrec: jsonize_type(tyrec) +overload jsonize with jsonize_tyrec + +fun +jsonize_s2txt: jsonize_type(s2txt) +overload jsonize with jsonize_s2txt + +fun +jsonize_s2exp: jsonize_type(s2exp) +overload jsonize with jsonize_s2exp + +fun +jsonize_s2hnf: jsonize_type(s2hnf) +overload jsonize with jsonize_s2hnf + +fun +jsonize_labs2exp: jsonize_type(labs2exp) +overload jsonize with jsonize_labs2exp + +fun +jsonize_abstdf2: jsonize_type(abstdf2) +overload jsonize with jsonize_abstdf2 + +fun +jsonize_effs2expopt: jsonize_type(effs2expopt) +overload jsonize with jsonize_effs2expopt + +fun +jsonize_s2itm: jsonize_type(s2itm) +overload jsonize with jsonize_s2itm diff --git a/contrib/sparverius/xjsonize/SATS/stamp0.sats b/contrib/sparverius/xjsonize/SATS/stamp0.sats new file mode 100644 index 000000000..27de65623 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/stamp0.sats @@ -0,0 +1,10 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload STM = "{$XATS}/SATS/stamp0.sats" + +#staload "./json.sats" + +fun jsonize_stamp : jsonize_type($STM.stamp) +overload jsonize with jsonize_stamp + +fun labify_stamp : labify_type($STM.stamp) +overload labify with labify_stamp diff --git a/contrib/sparverius/xjsonize/SATS/statyp2.sats b/contrib/sparverius/xjsonize/SATS/statyp2.sats new file mode 100644 index 000000000..e354d3dae --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/statyp2.sats @@ -0,0 +1,12 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/statyp2.sats" + +#staload "./json.sats" + +fun +jsonize_labt2ype: jsonize_type(labt2ype) +overload jsonize with jsonize_labt2ype + +fun +jsonize_t2ype: jsonize_type(t2ype) +overload jsonize with jsonize_t2ype diff --git a/contrib/sparverius/xjsonize/SATS/symbol.sats b/contrib/sparverius/xjsonize/SATS/symbol.sats new file mode 100644 index 000000000..1bfbf6bad --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/symbol.sats @@ -0,0 +1,12 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/symbol.sats" + +#staload "./json.sats" + +fun +jsonize_symbol : jsonize_type(symbol) +overload jsonize with jsonize_symbol + +fun +labify_symbol : labify_type(symbol) +overload labify with labify_symbol diff --git a/contrib/sparverius/xjsonize/SATS/trans01.sats b/contrib/sparverius/xjsonize/SATS/trans01.sats new file mode 100644 index 000000000..85e1bc0e9 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/trans01.sats @@ -0,0 +1,6 @@ +(* +fun +the_fxtyenv_println(): void +fun +jsonize_fxtyenv_fprint(FILEref): void +*) diff --git a/contrib/sparverius/xjsonize/TEST/gfact.dats b/contrib/sparverius/xjsonize/TEST/gfact.dats new file mode 100644 index 000000000..5ceb2ffef --- /dev/null +++ b/contrib/sparverius/xjsonize/TEST/gfact.dats @@ -0,0 +1,34 @@ +(* ****** ****** *) + +#include +"./../../../prelude/DATS/gnum.dats" +#include +"./../../../prelude/DATS/gord.dats" +#include +"./../../../prelude/DATS/gint.dats" + +(* ****** ****** *) + +#extern +fun + +gfact(x: a): a + +implement + +gfact = +fix +fact(x) => +if +g_gtz(x) +then +g_mul(x, fact(g_pred(x))) else g_1() + +(* ****** ****** *) + +val fact10 = +let val ans = gfact(10) in ans end + +(* ****** ****** *) + +(* end of [gfact.dats] *) diff --git a/contrib/sparverius/xjsonize/TEST/kfact.dats b/contrib/sparverius/xjsonize/TEST/kfact.dats new file mode 100644 index 000000000..cae9ac21f --- /dev/null +++ b/contrib/sparverius/xjsonize/TEST/kfact.dats @@ -0,0 +1,30 @@ +(* ****** ****** *) + +#extern +fun + +kfact +( n: int +, k: int - ans): ans + +implement + +kfact = +fix +kf(n, k0) => +if n > 0 +then kf(n-1, lam(r) => k0(n * r)) +else k0(1) // end of [if] + +val +fact = +lam(n) => kfact(n, lam r => r) + +(* ****** ****** *) + +val fact10 = +let val ans = fact(10) in ans end + +(* ****** ****** *) + +(* end of [kfact.dats] *) diff --git a/contrib/sparverius/xjsonize/TEST/kfibo.dats b/contrib/sparverius/xjsonize/TEST/kfibo.dats new file mode 100644 index 000000000..1a06fe70f --- /dev/null +++ b/contrib/sparverius/xjsonize/TEST/kfibo.dats @@ -0,0 +1,26 @@ +(* ****** ****** *) + +fun +kfibo(n, k) = +if n > 1 +then +kfibo +( n-1 +, lam(r1) => + kfibo + (n-2, lam(r2) => k(r1+r2)) +) +else k(n) + +val +fibo = +lam(n) => kfibo(n, lam r => r) + +(* ****** ****** *) + +val fibo10 = +let val ans = fibo(10) in ans end + +(* ****** ****** *) + +(* end of [kfact.dats] *) diff --git a/contrib/sparverius/xjsonize/TEST/kisevn.dats b/contrib/sparverius/xjsonize/TEST/kisevn.dats new file mode 100644 index 000000000..df069a98b --- /dev/null +++ b/contrib/sparverius/xjsonize/TEST/kisevn.dats @@ -0,0 +1,25 @@ +(* ****** ****** *) + +fun + +kisevn +( x: int +, k: int -> ans): ans = +if x > 0 +then kisodd(x-1, k) else k(1) +and +kisodd +( x: int +, k: int -> ans): ans = +if x > 0 +then kisevn(x-1, k) else k(0) + +(* ****** ****** *) + +val isevn10 = kisevn(10, lam r => r) +val isodd10 = kisodd(10, lam r => r) + +(* ****** ****** *) + +(* end of [kisevn.dats] *) + diff --git a/contrib/sparverius/xjsonize/TEST/mytest01.dats b/contrib/sparverius/xjsonize/TEST/mytest01.dats new file mode 100644 index 000000000..2d1efac2e --- /dev/null +++ b/contrib/sparverius/xjsonize/TEST/mytest01.dats @@ -0,0 +1,88 @@ + + +#extern fun +foo$helper(help: a): int + +(* #extern fun *) +(* foo(x: a): int *) + +implement foo$helper(x) = if x then 1 else 0 + +fun foo(x: a): int = foo$helper(x) + + +(* implement foo(x) = foo$helper(x) *) + +val xs = foo(false) +(* where *) +(* implement foo$helper(x) = if x then 1 else 0 *) +(* end *) + + + + +//// + +(* +fun +map (xs:list(a), f0: a -> b) = +( +case+ xs of +| list_nil() => + list_nil() +| list_cons(x0, xs) => + list_cons(f0(x0), map(xs, f0)) +) + +fun foo (a: int): bool = a = 0 + +(* +val ys = list_cons(1, list_nil()) +fun foo (a: int): bool = a = 0 +val xys = map(ys, foo) +*) +*) + +#extern fun + +foldl$fopr(res:res, x:x): res + +implement foldl$fopr(res, x) = g_add(res, x) + +fun +foldl (xs:list(x), res: res) = +( +case+ xs of +| list_cons(x0, xs) => foldl(xs, foldl$fopr(res, x0)) +| list_nil() => res +) + +val ys = list_cons(1, list_cons(2, list_nil())) + + +val res = foldl(ys, 0) +(* +where + implement foldl$fopr(res, x) = res + x +end +*) +(* +val res = foldl(ys, 0) where + implement foldl$fopr(res, x) = res + x +end +*) + + +(* +fun +foldl (xs:list(a), f0: (a, b) -> b, res: b) = +( +case+ xs of +| list_nil() => res +| list_cons(x0, xs) => foldl(xs, f0, f0(x0, res)) +) + +*) +(* val ys = list_cons(1, list_cons(2, list_nil())) *) +(* val xys = map(ys, lam a => a = 0) *) +(* val res = foldl(xys, lam(a,res) => (if a then res else res+1), 0) *) diff --git a/contrib/sparverius/xjsonize/TEST/staexp2.dats b/contrib/sparverius/xjsonize/TEST/staexp2.dats new file mode 100644 index 000000000..e69de29bb diff --git a/contrib/sparverius/xjsonize/TEST/test01.dats b/contrib/sparverius/xjsonize/TEST/test01.dats new file mode 100644 index 000000000..77feeec6d --- /dev/null +++ b/contrib/sparverius/xjsonize/TEST/test01.dats @@ -0,0 +1,236 @@ +(* ****** ****** *) + +#include +"./../../../prelude/DATS/gnum.dats" +#include +"./../../../prelude/DATS/gord.dats" +#include +"./../../../prelude/DATS/gint.dats" + +(* ****** ****** *) + +val x = g_succ(1) + +(* ****** ****** *) + +//// + +(* + +HX-2019-12-01: +This one is not yet supported. +Should it be supported? + +*) + +fun f = +fix g(x: int): int => +if x >= 2 then f(x-1) + g(x-2) else x + +val f10 = f(10) + +//// + +fun + +kfact +( n: int +, k: int -> ans): ans = +if n = 0 +then k(1) +else +kfact(n-1, lam(r) => k(n*r)) +val +fact10 = kfact(10, lam r => r) + +//// + +fun +fact2 +( nr +: @(int, int)): int = +if +nr.0 = 0 +then nr.1 +else +let +val @(n, r) = nr +in fact2(@(n-1, n*r)) end + +val fact10 = fact2(@(10, 1)) + +//// + +#extern +fun fact : int -> int +implement +fact(x) = +if x > 0 then x * fact(x-1) else 1 + +val fact10 = fact(10) + +//// + +fun +fact = +lam(x) => +( +fix f(x) => +if x > 0 +then x * fact(x-1) else 1)(x) +val fact10 = fact(10) + +//// + +fun +isevn(x: int): int = +if x > 0 +then isodd(x-1) else 1 +and +isodd(x: int): int = +if x > 0 +then isevn(x-1) else 0 + +val isevn10 = isevn(10) +val isodd10 = isodd(10) + +//// + +#extern +fun<> +fact : int -> int +implement +fact<> = +fix f(x) => +if x > 0 then x * f(x-1) else 1 + +val +fact10 = fact(10) + +//// + +fun +fact2 +( nr +: $(int, int)): int = +if +nr.0 = 0 +then nr.1 +else +let +val $(n, r) = nr +in fact2($(n-1, n*r)) end + +val fact10 = fact2($(10, 1)) + +(* ****** ****** *) +//// +val xy = @(1,2) +val xy_0 = xy.0 +val xy = $(1,2) +val xy_1 = xy.1 + +(* ****** ****** *) +//// +val +fact = +fix f(x:int):int => +if +x > 0 +then x*f(x-1) else 1 +// +(* ****** ****** *) +//// + +(* ****** ****** *) + +fun +from(n: int): list(int) = +if +(n > 0) +then +cons(n, from(n-1)) else nil() + +(* ****** ****** *) + +fun +list_mul +( xs +: list(int)): int = +case+ xs of +| nil() => 1 +| cons(x0, xs) => x0*list_mul(xs) + +(* ****** ****** *) + +fun +fact(n) = +list_mul(from(n)) + +(* ****** ****** *) + +val fact10 = fact(10) + +(* ****** ****** *) +//// +(* ****** ****** *) + +fun +tally +( xs +: list(int)): int = +case+ xs of +| nil() => 0 +| cons(x0, xs) => x0+tally(xs) + +(* ****** ****** *) + +val x0 = nil() +val x1 = cons(1,x0) +val x2 = cons(2,x1) +val x3 = cons(3,x2) +val sum = tally(x3) + +(* ****** ****** *) + +//// +(* ****** ****** *) + +val +fact10 = fact(10) where +{ +fun +fact(x: int): int = +if x > 0 then x * fact(x-1) else 1 +} + +(* ****** ****** *) +//// +val +isevn = +fix f(x:int): bool => +( +if x > 0 then g(x-1) else true +) where +{ +val g = +lam(x) => +if x > 0 then f(x-1) else false +} +val isevn100 = isevn(100) +val isevn101 = isevn(101) +//// +(* ****** ****** *) + +// (* +val x = 10 +val y = 20 +val f1 = lam(x:int) => x + x +val x2 = f(x) +val f2 = lam(x:int)(y:int) => x * y +val xy = f2(x)(y) +// *) +// +(* ****** ****** *) + +(* end of [test01.dats] *) From 54a98d18b07bbc2d1d6f569aaf8fa58978d115ae Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 11 Dec 2019 04:01:01 -0500 Subject: [PATCH 05/16] updating --- srcgen/xint/DATS/interp0_print.dats | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcgen/xint/DATS/interp0_print.dats b/srcgen/xint/DATS/interp0_print.dats index 8ccc6fe1b..b7b6a3c6b 100644 --- a/srcgen/xint/DATS/interp0_print.dats +++ b/srcgen/xint/DATS/interp0_print.dats @@ -98,10 +98,10 @@ case+ x0 of | IR0Vstr(s0) => fprint!(out, "IR0Vstr(", s0, ")") // -| IR0Vcon(d2c, xs) => +| IR0Vcon(d2c, arg) => fprint! ( out - , "IR0Vcon(", d2c, "; [", xs, "])") + , "IR0Vcon(", d2c, "; ", arg, ")") // | IR0Vfun(fopr) => fprint!(out, "IR0Vfun(", "...", ")") From 248bf0eae971403d124b28c70b20871f10202714 Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 11 Dec 2019 14:40:15 -0500 Subject: [PATCH 06/16] updating --- contrib/sparverius/xjsonize/DATS/dynexp0.dats | 967 +++++++++++++++++- contrib/sparverius/xjsonize/DATS/dynexp1.dats | 314 ++---- contrib/sparverius/xjsonize/DATS/dynexp2.dats | 7 +- contrib/sparverius/xjsonize/DATS/intrep0.dats | 211 +--- contrib/sparverius/xjsonize/DATS/json.dats | 46 + contrib/sparverius/xjsonize/DATS/statyp2.dats | 159 +-- contrib/sparverius/xjsonize/SATS/dynexp0.sats | 14 +- contrib/sparverius/xjsonize/SATS/intrep0.sats | 4 + contrib/sparverius/xjsonize/SATS/json.sats | 6 + 9 files changed, 1205 insertions(+), 523 deletions(-) diff --git a/contrib/sparverius/xjsonize/DATS/dynexp0.dats b/contrib/sparverius/xjsonize/DATS/dynexp0.dats index 4da0f3fd9..4747ac71d 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp0.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp0.dats @@ -18,6 +18,587 @@ UN = "prelude/SATS/unsafe.sats" #staload "./../SATS/lexing.sats" +(* +overload jsonize with jsonize_option +*) + +implement jsonize_val = jsonize_token +implement jsonize_val = jsonize_s0exp +implement jsonize_val = jsonize_sort0 +implement jsonize_val = jsonize_s0arg +implement jsonize_val = jsonize_t0arg +implement jsonize_val = jsonize_s0marg +implement jsonize_val = jsonize_t0marg +implement jsonize_val = jsonize_sq0arg +implement jsonize_val = jsonize_tq0arg +implement jsonize_val = jsonize_ti0arg +implement jsonize_val = jsonize_f0arg + +implement +jsonize_q0arg + (x0) = +( +// +case+ +x0.node() of +(* +| Q0ARGnone(tok) => + jsonify("Q0ARGnone", "tok", jsonize(tok)) +*) +| Q0ARGsome(sid, opt) => + jsonify("Q0ARGsome", ("sid", "opt"), (jsonize(sid), jsonize_option(opt))) +// +) (* end of [jsonize_q0arg] *) + +implement +jsonize_a0typ + (x0) = +( +// +case+ x0.node() of +(* +| A0TYPnone(tok) => + jsonify("A0TYPnone", tok) +*) +| A0TYPsome(s0e, opt) => + jsonify("A0TYPsome", ("s0e", "opt"), (jsonize(s0e), jsonize_option(opt))) +// +) (* end of [jsonize_a0typ] *) + + +local +// +implement jsonize_val = jsonize_a0typ + +fun +jsonize_a0typlstopt +(opt: a0typlstopt): jsonval = +( +case+ opt of +| None() => jsonify("None") +| Some(a0ts) => jsonify("Some", "a0ts", jsonize_list(a0ts)) +) +// +overload jsonize with jsonize_a0typlstopt of 100 +// + +implement jsonize_val = jsonize_s0qua + +in (* in-of-local *) + +implement +jsonize_d0arg + (x0) = +( +// +case+ x0.node() of +// +| D0ARGnone(tok) => + jsonify("D0ARGnone", "tok", jsonize(tok)) +// +| D0ARGsome_sta + (tbeg, s0qs, tend) => + jsonify("D0ARGsome_sta", ("tbeg", "s0qs", "tend"), + (jsonize(tbeg), jsonize_list(s0qs), jsonize(tend))) +// +| D0ARGsome_dyn1 + (tok) => + jsonify("D0ARGsome_dyn1", "tok", jsonize(tok)) +| D0ARGsome_dyn2 + (tbeg, arg0, opt1, tend) => + jsonify( + "D0ARGsome_dyn", + ("tbeg", "arg0", "opt1", "tend"), + (jsonize(tbeg), jsonize_list(arg0), jsonize(opt1), jsonize(tend)) + ) +// +) (* end of [jsonize_d0arg] *) + +end // end of [local] + + +implement jsonize_val = jsonize_s0qua +implement jsonize_val = jsonize_s0exp + +implement +jsonize_f0arg + (x0) = +( +// +case+ +x0.node() of +| F0ARGnone(tok) => + jsonify("F0ARGnone", "tok", jsonize(tok)) +| F0ARGsome_dyn(d0p) => + jsonify("F0ARGsome_dyn", "d0p", jsonize(d0p)) +| F0ARGsome_sta(tbeg, s0qs, tend) => + jsonify( + "F0ARGsome_sta", ("tbeg", "s0qs", "tend"), + (jsonize(tbeg), jsonize_list(s0qs), jsonize(tend)) + ) + +| F0ARGsome_met(tbeg, s0es, tend) => + jsonify( + "F0ARGsome_met", ("tbeg", "s0es", "tend"), + (jsonize(tbeg), jsonize_list(s0es), jsonize(tend)) + ) + (* where val _ = $showtype(s0es) end *) +// +) (* end of [jsonize_f0arg] *) + +implement jsonize_val = jsonize_q0arg + +implement +jsonize_sq0arg + (x0) = +( +// +case+ +x0.node() of +| SQ0ARGnone(tok) => + jsonify("SQ0ARGnone", "tok", jsonize(tok)) +| SQ0ARGsome(tbeg, q0as, tend) => + jsonify( + "SQ0ARGsome", ("tbeg", "q0as", "tend"), + (jsonize(tbeg), jsonize_list(q0as), jsonize(tend)) + ) + +// +) (* end of [jsonize_sq0arg] *) + +implement +jsonize_tq0arg + (x0) = +( +// +case+ +x0.node() of +| TQ0ARGnone(tok) => + jsonify("TQ0ARGnone", "tok", jsonize(tok)) +| TQ0ARGsome(tbeg, q0as, tend) => + jsonify( + "TQ0ARGsome", ("tbeg", "q0as", "tend"), + (jsonize(tbeg), jsonize_list(q0as), jsonize(tend)) + ) +// +) (* end of [jsonize_tq0arg] *) + + +implement +jsonize_ti0arg + (x0) = +( +// +case+ +x0.node() of +| TI0ARGnone(tok) => + jsonify("TI0ARGnone", "tok", jsonize(tok)) +| TI0ARGsome(tbeg, q0as, tend) => + jsonify( + "TI0ARGsome", ("tbeg", "q0as", "tend"), + (jsonize(tbeg), jsonize_list(q0as), jsonize(tend)) + ) +// +) (* end of [jsonize_ti0arg] *) + + +(* +implement +{a}(*tmp*) +jsonize_dl0abeled + (x0) = let +// +val+DL0ABELED(l0, t0, x1) = x0 +// +in + jsonify("SL0ABELED("); + jsonify(l0, ", ", t0, ", "); + jsonize_val(x1); jsonify(")") +end // end of [jsonize_dl0abeled] +*) + + +local + +implement +jsonize_val = jsonize_d0pat + +in (* in-of-local *) + +implement +jsonize_d0pat + (x0) = +( +case+ x0.node() of +// +| D0Pid(id) => + jsonify("D0Pid", "id", jsonize(id)) +// +| D0Pint(i0) => + jsonify("D0Pint", "i0", jsonize(i0)) +| D0Pchr(c0) => + jsonify("D0Pchr", "c0", jsonize(c0)) +| D0Pflt(f0) => + jsonify("D0Pflt", "f0", jsonize(f0)) +| D0Pstr(s0) => + jsonify("D0Pstr", "s0", jsonize(s0)) +// +| D0Papps(d0ps) => + jsonify("D0Papps", "d0ps", jsonize_list(d0ps)) + +// +| D0Psqarg + (tbeg, s0as, tend) => + jsonify( + "D0Psqarg", ("tbeg", "s0as", "tend"), + (jsonize(tbeg), jsonize_list(s0as), jsonize(tend)) + ) + (* where val _ = $showtype(s0as) end *) +// +| D0Pparen + (tbeg, d0ps, tend) => + jsonify( + "D0Pparen", ("tbeg", "d0ps", "tend"), + (jsonize(tbeg), jsonize_list(d0ps), jsonize(tend)) + ) +// +| D0Ptuple + (tbeg, topt, d0ps, tend) => + jsonify( + "D0Ptuple", ("tbeg", "topt", "d0ps", "tend"), + (jsonize(tbeg), jsonize_option(topt), jsonize_list(d0ps), jsonize(tend)) + ) +| D0Precord + (tbeg, topt, ld0ps, tend) => + jsonify( + "D0Precord", ("tbeg", "topt", "ld0ps", "tend"), + (jsonize(tbeg), jsonize_option(topt), jsonize("..."), jsonize(tend)) + ) +// +| D0Panno + (d0p, ann) => + jsonify("D0Panno", ("d0p", "ann"), (jsonize(d0p), jsonize(ann))) +// +| D0Pqual + (tok, d0p) => + jsonify("D0Pqual", ("tok", "d0p"), (jsonize(tok), jsonize(d0p))) +// +| D0Pnone(tok) => jsonify("D0Pnone", "tok", jsonize(tok)) +// +) (* end of [jsonize_d0pat] *) + +end // end of [local] + + +local + +implement +jsonize_val = jsonize_d0pat + +in (* in-of-local *) + +implement +jsonize_d0pat_RPAREN + (x0) = +( +case+ x0 of +| d0pat_RPAREN_cons0(tok) => + jsonify("d0pat_RPAREN_cons0", "tok", jsonize(tok)) +| d0pat_RPAREN_cons1(tok1, d0ps, tok2) => + jsonify( + "d0pat_RPAREN_cons1", ("tok1", "d0ps", "tok2"), + (jsonize(tok1), jsonize_list(d0ps), jsonize(tok2)) + ) +) (* end of [jsonize_d0pat_RPAREN] *) + +end // end of [local] + + +local + +implement +jsonize_val = jsonize_d0pat + +in (* in-of-local *) + +implement +jsonize_labd0pat_RBRACE + (x0) = +( +case+ x0 of +| labd0pat_RBRACE_cons0(tok) => + jsonify("labd0pat_RBRACE_cons0", "tok", jsonize(tok)) +| labd0pat_RBRACE_cons1(tok1, ld0ps, tok2) => + jsonify( + "labd0pat_RBRACE_cons1", ("tok1", "ld0ps", "tok2"), + (jsonize(tok1), jsonize("..."), jsonize(tok2)) + ) +) (* end of [jsonize_labd0pat_RBRACE] *) + +end // end of [local] + + +local + +implement +jsonize_val = jsonize_d0exp +implement +jsonize_val = jsonize_s0exp +implement +jsonize_val = jsonize_d0ecl +implement +jsonize_val = jsonize_f0arg + +in (* in-of-local *) + +implement +jsonize_d0exp + (x0) = +( +case+ x0.node() of +// +| D0Eid(id) => + jsonify("D0Eid", "id", jsonize(id)) +// +| D0Eint(i0) => + jsonify("D0Eint", "i0", jsonize(i0)) +| D0Echr(c0) => + jsonify("D0Echr", "c0", jsonize(c0)) +| D0Eflt(f0) => + jsonify("D0Eflt", "f0", jsonize(f0)) +| D0Estr(s0) => + jsonify("D0Estr", "s0", jsonize(s0)) +// +| D0Eapps(d0es) => + jsonify("D0Eapps", "d0es", jsonize_list(d0es)) +// +| D0Esqarg + (tbeg, s0es, tend) => + jsonify( + "D0Esqarg", ("tbeg", "s0es", "tend"), + (jsonize(tbeg), jsonize_list(s0es), jsonize(tend)) + ) +| D0Etqarg + (tbeg, s0es, tend) => + jsonify( + "D0Etqarg", ("tbeg", "s0es", "tend"), + (jsonize(tbeg), jsonize_list(s0es), jsonize(tend)) + ) +// +| D0Eparen + (tbeg, d0es, tend) => + jsonify( + "D0Eparen", ("tbeg", "d0es", "tend"), + (jsonize(tbeg), jsonize_list(d0es), jsonize(tend)) + ) +// +| D0Etuple + (tbeg, topt, d0es, tend) => + jsonify( + "D0Etuple", ("tbeg", "topt", "d0es", "tend"), + (jsonize(tbeg), jsonize_option(topt), jsonize_list(d0es), jsonize(tend)) + ) +| D0Erecord + (tbeg, topt, ld0es, tend) => + jsonify( + "D0Erecord", ("tbeg", "topt", "ld0es", "tend"), + (jsonize(tbeg), jsonize_option(topt), jsonize("..."), jsonize(tend)) + ) +// +| D0Eif0 + (tif0, d0e1, d0e2, d0e3, tend) => + jsonify( + "D0Eif0", ("tif0", "d0e1", "d0e2", "d0e3", "tend"), + (jsonize(tif0), jsonize(d0e1), jsonize(d0e2), jsonize(d0e3), jsonize_option(tend)) + ) +// +| D0Ecase + (tok0, d0e1, tof2, tbar, d0cs, tend) => + jsonify( + "D0Ecase", ("tok0", "d0e1", "tof2", "tbar", "d0cs"(*...*), "tend"), + ( + jsonize(tok0), + jsonize(d0e1), + jsonize(tof2), + jsonize_option(tbar), + jsonize("..."), + jsonize_option(tend) + ) + ) +// +| D0Elet + (tok0, d0cs, topt, d0es, tok2) => + jsonify( + "D0Elet", ("tok0", "d0cs", "topt", "d0es", "tok2"), + ( + jsonize(tok0), + jsonize_list(d0cs), + jsonize_option(topt), + jsonize_list(d0es), + jsonize(tok2) + ) + ) +// +| D0Ewhere(d0e1, d0cs) => + jsonify("D0Ewhere", ("d0e1", "d0cs"), (jsonize(d0e1), jsonize(d0cs))) +// +// +| D0Ebrack + (tbeg, d0es, tend) => + jsonify( + "D0Ebrack", ("tbeg", "d0es", "tend"), + (jsonize(tbeg), jsonize_list(d0es), jsonize(tend)) + ) +| D0Edtsel + (tdot, lab1, arg2) => + jsonify( + "D0Edtsel", ("tdot", "lab1", "arg2"), + (jsonize(tdot), jsonize(lab1), jsonize_option(arg2)) + ) +// +| D0Elam + (tok0, arg1, res2, farrw, fbody, tend) => + jsonify( + "D0Elam", ("tok0", "arg1", "res2", "farrw", "fbody", "tend"), + (jsonize(tok0), jsonize_list(arg1), jsonize(res2), jsonize(farrw), jsonize(fbody), jsonize_option(tend)) + ) +| D0Efix + (tok0, fid0, arg1, res2, farrw, fbody, tend) => + jsonify( + "D0Efix", ("tok0", "fid0", "arg1", "res2", "farrw", "fbody", "tend"), + (jsonize(tok0), jsonize(fid0), jsonize_list(arg1), jsonize(res2), jsonize(farrw), jsonize(fbody), jsonize_option(tend))) +// +| D0Eanno + (d0e, ann) => + jsonify("D0Eanno", ("d0e", "ann"), (jsonize(d0e), jsonize(ann))) +// +| D0Equal + (tok, d0e) => + jsonify("D0Equal", ("tok", "d0e"), (jsonize(tok), jsonize(d0e))) +// +| D0Enone(tok) => jsonify("D0Enone"," tok", jsonize(tok)) +// +) (* end of [jsonize_d0exp] *) + +end // end of [local] + +local + +implement +jsonize_val = jsonize_d0exp + +in (* in-of-local *) + +implement +jsonize_d0exp_RPAREN + (x0) = +( +case+ x0 of +| d0exp_RPAREN_cons0(tok) => + jsonify("d0exp_RPAREN_cons0", "tok", jsonize(tok)) +| d0exp_RPAREN_cons1(tok1, d0es, tok2) => + jsonify( + "d0exp_RPAREN_cons1", ("tok1", "d0es", "tok2"), + (jsonize(tok1), jsonize_list(d0es), jsonize(tok2)) + ) +| d0exp_RPAREN_cons2(tok1, d0es, tok2) => + jsonify( + "d0exp_RPAREN_cons2", ("tok1", "d0es", "tok2"), + (jsonize(tok1), jsonize_list(d0es), jsonize(tok2)) + ) +) (* end of [jsonize_d0exp_RPAREN] *) + +end // end of [local] + +local + +implement +jsonize_val = jsonize_d0exp + +in (* in-of-local *) + +implement +jsonize_labd0exp_RBRACE + (x0) = +( +case+ x0 of +| labd0exp_RBRACE_cons0(tok) => + jsonify("labd0exp_RBRACE_cons0", "tok", jsonize(tok)) +| labd0exp_RBRACE_cons1(tok1, ld0es, tok2) => + jsonify( + "labd0exp_RBRACE_cons1", ("tok1", "ld0es", "tok2"), + (jsonize(tok1), jsonize("..."), jsonize(tok2)) + ) +) (* end of [jsonize_labd0exp_RBRACE] *) + +end // end of [local] + + +implement +jsonize_d0exp_THEN(x0) = +( +case+ x0 of +| d0exp_THEN(tok, d0e) => + jsonify("d0exp_THEN", ("tok", "d0e"), (jsonize(tok), jsonize(d0e))) +) (* end of [jsonize_d0exp_THEN] *) + + +implement +jsonize_d0exp_ELSE(x0) = +( +case+ x0 of +| d0exp_ELSEnone() => + jsonify("d0exp_ELSEnone") +| d0exp_ELSEsome(tok, d0e) => + jsonify("d0exp_ELSEsome", ("tok", "d0e"), (jsonize(tok), jsonize(d0e))) +) (* end of [jsonize_d0exp_ELSE] *) + + +implement +jsonize_endwhere(x0) = +( +case+ x0 of +| endwhere_cons1(tok) => + jsonify("endwhere_cons1", "tok", jsonize(tok)) +| endwhere_cons2(tok1, opt2) => + jsonify("endwhere_cons2", ("tok1", "opt2"), (jsonize(tok1), jsonize_option(opt2))) +) + +implement jsonize_val = jsonize_d0ecl + + +implement +jsonize_d0eclseq_WHERE(x0) = +( +case+ x0 of +| d0eclseq_WHERE + (tok0, opt1, d0cs, opt2) => + jsonify( + "d0eclseq_WHERE", ("tok0", "opt1", "d0cs", "opt2"), + (jsonize(tok0), jsonize_option(opt1), jsonize_list(d0cs), jsonize(opt2)) + ) +) (* end of [jsonize_d0eclseq_WHERE] *) + + +implement jsonize_val = jsonize_s0exp + +implement +jsonize_f0unarrow(x0) = +( +case+ x0 of +| F0UNARROWnone(tok) => + jsonify("F0UNARROWnone", "tok", jsonize(tok)) +| F0UNARROWdflt(tok) => + jsonify("F0UNARROWdflt", "tok", jsonize(tok)) +| F0UNARROWlist(tbeg, s0es, tend) => + jsonify( + "F0UNARROWlist", ("tbeg", "s0es", "tend"), + (jsonize(tbeg), jsonize_list(s0es), jsonize(tend)) + ) +) (* end of [jsonize_f0unarrow] *) + + + implement jsonize_val(x) = jsonize_i0dnt(x) implement @@ -30,16 +611,396 @@ case+ x0 of jsonify("DECMODnone") // | DECMODsing(tok, id0) => - (* fprint!(out, "DECMODsing(", tok, "; ", id0, ")") *) jsonify("DECMODsing", ("tok", "id0"), rst) where - (* val _ = $showtype(id0) *) val rst = (jsonize(tok), jsonize(id0)) end | DECMODlist(tok, tbeg, ids, tend) => - (* fprint!( out, "DECMODlist(", tok, "; ", tbeg, "; ", ids, "; ", tend, ")") *) + (* jsonize!( out, "DECMODlist", tok, tbeg, ids, tend) *) jsonify("DECMODsing", ("tok", "tbeg", "ids", "tend"), rst) where (* val _ = $showtype(ids) *) val xys = jsonize_list(ids) val rst = (jsonize(tok), jsonize(tbeg), xys, jsonize(tend)) end ) + + +implement +jsonize_teqd0expopt + (x0) = +( +case+ x0 of +| TEQD0EXPnone() => + jsonify("TEQD0EXPnone") +| TEQD0EXPsome(tok, d0e) => + jsonify("TEQD0EXPsome", ("tok", "d0e"), (jsonize(tok), jsonize(d0e))) +) + +implement +jsonize_wths0expopt + (x0) = +( +case+ x0 of +| WTHS0EXPnone() => + jsonify("WTHS0EXPnone") +| WTHS0EXPsome(tok, d0e) => + jsonify("WTHS0EXPsome", ("tok", "d0e"), (jsonize(tok), jsonize(d0e))) +) + + +local + +implement +jsonize_val = jsonize_d0ecl +implement +jsonize_val = jsonize_g0marg +implement +jsonize_val = jsonize_v0aldecl +implement +jsonize_val = jsonize_v0ardecl +implement +jsonize_val = jsonize_f0undecl +implement +jsonize_val = jsonize_d0cstdecl +implement +jsonize_val = jsonize_i0dnt + +implement +jsonize_val = jsonize_d0tsort +implement +jsonize_val = jsonize_d0atype + +implement +jsonize_val = jsonize_t0int + +in (* in-of-local *) + +implement +jsonize_d0ecl + (x0) = +( +case+ x0.node() of +// +| D0Cnone(tok) => + jsonify("D0Cnone", "tok", jsonize(tok)) +// +| D0Ctokerr(tok) => + jsonify("D0Ctokerr", "tok", jsonize(tok)) +// +| D0Cnonfix(tok, ids) => + jsonify("D0Cnonfix", ("tok", "ids"), (jsonize(tok), jsonize_list(ids))) +| D0Cfixity(tok, ids, opt) => + jsonify( + "D0Cfixity", ("tok", "ids", "opt"), + (jsonize(tok), jsonize_list(ids), jsonize(opt)) + ) +// +| D0Cstatic(tok, d0c) => + jsonify("D0Cstatic", ("tok", "d0c"), (jsonize(tok), jsonize(d0c))) +| D0Cextern(tok, d0c) => + jsonify("D0Cextern", ("tok", "d0c"), (jsonize(tok), jsonize(d0c))) +// +| D0Cdefine + (tok, gid, gmas, gdef) => + jsonify( + "D0Cdefine", ("tok", "gid", "gmas", "gdef"), + (jsonize(tok), jsonize(gid), jsonize_list(gmas), jsonize(gdef)) + ) +// +| D0Cmacdef + (tok, gid, gmas, mdef) => + jsonify( + "D0Cmacdef", ("tok", "gid", "gmas", "mdef"), + (jsonize(tok), jsonize(gid), jsonize_list(gmas), jsonize(mdef)) + ) +// +| D0Cinclude(tok, d0e) => + jsonify("D0Cinclude", ("tok", "d0e"), (jsonize(tok), jsonize(d0e))) +// +| D0Cstaload(tok, d0e) => + jsonify("D0Cstaload", ("tok", "d0e"), (jsonize(tok), jsonize(d0e))) +(* +| D0Cdynload(tok, d0e) => + jsonify("D0Cdynload", tok, d0e) +*) +// +| D0Cabssort(tok, tid) => + jsonify("D0Cabssort", ("tok", "tid"), (jsonize(tok), jsonize(tid))) +// +| D0Cstacst0 + (tok, sid, tmas, tok1, s0t2) => + jsonify( + "D0Cstacst0", ("tok", "sid", "tmas", "tok1", "s0t2"), + ( + jsonize(tok), + jsonize(sid), + jsonize_list(tmas), + jsonize(tok1), jsonize(s0t2) + ) + ) +// +| D0Csortdef + (tok, tid, tok1, def2) => + jsonify( + "D0Csortdef", ("tok", "tid", "tok1", "def2"), + (jsonize(tok), jsonize(tid), jsonize(tok1), jsonize(def2)) + ) +| D0Csexpdef + (tok, sid, arg, res, tok1, tdef) => + jsonify( + "D0Csexpdef", ("tok", "sid", "arg", "res", "tok1", "tdef"), + (jsonize(tok), jsonize(sid), jsonize_list(arg), jsonize_option(res), jsonize(tok1), jsonize(tdef)) + ) +// +| D0Cabstype + (tok, sid, arg, res, tdef) => + jsonify( + "D0Cabstype", ("tok", "sid", "arg", "res", "tdef"), + (jsonize(tok), jsonize(sid), jsonize_list(arg), jsonize_option(res), jsonize(tdef)) + ) +// +| D0Cabsimpl + (tok, sqid, smas, res0, teq1, def2) => + jsonify( + "D0Cabsimpl", ("tok", "sqid", "smas", "res0", "teq1", "def2"), + ( + jsonize(tok), + jsonize(sqid), + jsonize_list(smas), + jsonize_option(res0), + jsonize(teq1), + jsonize(def2) + ) + ) +// +| D0Cvaldecl + (tok, mopt, d0cs) => + jsonify( + "D0Cvaldecl", ("tok", "mopt", "d0cs"), + (jsonize(tok), jsonize(mopt), jsonize_list(d0cs)) + ) +// +| D0Cvardecl + (tok, mopt, d0cs) => + jsonify( + "D0Cvardecl", ("tok", "mopt", "d0cs"), + (jsonize(tok), jsonize(mopt), jsonize_list(d0cs)) + ) +// +| D0Cfundecl + (tok, mopt, tqas, d0cs) => + jsonify( + "D0Cfundecl", ("tok", "mopt", "tqas", "d0cs"), + (jsonize(tok), jsonize(mopt), jsonize_list(tqas), jsonize_list(d0cs)) + ) +// +| D0Cimpdecl + (tok, mopt, sqas, tqas, dqid, tias, f0as, res0, teq1, d0e2) => + jsonify( + "D0Cimpdecl", + ("tok", "mopt", "sqas", "tqas", "dqid", "tias", "f0as", "res0", "teq1", "d0e2"), + ( + jsonize(tok), + jsonize(mopt), + jsonize_list(sqas), + jsonize_list(tqas), + jsonize(dqid), + jsonize_list(tias), + jsonize_list(f0as), + jsonize(res0), + jsonize(teq1), + jsonize(d0e2) + ) + ) +// +| D0Csymload + (tok, sym, twth, dqid, tint) => + jsonify( + "D0Csymload", ("tok", "sym", "twth", "dqid", "tint"), + (jsonize(tok), jsonize(sym), jsonize(twth), jsonize(dqid), jsonize_option(tint)) + ) +// +| D0Cdatasort(tok, d0cs) => + jsonify("D0Cdatasort", ("tok", "d0cs"), (jsonize(tok), jsonize_list(d0cs))) +// +| D0Cdatatype(tok, d0cs, wopt) => + jsonify( + "D0Cdatatype", ("tok", "d0cs", "wopt"), + (jsonize(tok), jsonize_list(d0cs), jsonize(wopt)) + ) +// +| D0Cdynconst + (tok, tqas, d0cs) => + jsonify( + "D0Cdynconst", ("tok", "tqas", "d0cs"), + (jsonize(tok), jsonize_list(tqas), jsonize_list(d0cs)) + ) +// +| D0Clocal + (tbeg, d0cs0, topt, d0cs1, tend) => + jsonify( + "D0Clocal", ("tbeg", "d0cs0", "topt", "d0cs1", "tend"), + (jsonize(tbeg), jsonize_list(d0cs0), jsonize_option(topt), jsonize_list(d0cs1), jsonize(tend)) + ) +// +(* +| _(*rest-of-d1ecl*) => + jsonify("jsonize_d1ecl: D0C...: not-yet-implemented") +*) +// +) (* end of [jsonize_d0ecl] *) + +end // end of [local] + + +implement +jsonize_precopt + (x0) = +( +case+ x0 of +| PRECOPTnil() => + jsonify("PRECOPTnil") +| PRECOPTint(tint) => + jsonify("PRECOPTint", "tint", jsonize(tint)) +| PRECOPTopr(topr, pmod) => + jsonify("PRECOPTopr", ("topr", "pmod"), (jsonize(topr), jsonize(pmod))) +) (* end of [jsonize_precopt] *) + + + +implement +jsonize_signint + (x0) = +( +case+ x0 of +| SIGNINTint(tint) => + jsonify("SIGNINTint", "tint", jsonize(tint)) +| SIGNINTopr(topr, tint) => + jsonify("SIGNINTopr", ("topr", "tint"), (jsonize(topr), jsonize(tint))) +) +// +implement +jsonize_precmod + (x0) = +( +case+ x0 of +| PRECMODnone() => + jsonify("PRECMODnone") +| PRECMODsome(tbeg, sint, tend) => + jsonify("PRECMODsome", ("tbeg", "sint", "tend"), (jsonize(tbeg), jsonize(sint), jsonize(tend))) +) + + + +implement +jsonize_abstdf0 + (x0) = +( +case+ x0 of +| ABSTDF0some() => + jsonify("ABSTDF0some") +| ABSTDF0lteq(tok, s0e) => + jsonify("ABSTDF0lteq", ("tok", "s0e"), (jsonize(tok), jsonize(s0e))) +| ABSTDF0eqeq(tok, s0e) => + jsonify("ABSTDF0eqeq", ("tok", "s0e"), (jsonize(tok), jsonize(s0e))) +) (* end of [jsonize_abstdf0] *) + + +implement +jsonize_g0expdef + (x0) = +( +case+ x0 of +| G0EDEFnone() => + jsonify("G0EDEFnone") +| G0EDEFsome(topt, g0e1) => + jsonify("G0EDEFsome", ("topt", "g0e1"), (jsonize_option(topt), jsonize(g0e1))) +) + + +implement +jsonize_d0macdef + (x0) = +( +case+ x0 of +| D0MDEFnone() => + jsonify("D0MDEFnone") +| D0MDEFsome(topt, d0e1) => + jsonify("D0MDEFsome", ("topt", "d0e1"), (jsonize_option(topt), jsonize(d0e1))) +) + + +implement +jsonize_wd0eclseq + (x0) = +( +case+ x0 of +| WD0CSnone() => + jsonify("WD0CSnone") +| WD0CSsome(tbeg, topt, d0cs, tend) => + jsonify("WD0CSsome", ("tbeg", "topt", "d0cs", "tend"), (jsonize(tbeg), jsonize_option(topt), jsonize_list(d0cs), jsonize(tend))) +) (* end of [jsonize_wd0eclseq] *) + + +implement jsonize_val = jsonize_d0exp + +implement +jsonize_v0aldecl + (x0) = let +// +val+V0ALDECL(rcd) = x0 +// +in + (* jsonify("V0ALDECL@{", "pat=", rcd.pat, ", teq=", rcd.teq, ", def=", rcd.def, ", wtp=", rcd.wtp, "}") *) + jsonify("V0ALDECL@{", ("pat", "teq", "def", "wtp"), + (jsonize(rcd.pat), jsonize_option(rcd.teq), jsonize_option(rcd.def), jsonize(rcd.wtp))) +end // end of [jsonize_v0aldecl] + + +implement jsonize_val = jsonize_i0dnt +implement jsonize_val = jsonize_s0exp + +implement +jsonize_v0ardecl + (x0) = let +// +val+V0ARDECL(rcd) = x0 +// +in + jsonify("V0ARDECL", ("nam", "wth", "res", "ini"), + (jsonize(rcd.nam), jsonize_option(rcd.wth), jsonize_option(rcd.res), jsonize(rcd.ini))) +end // end of [jsonize_v0ardecl] + + +implement jsonize_val = jsonize_f0arg + +implement +jsonize_f0undecl + (x0) = let +// +val+F0UNDECL(rcd) = x0 +// +in + jsonify("F0UNDECL", ("nam", "arg", "res", "teq", "def", "wtp"), + (jsonize(rcd.nam), jsonize_list(rcd.arg), jsonize(rcd.res), jsonize_option(rcd.teq), jsonize_option(rcd.def), jsonize(rcd.wtp))) +end // end of [jsonize_f0undecl] + + +implement jsonize_val = jsonize_d0arg + +implement +jsonize_d0cstdecl + (x0) = let +// +val+D0CSTDECL(rcd) = x0 +// +in + jsonify( + "D0CSTDECL", ("nam", "arg", "res", "def"), + ( + jsonize(rcd.nam), + jsonize_list(rcd.arg), + jsonize(rcd.res), + jsonize(rcd.def) + ) + ) +end // end of [jsonize_d0cstdecl] diff --git a/contrib/sparverius/xjsonize/DATS/dynexp1.dats b/contrib/sparverius/xjsonize/DATS/dynexp1.dats index 3c9112938..416219a82 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp1.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp1.dats @@ -1,65 +1,58 @@ #include "share/atspre_staload.hats" #staload UN = "prelude/SATS/unsafe.sats" +(* #include "./../HATS/libxatsopt.hats" +*) #staload "./../SATS/json.sats" #staload _ = "./json.dats" #define XATS_targetloc "./../../../../srcgen/xats" -(* -#staload "{$XATS}/SATS/dynexp0.sats" + #staload "{$XATS}/SATS/staexp0.sats" -*) +#staload "{$XATS}/SATS/dynexp0.sats" + +#staload "{$XATS}/SATS/staexp1.sats" #staload "{$XATS}/SATS/dynexp1.sats" #staload "./../SATS/json.sats" #staload _ = "./json.dats" -#staload "./../SATS/dynexp0.sats" -#staload "./../SATS/staexp0.sats" +#staload "./../SATS/label0.sats" #staload "./../SATS/lexing.sats" + +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/dynexp0.sats" + +#staload "./../SATS/staexp1.sats" #staload "./../SATS/dynexp1.sats" -#staload "./../SATS/label0.sats" -implement jsonize_val(x) = jsonize_d1exp(x) -implement jsonize_val(x) = jsonize_d1ecl(x) +implement jsonize_val = jsonize_d1exp +implement jsonize_val = jsonize_d1ecl + +implement jsonize_val = jsonize_s1exp implement jsonize_d1exp (x0) = labval2(jsonize("d1exp"), res) where +{ val res = ( -case+ -x0.node() of +case+ x0.node() of | D1Eid(tok) => - (* labval2(jsonize("D1Eid"), jsonize(tok)) // tok, ")") *) - jsonify("D1Eid", "tok", rst) where - val rst = jsonize(tok) - end + jsonify("D1Eid", "tok", jsonize(tok)) // | D1Eint(tok) => - (* labval2(jsonize("D1Eint"), jsonize(tok)) // tok, ")") *) - jsonify("D1Eint", "tok", rst) where - val rst = jsonize(tok) - end + jsonify("D1Eint", "tok", jsonize(tok)) | D1Echr(tok) => - (* labval2(jsonize("D1Echr"), jsonize(tok)) // tok, ")") *) - jsonify("D1Echr", "tok", rst) where - val rst = jsonize(tok) - end + jsonify("D1Echr", "tok", jsonize(tok)) | D1Eflt(tok) => - (* labval2(jsonize("D1Eflt"), jsonize(tok)) // tok, ")") *) - jsonify("D1Eflt", "tok", rst) where - val rst = jsonize(tok) - end + jsonify("D1Eflt", "tok", jsonize(tok)) | D1Estr(tok) => - (* labval2(jsonize("D1Estr"), jsonize(tok)) // tok, ")") *) - jsonify("D1Estr", "tok", rst) where - val rst = jsonize(tok) - end + jsonify("D1Estr", "tok", jsonize(tok)) // | D1Eapp() => jsonify("D1Eapp") @@ -67,253 +60,110 @@ x0.node() of | D1Ebs0() => jsonify("D1Ebs0") | D1Ebs1(d1e) => -(* - labval2(jsonize("D1Ebs1"), jsonize(d1e)) - (* where val _ = $showtype(d1e) end *) -*) - jsonify("D1Ebs1", "d1e", rst) where - val jd1e = jsonize(d1e) - val rst = jd1e - end + jsonify("D1Ebs1", "d1e", jsonize(d1e)) // | D1Eapp1(d1e0, d1e1) => -(* - labval2(jsonize("D1Eapp1"), lst) // d1e0, "; ", d1e1, ")") - where - val j_d1e0 = jsonize(d1e0) - val j_d1e1 = jsonize(d1e1) - val lst = JSONlist(list_cons(j_d1e0, list_sing(j_d1e1))) - end - (* where val _ = $showtype(d1e1) end *) -*) - jsonify("D1Eapp1", ("d1e0", "d1e1"), rst) where - val jd1e0 = jsonize(d1e0) - val jd1e1 = jsonize(d1e1) - val rst = (jd1e0, jd1e1) - end + jsonify("D1Eapp1", ("d1e0", "d1e1"), (jsonize(d1e0), jsonize(d1e1))) | D1Eapp2(d1e0, d1e1, d1e2) => -(* - labval2(jsonize("D1Eapp2"), lst) // d1e0, "; ", d1e1, "; ", d1e2, ")") - where - val j_d1e0 = jsonize(d1e0) - val j_d1e1 = jsonize(d1e1) - val j_d1e2 = jsonize(d1e2) - val lst = list_cons(j_d1e0, list_cons(j_d1e1, list_sing(j_d1e2))) - val lst = JSONlist(lst) - end -*) - jsonify("D1Eapp2", ("d1e0", "d1e1", "d1e2"), rst) where - val jd1e0 = jsonize(d1e0) - val jd1e1 = jsonize(d1e1) - val jd1e2 = jsonize(d1e2) - val rst = (jd1e0, jd1e1, jd1e2) - end - -// + jsonify("D1Eapp2", ("d1e0", "d1e1", "d1e2"), + (jsonize(d1e0), jsonize(d1e1), jsonize(d1e2)) + ) | D1Esqarg(s1es) => - (* labval2(jsonize("D1Esqarg"), jnul()) // s1es, ")") *) - jsonify("D1Esqarg", "s1es", rst) where - (* val jd1es = jsonize_list(s1es) *) - val rst = jstr("...") - end + jsonify("D1Esqarg", "s1es", jsonize_list(s1es)) | D1Etqarg(s1es) => - (* labval2(jsonize("D1Etqarg"), jnul()) // s1es, ")") *) - jsonify("D1Etqarg", "s1es", rst) where - (* val jd1es = jsonize_list(s1es) *) - val rst = jstr("...") - end + jsonify("D1Etqarg", "s1es", jsonize_list(s1es)) // | D1Elist(d1es) => -(* - labval2(jsonize("D1Elist1"), jd1es) // d1es, ")") - where - val jd1es = jsonize_list(d1es) - (* val jd1es = jsonize(d1es) *) - end -*) - jsonify("D1Elist", "d1es1", rst) where - val jd1es = jsonize_list(d1es) - val rst = jd1es - end - + jsonify("D1Elist", "d1es1", jsonize_list(d1es)) | D1Elist(d1es1, d1es2) => -(* - labval2(jsonize("D1Elist2"), lst) // d1es1, "; ", d1es2, ")") - where - val jd1es1 = jsonize_list(d1es1) - val jd1es2 = jsonize_list(d1es2) - (* val jd1es1 = jsonize(d1es1) *) - (* val jd1es2 = jsonize(d1es2) *) - val lst = JSONlist($list{jsonval}(jd1es1,jd1es2)) - end -*) - jsonify("D1Elist", ("d1es1", "d1es2"), rst) where - val jd1es1 = jsonize_list(d1es1) - val jd1es2 = jsonize_list(d1es2) - val rst = (jd1es1, jd1es2) - end + jsonify("D1Elist", ("d1es1", "d1es2"), + (jsonize_list(d1es1), jsonize_list(d1es2)) + ) // | D1Eseqn(d1es1, d1es2) => -(* - labval2(jsonize("D1Eseqn"), con) - where - val jd1es1 = jsonize_list(d1es1) - val jd1es2 = jsonize_list(d1es2) - (* val jd1es1 = jsonize(d1es1) *) - (* val jd1es2 = jsonize(d1es2) *) - val con = jsonval_labval2("d1es1", jd1es1, "d1es2", jd1es2) - (* val lst = JSONlist($list{jsonval}(jd1es1,jd1es2)) *) - end -*) - jsonify("D1Eseqn", ("d1es1", "d1es2"), rst) where - val jd1es1 = jsonize_list(d1es1) - val jd1es2 = jsonize_list(d1es2) - val rst = (jd1es1, jd1es2) - end - + jsonify("D1Eseqn", ("d1es1", "d1es2"), + (jsonize_list(d1es1), jsonize_list(d1es2)) + ) // | D1Etuple(tok, d1es) => - (* labval2(jsonize("D1Etuple"), con) *) - (* where *) - (* val jd1es = jsonize_list(d1es) *) - (* (* val jd1es = jsonize(d1es) *) *) - (* val con = jsonval_labval2("tok", jsonize(tok), "d1es", jd1es) *) - (* end *) - jsonify("D1Etuple", ("tok", "d1es"), rst) where - val jtok = jsonize(tok) - val jd1es = jsonize_list(d1es) - val rst = (jtok, jd1es) - end + jsonify("D1Etuple", ("tok", "d1es"), (jsonize(tok), jsonize_list(d1es))) | D1Etuple(tok, d1es1, d1es2) => - (* labval2(jsonize("D1Etuple"), jnul()) // tok, "; ", d1es1, "; ", d1es2, ")") *) - jsonify("D1Etuple", ("tok", "d1es1", "d1es2"), rst) - where - val jtok = jsonize(tok) - val jd1es1 = jsonize_list(d1es1) - val jd1es2 = jsonize_list(d1es2) - (* val jd1es1 = jsonize(d1es1) *) - (* val jd1es2 = jsonize(d1es2) *) - (* val con = jsonval_labval3("tok", jtok, "d1es1", jd1es1, "d1es2", jd1es2) *) - val rst = (jtok, jd1es1, jd1es2) - end - + jsonify("D1Etuple", ("tok", "d1es1", "d1es2"), + (jsonize(tok), jsonize_list(d1es1), jsonize_list(d1es2)) + ) // | D1Ebrack(d1es) => - (* labval2(jsonize("D1Ebrack"), jnul()) // d1es, ")") *) - (* where *) - (* val jd1es = jsonize_list(d1es) *) - (* (* val jd1es = jsonize(d1es) *) *) - (* val con = jsonval_labval1("d1es", jd1es) *) - (* end *) - jsonify("D1Ebrack", "d1es", rst) where - val rst = jsonize_list(d1es) - end + jsonify("D1Ebrack", "d1es", jsonize_list(d1es)) | D1Edtsel(lab1, arg2) => - (* labval2(jsonize("D1Edtsel"), rst) // lab1, "; ", arg2, ")") *) - (* where *) - (* (* val _ = $showtype(arg2) *) *) - (* (* option_t0ype_bool_type(d1exp_tbox, b 15960): type *) *) - (* val rst = jsonval_labval2("lab1", jsonize(lab1), "arg2", jstr("...")) *) - (* end *) - jsonify("D1Edtsel", ("lab1", "arg2"), rst) where - val rst = (jsonize(lab1), jstr("...")) - end - - + jsonify("D1Edtsel", ("lab1", "arg2"), (jsonize(lab1), jstr("..."))) // | D1Elet(d1cs, d1es) => - jsonify("D1Elet", ("d1cs", "d1es"), json) - (* labval2(jsonize("D1Elet"), jnul()) // d1cs, "; ", d1es, ")") *) - (* where val _ = $showtype(d1es) end // list d1ecl, list d1exp *) - where - val jd1cs = jsonize_list(d1cs) - val jd1es = jsonize_list(d1es) - val json = (jd1cs, jd1es) - (* val rst = jsonval_labval2("d1cs", jd1cs, "d1es", jd1es) *) - end + jsonify("D1Elet", ("d1cs", "d1es"), + (jsonize_list(d1cs), jsonize_list(d1es)) + ) // | D1Ewhere(d1e1, d1cs) => - (* labval2(jsonize("D1Ewhere"), jnul()) // d1e1, "; ", d1cs, ")") *) - jsonify("D1Ewhere", ("d1e1", "d1cs"), rst) where - val jd1e1 = jsonize(d1e1) - val jd1cs = jsonize_list(d1cs) - val rst = (jd1e1, jd1cs) - end + jsonify("D1Ewhere", ("d1e1", "d1cs"), + (jsonize(d1e1), jsonize_list(d1cs)) + ) // | D1Eif0(d1e1, d1e2, opt3) => - (* labval2(jsonize("D1Eif0"), jnul()) // d1e1, "; ", d1e2, "; ", opt3, ")") *) - jsonify("D1Eif0", ("d1e1", "d1e2", "opt3"), rst) where - val jd1e1 = jsonize(d1e1) - val jd1e2 = jsonize(d1e1) - val jopt3 = jstr("...") - val rst = (jd1e1, jd1e2, jopt3) - end + jsonify("D1Eif0", ("d1e1", "d1e2", "opt3"), + (jsonize(d1e1), jsonize(d1e2), jsonize("...")) + ) // | D1Ecase(knd, d1e1, dcls) => - (* labval2(jsonize("D1Ecase"), jnul()) // knd, "; ", d1e1, "; ", dcls , ")") *) - jsonify("D1Ecase", ("knd", "d1e1", "dcls"), rst) where - val jknd = jsonize(knd) - val jd1e1 = jsonize(d1e1) - val jdcls = jstr("...") // list(d1clau) - val rst = (jknd, jd1e1, jdcls) - end + jsonify("D1Ecase", ("knd", "d1e1", "dcls"), + (jsonize(knd), jsonize(d1e1), jsonize("...")) + ) // | D1Elam (knd, farg, tres, arrw, body) => - (* labval2(jsonize("D1Elam"), jnul()) // knd, "; ", farg, "; ", tres, "; ", arrw, "; ", body, ")") *) - jsonify("D1Elam", ("knd", "farg", "tres", "arrw", "body"), rst) where - val jknd = jsonize(knd) - val jfarg = jnul() - val jtres = jnul() - val jarrw = jnul() - val jbody = jnul() - val rst = (jknd, jfarg, jtres, jarrw, jbody) - end + jsonify("D1Elam", ("knd", "farg", "tres", "arrw", "body"), + (jsonize(knd), jsonize("..."), jsonize("..."), jsonize("..."), jsonize("...")) + ) | D1Efix (knd, fid, farg, tres, arrw, body) => - (* labval2(jsonize("D1Efix"), jnul()) // knd, "; ", fid, "; ", farg, "; ", tres, "; ", arrw, "; ", body, ")") *) - jsonify("D1Efix", ("knd", "fid", "farg", "tres", "arrw", "body"), rst) where - val jknd = jsonize(knd) - val jfid = jnul() - val jfarg = jnul() - val jtres = jnul() - val jarrw = jnul() - val jbody = jnul() - val rst = (jknd, jfid, jfarg, jtres, jarrw, jbody) - end - + jsonify( + "D1Efix", ("knd", "fid", "farg", "tres", "arrw", "body"), ( + jsonize(knd), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("..."), + jsonize("...") + ) + ) // -| D1Eanno(d1e1, s1e2) => - ( - (* labval2(jsonize("D1Eanno"), jnul()) // d1e1, "; ", s1e2, ")") *) - jsonify("D1Eanno", ("d1e1", "s1e2"), rst) where - val js1e2 = jstr("...") - val rst = (jsonize(d1e1), js1e2) - end +| D1Erecord(tok, ld1es) => + jsonify ( + "D1Erecord", ("tok", "ld1es"), + (jsonize(tok), jsonize("...")) + ) +| D1Erecord(tok, ld1es1, ld1es2) => + jsonify ( + "D1Erecord", ("tok", "ld1es1", "ld1es2"), + (jsonize(tok), jsonize("..."), jsonize("...")) ) +| D1Eanno(d1e1, s1e2) => + jsonify("D1Eanno", ("d1e1", "s1e2"), (jsonize(d1e1), jsonize("..."))) // | D1Equal(tok1, d1e2) => - ( - (* labval2(jsonize("D1Equal"), jnul()) // tok1, "; ", d1e2, ")") *) - jsonify("D1Equal", ("tok1", "d1e2"), rst) where - val rst = (jsonize(tok1), jsonize(d1e2)) - end - - ) + jsonify("D1Equal", ("tok1", "d1e2"), (jsonize(tok1), jsonize(d1e2))) // | D1Enone((*void*)) => jsonize("D1Enone") // ")") // ) (* jsonize_d1exp *) -end +} implement jsonize_d1ecl - (x0) = jnul() + (x0) = jsonize("...") (* ( case+ x0.node() of diff --git a/contrib/sparverius/xjsonize/DATS/dynexp2.dats b/contrib/sparverius/xjsonize/DATS/dynexp2.dats index 7340bb5ce..839f7d72a 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp2.dats @@ -535,8 +535,11 @@ case- x0.node() of ) // -| D2Cvardecl(knd, v2ds) => - jsonify("D2Cvardecl", ("knd", "v2ds"), (jsonize(knd), jsonize("..."))) +| D2Cvardecl(knd, mopt, v2ds) => + jsonify( + "D2Cvardecl", ("knd", "mopt", "v2ds"), + (jsonize(knd), jsonize(mopt), jsonize("...")) + ) // | D2Cimpdecl1 ( knd, mopt, sqas, tqas diff --git a/contrib/sparverius/xjsonize/DATS/intrep0.dats b/contrib/sparverius/xjsonize/DATS/intrep0.dats index a9f9a6111..709567068 100644 --- a/contrib/sparverius/xjsonize/DATS/intrep0.dats +++ b/contrib/sparverius/xjsonize/DATS/intrep0.dats @@ -38,53 +38,29 @@ jsonize_ir0pat ( case+ x0.node() of // +| IR0Pnil() => + jsonify("IR0Pnil") + | IR0Pint(tok) => - (* fprint!(out, "IR0Pint(", tok, ")") *) jsonify("IR0Pint", "tok", jsonize(tok)) | IR0Pbtf(tok) => - (* fprint!(out, "IR0Pbtf(", tok, ")") *) jsonify("IR0Pbtf", "tok", jsonize(tok)) // | IR0Pany() => - (* fprint!(out, "IR0Pany(", ")") *) jsonify("IR0Pany") | IR0Pvar(d2v) => - (* fprint!(out, "IR0Pvar(", d2v, ")") *) jsonify("IR0Pvar", "d2v", jsonize(d2v)) // | IR0Pcapp(d2c0, irps) => -(* - fprint! - ( out - , "IR0Pcapp(", d2c0, "; ", irps, ")") -*) - jsonify("IR0Pcapp", ("d2c0", "irps"), rst) where - val jd2c0 = jsonize(d2c0) - val jirps = jstr("...") - val rst = (jd2c0, jirps) - end + jsonify("IR0Pcapp", ("d2c0", "irps"), (jsonize(d2c0), jsonize("..."))) // | IR0Ptuple(knd, irps) => - (* fprint! *) - (* ( out *) - (* , "IR0Ptuple(", knd, "; ", irps, ")") *) - jsonify("IR0Ptuple", ("knd", "irps"), rst) where - val jd2c0 = jsonize(knd) - val jirps = jstr("...") - val rst = (jd2c0, jirps) - end - + jsonify("IR0Ptuple", ("knd", "irps"), (jsonize(knd), jsonize("..."))) // | IR0Pnone0() => - (* fprint!(out, "IR0Pnone0(", ")") *) - jsonify("IR0Pnone0") - // end of [IR0Pnone0] + jsonify("IR0Pnone0") | IR0Pnone1(d3p) => - (* fprint!(out, "IR0Pnone1(", d3p, ")") *) - jsonify("IR0Pnone1", "d3p", rst) where - val rst = jstr("...") - end - // end of [IR0Pnone1] + jsonify("IR0Pnone1", "d3p", jsonize("...")) // ) @@ -97,15 +73,7 @@ jsonize_ir0arg let val+IR0ARGsome(npf, irps) = x0 in -(* -fprint! -(out, "IR0ARGsome(", npf, "; ", irps, ")") -*) -jsonify("IR0ARGsome", ("npf", "irps"), rst) where - val jnpf = jsonize(npf) - val jirps = jsonize_list(irps) - val rst = (jnpf, jirps) -end +jsonify("IR0ARGsome", ("npf", "irps"), (jsonize(npf), jsonize_list(irps))) end @@ -132,150 +100,55 @@ x0.node() of jsonval_labval2("node", jsonize("IR0Eint"), "val", JSONlist(list_nil())) (* jsonize("IR0Eint") //, tok, ")") *) | IR0Ebtf(tok) => - (* jsonize("IR0Ebtf") //, tok, ")") *) jsonify("IR0Ebtf", "tok", jsonize(tok)) (* | IR0Eflt(tok) => jsonize("IR0Eflt") //, tok, ")") *) | IR0Estr(tok) => - (* let val _ = $showtype(tok) in *) - (* jsonize("IR0Estr") //, tok, ")") *) jsonify("IR0Estr", "tok", jsonize(tok)) - (* end *) // | IR0Evar(d2v) => - (* jsonize("IR0Evar") //, d2v, ")") *) jsonify("IR0Evar", "d2v", jsonize(d2v)) // | IR0Econ1(d2c) => - (* jsonize("IR0Econ1") //, d2c, ")") *) - (* where *) - (* val _ = $showtype(d2c) *) - (* end *) jsonify("IR0Econ1", "d2c", jsonize(d2c)) | IR0Ecst1(d2c) => - (* jsonize("IR0Ecst1") //, d2c, ")") *) jsonify("IR0Ecst1", "d2c", jsonize(d2c)) // | IR0Efcst(d2c) => - (* jsonize("IR0Efcst") //, d2c, ")") *) jsonify("IR0Efst1", "d2c", jsonize(d2c)) // | IR0Etcst (d2c1, ti3a, ti2s) => - (* jsonize("IR0Etcst") //, d2c1, "; ", ti3a, "; [", ti2s, "])") *) - (* jsonify("IR0Etcst", ("d2c1", "ti3a", "ti2s"), rst) where *) - jsonify("IR0Etcst", args, rst) where - val args = ( - "d2c1", - "ti3a", - "ti2s" - ) - val rst = ( - fst, - snd, - thd - ) where - val fst = jsonize(d2c1) - val snd = jsonize(ti3a) //jstr("...") - (* val _ = $showtype(ti3a) *) - val _ = $showtype(ti2s) - val thd = jstr("...") - end - end + + jsonify("IR0Etcst", ("d2c1", "ti3a", "ti2s"), + (jsonize(d2c1), jsonize(ti3a), jsonize("...")) + ) + where val _ = $showtype(ti2s) end | IR0Etimp ( ire1 , targ, irc2, tsub) => - (* jsonize("IR0Etimp") //, ire1, "; [", targ, "]; ", irc2, "; [", tsub, "])") *) - jsonify("IR0Etimp", args, rst) where - (* val _ = $showtype(irc2) *) - val args = ( - "ire1", - "targ", - "irc2", - "tsub" + jsonify( + "IR0Etimp", ("ire1", "targ", "irc2", "tsub"), + ( + jsonize(ire1), + jsonize_list(targ), + jsonize(irc2), + jsonize_list(tsub) ) - val rst = ( - fst, - snd, - thd, - frh - ) where - val fst = jsonize(ire1) - val snd = jsonize_list(targ) - val thd = jsonize(irc2) - val frh = jsonize_list(tsub) - end - end + ) // | IR0Edapp (irf0, npf1, ires) => -(* - let - (* val _ = $showtype(irf0) *) - (* val _ = $showtype(npf1) // int *) - (* val _ = $showtype(ires) // int *) - val json_irf0 = jsonize(irf0) - val json_npf1 = jsonize(npf1) - val ires0 = list_map(ires) where - implement - list_map$fopr(x) = jsonize(x) - end - val ires0 = list_of_list_vt(ires0) - val json_ires = JSONlist(ires0) - val xys0 = - list_cons(json_irf0, list_cons(json_npf1, list_cons(json_ires, list_nil()))) - in - (* jsonize("IR0Edapp") //, irf0, "; ", npf1, "; [", ires, "])") *) - jsonval_labval2("node", jsonize("IR0Edapp"), "val", JSONlist(xys0)) - end -*) - (* jsonify("IR0Edapp", ("irf0", "npf1", "ires"), rst) where *) - (* val jirf0 = jsonize(irf0) *) - (* val jnpf1 = jsonize(npf1) *) - (* val jires = jsonize_list(ires) *) - (* val rst = (jirf0, jnpf1, jires) *) - (* end *) - jsonify("IR0Edapp", args, rst) where - val args = ( - "irf0", - "npf1", - "ires" - ) - val rst = ( - fst, - snd, - thd - ) where - val fst = jsonize(irf0) - val snd = jsonize(npf1) - val thd = jsonize_list(ires) - end - end - - + jsonify("IR0Edapp", ("irf0", "npf1", "ires"), (jsonize(irf0), jsonize(npf1), jsonize_list(ires))) // | IR0Eproj (ire1, lab2, idx2) => - (* jsonize("IR0Eproj") //, ire1, "; ", lab2, "; ", idx2, ")") *) - jsonify("IR0Eproj", args, rst) where - val args = ( - "ire1", - "lab2", - "idx2" - ) - val rst = (fst,snd,thd) where - val fst = jsonize(ire1) - (* val _ = $showtype(idx2) *) - val snd = jsonize(lab2) - val thd = jsonize(idx2) - end - end + jsonify("IR0Eproj", ("ire1", "lab2", "idx2"), (jsonize(ire1), jsonize(lab2), jsonize(idx2))) // | IR0Elet(irds, ire1) => - (* jsonize("IR0Elet") //, irds, "; ", ire1, ")") *) jsonify("IR0Elet", args, rst) where (* val _ = $showtype(irds) *) val args = ( @@ -322,6 +195,9 @@ x0.node() of (* val _ = $showtype(ires) *) end end +| IR0Eassgn(irel, irer) => + jsonify("IR0Eassgn", ("irel", "irer"), (jsonize(irel), jsonize(irer))) + // | IR0Eif0 @@ -396,6 +272,13 @@ x0.node() of end end // +| IR0Eaddr(ire1) => + jsonify("IR0Eaddr", "ire1", jsonize(ire1)) +| IR0Eflat(ire1) => + jsonify("IR0Eflat", "ire1", jsonize(ire1)) +| IR0Etalf(ire1) => + jsonify("IR0Etalf", "ire1", jsonize(ire1)) +// | IR0Enone0() => ( jsonize("IR0Enone0") //, ")") @@ -494,6 +377,7 @@ implement jsonize_val = jsonize_sq2arg implement jsonize_val = jsonize_ti2arg implement jsonize_val = jsonize_ir0arg implement jsonize_val = jsonize_ir0valdecl +implement jsonize_val = jsonize_ir0vardecl implement jsonize_ir0dcl(x0) = @@ -545,16 +429,16 @@ case+ x0.node() of val rst = (jhead, jbody) end // +| IR0Cvardecl + (knd, mopt, irds) => + jsonify("IR0Cvardecl", ("knd", "mopt", "irds"), + (jsonize(knd), jsonize("..."), jsonize_list(irds)) + ) | IR0Cvaldecl (knd, mopt, irds) => - (* fprint!(out,"IR0Cvaldecl(", knd, "; ", mopt, "; ", irds, ")") *) - jsonify("IR0Cvaldecl", ("knd", "mopt", "irds"), rst) where - val jknd = jsonize(knd) - (* val _ = $showtype(mopt) *) - val jmopt = jstr("...") - val jirds = jsonize_list(irds) - val rst = (jknd, jmopt, jirds) - end + jsonify("IR0Cvaldecl", ("knd", "mopt", "irds"), + (jsonize(knd), jsonize("..."), jsonize_list(irds)) + ) // | IR0Cfundecl (knd, mopt, tqas, irds) => @@ -602,6 +486,17 @@ case+ x0.node() of ) // end of jsonize_ +implement +jsonize_ir0vardecl + (x0) = let +// +val+IR0VARDECL(rcd) = x0 +// +in + jsonify ("IR0VARDECL", ("d2v", "ini"), (jsonize(rcd.d2v), jsonize("..."))) + (* , rcd.ini *) +end // end of [fprint_ir0vardecl] + implement jsonize_ir0valdecl diff --git a/contrib/sparverius/xjsonize/DATS/json.dats b/contrib/sparverius/xjsonize/DATS/json.dats index 2a53c5502..e9485bf8f 100644 --- a/contrib/sparverius/xjsonize/DATS/json.dats +++ b/contrib/sparverius/xjsonize/DATS/json.dats @@ -426,6 +426,22 @@ implement{a} jsonize_list(xs) = JSONlist(res) where val res = list_of_list_vt{jsonval}(xys) } + +implement{a} jsonize_option(xs) = +( + case+ xs of + | None() => jsonize("None") + | Some(x) => jsonval_labval1("Some", jsonize_val(x)) +) + +implement{a} jsonize_option_vt(xs) = +( + case+ xs of + | ~None_vt() => jsonize("None") + | ~Some_vt(x) => jsonval_labval1("Some_vt", jsonize_val(x)) +) + + (* implement(a:t@ype) jsonize_list(xs) = JSONlist(res) where { @@ -642,4 +658,34 @@ jsonval_labval1(guard_name, rst) where val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6, json.7, json.8)) end +implement jsonify10 (guard_name, names, json) = +jsonval_labval1(guard_name, rst) where +(* + val rst = jsonval_labval8 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4, + names.5, json.5, + names.6, json.6, + names.7, json.7 + ) +*) + val lst = $list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4), + (names.5, json.5), + (names.6, json.6), + (names.7, json.7), + (names.8, json.8), + (names.9, json.9) +) + val rst = JSONlablist(lst) + val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6, json.7, json.8, json.9)) +end + (* implement jsonify(guard_name: string, args: List(@(string, json))): jsonval = *) diff --git a/contrib/sparverius/xjsonize/DATS/statyp2.dats b/contrib/sparverius/xjsonize/DATS/statyp2.dats index 8ad60f53c..97fa9f379 100644 --- a/contrib/sparverius/xjsonize/DATS/statyp2.dats +++ b/contrib/sparverius/xjsonize/DATS/statyp2.dats @@ -47,7 +47,7 @@ x0.node() of // | T2Pbas(sym) => (* fprint!(out, "T2Pbas(", sym, ")") *) - jsonify("T2Pbas", "sym", $SYM.jsonize_symbol(sym)) + jsonify("T2Pbas", "sym", jsonize(sym)) (* where val _ = $showtype(sym) end *) | T2Pcst(s2c) => (* fprint!(out, "T2Pcst(", s2c, ")") *) @@ -89,138 +89,59 @@ x0.node() of end // | T2Papp(t2p1, t2ps) => - (* fprint!(out, "T2Papp(", t2p1, "; ", t2ps, ")") *) - jsonify("T2Papp", args, rst) where - val args = ( - "t2p1", - "t2ps" - ) - val rst = ( - fst, - snd - ) where - val fst = jsonize(t2p1) - val snd = jsonize_list(t2ps) - end - end + jsonify( + "T2Papp", ("t2p1", "t2ps"), + (jsonize(t2p1), jsonize_list(t2ps)) + ) +| T2Plft(t2p1) => + jsonify("T2Plft", "t2p1", jsonize("...")) | T2Plam(s2vs, t2p1) => - (* fprint!(out, "T2Plam(", s2vs, "; ", t2p1, ")") *) - jsonify("T2Plam", args, rst) where - val args = ( - "s2vs", - "t2p1" - ) - val rst = ( - fst, - snd - ) where - val fst = jsonize_list(s2vs) - val snd = jsonize(t2p1) - end - end + jsonify( + "T2Plam", ("s2vs", "t2p1"), + (jsonize_list(s2vs),jsonize(t2p1)) + ) // | T2Pfc2(fc2) => - (* fprint! *) - (* (out, "T2Pfc2(", fc2, ")") *) jsonify("T2pfc2", "fc2", jstr("...")) | T2Pfun(fc2, npf, arg, res) => - (* fprint! *) - (* ( out, "T2Pfun(" *) - (* , fc2, "; ", npf, "; ", arg, "; ", res, ")") *) - jsonify("T2Pfun", args, rst) where - (* val _ = $showtype(fc2) *) - (* val _ = $showtype(res) *) - val args = ( - "fc2", - "npf", - "arg", - "res" + jsonify( + "T2Pfun", ("fc2", "npf", "arg", "res"), + ( + jsonize(fc2), + jsonize(npf), + jsonize_list(arg), + jsonize(res) ) - val rst = ( - fst, - snd, - thd, - frh - ) where - val fst = jsonize(fc2) - val snd = jsonize(npf) - val thd = jsonize_list(arg) - val frh = jsonize(res) - end - end - + ) // | T2Pexi(s2vs, body) => - (* fprint!(out, "T2Pexi(", s2vs, "; ", body, ")") *) - jsonify("T2Pexi", args, rst) where - (* val _ = $showtype(s2vs) *) - val args = ( - "s2vs", - "body" - ) - val rst = ( - fst, - snd - ) where - val fst = jsonize_list(s2vs) - val snd = jsonize(body) - end - end + jsonify( + "T2Pexi", ("s2vs","body"), + (jsonize_list(s2vs), jsonize(body)) + ) | T2Puni(s2vs, body) => - (* fprint!(out, "T2Puni(", s2vs, "; ", body, ")") *) - jsonify("T2Puni", args, rst) where - val args = ( - "s2vs", - "body" - ) - val rst = ( - fst, - snd - ) where - val fst = jsonize_list(s2vs) - val snd = jsonize(body) - end - end + jsonify( + "T2Puni", ("s2vs","body"), + (jsonize_list(s2vs), jsonize(body)) + ) // | T2Ptyext(tnm1, t2ps) => - (* fprint!(out, "T2Ptyext(", tnm1, "; ", t2ps, ")") *) - jsonify("T2Ptyext", args, rst) where - val args = ( - "tnm1", - "t2ps" - ) - val rst = ( - fst, - snd - ) where - val fst = jsonize(tnm1) - val snd = jsonize_list(t2ps) - end - end// + jsonify( + "T2Ptyext", ("tnm1", "t2ps"), + (jsonize(tnm1), jsonize_list(t2ps)) + ) | T2Ptyrec(knd1, npf2, lt2ps) => - (* fprint! *) - (* ( out *) - (* , "T2Ptyrec(", knd1, "; ", npf2, "; ", lt2ps, ")") *) - jsonify("T2Ptyrec", args, rst) where - val args = ( - "knd", - "npf2", - "lt2ps" - ) - val rst = ( - fst, - snd, - thd - ) where - (* val _ = $showtype(knd1) *) - val fst = jstr("...")//jsonize(knd1) - val snd = jsonize(npf2) - val thd = jsonize_list(lt2ps) - end - end// + jsonify( + "T2Ptyrec", ("knd1", "npf2", "lt2ps"), + ( + jsonize((*knd1*)"..."), + jsonize(npf2), + jsonize_list(lt2ps) + ) + ) // | T2Pnone0() => //fprint!(out, "T2Pnone0(", ")") jsonify("T2Pnone0") @@ -239,6 +160,6 @@ jsonize_labt2ype ( case+ lt2p of | TLABELED(l0, t2p) => //fprint!(out, l0, "=", t2p) - jsonify("TLABELED", ("l0", "t2p"), ($LAB.jsonize_label(l0), jsonize(t2p))) + jsonify("TLABELED", ("l0", "t2p"), (jsonize(l0), jsonize(t2p))) (* where val _ = $showtype(l0) end *) ) (* end of [fprint_labt2ype] *) diff --git a/contrib/sparverius/xjsonize/SATS/dynexp0.sats b/contrib/sparverius/xjsonize/SATS/dynexp0.sats index 0e29ce41e..a3a568d96 100644 --- a/contrib/sparverius/xjsonize/SATS/dynexp0.sats +++ b/contrib/sparverius/xjsonize/SATS/dynexp0.sats @@ -3,16 +3,9 @@ #staload "./json.sats" -(* fun{a:type} -jsonize_dl0abeled : jsonize_type(dl0abled(a)) -*) +jsonize_dl0abeled : jsonize_type(dl0abeled(a)) -fun -jsonize_decmodopt: jsonize_type(decmodopt) -overload jsonize with jsonize_decmodopt - -(* fun jsonize_q0arg : jsonize_type(q0arg) overload jsonize with jsonize_q0arg @@ -133,6 +126,10 @@ fun jsonize_signint : jsonize_type(signint) overload jsonize with jsonize_signint +fun +jsonize_abstdf0 : jsonize_type(abstdf0) +overload jsonize with jsonize_abstdf0 + fun jsonize_g0expdef : jsonize_type(g0expdef) overload jsonize with jsonize_g0expdef @@ -144,4 +141,3 @@ overload jsonize with jsonize_d0macdef fun jsonize_wd0eclseq : jsonize_type(wd0eclseq) overload jsonize with jsonize_wd0eclseq -*) diff --git a/contrib/sparverius/xjsonize/SATS/intrep0.sats b/contrib/sparverius/xjsonize/SATS/intrep0.sats index fc41fcabc..43b091387 100644 --- a/contrib/sparverius/xjsonize/SATS/intrep0.sats +++ b/contrib/sparverius/xjsonize/SATS/intrep0.sats @@ -27,6 +27,10 @@ fun jsonize_ir0gpat : jsonize_type(ir0gpat) overload jsonize with jsonize_ir0gpat +fun +jsonize_ir0vardecl : jsonize_type(ir0vardecl) +overload jsonize with jsonize_ir0vardecl + fun jsonize_ir0valdecl : jsonize_type(ir0valdecl) overload jsonize with jsonize_ir0valdecl diff --git a/contrib/sparverius/xjsonize/SATS/json.sats b/contrib/sparverius/xjsonize/SATS/json.sats index b6ad5a95b..b3e4efc3b 100644 --- a/contrib/sparverius/xjsonize/SATS/json.sats +++ b/contrib/sparverius/xjsonize/SATS/json.sats @@ -199,6 +199,8 @@ symintr labify fun{a:t@ype} jsonize_val: (a) -> jsonval fun{a:t@ype} jsonize_list: (List(a)) -> jsonval +fun{a:t@ype} jsonize_option: (Option(a)) -> jsonval +fun{a:t@ype} jsonize_option_vt: (Option_vt(a)) -> jsonval fun jsonize_int(x:int): jsonval @@ -259,6 +261,7 @@ typedef str_arg6 = (string, string, string, string, string, string) typedef str_arg7 = (string, string, string, string, string, string, string) typedef str_arg8 = (string, string, string, string, string, string, string, string) typedef str_arg9 = (string, string, string, string, string, string, string, string, string) +typedef str_arg10 = (string, string, string, string, string, string, string, string, string, string) typedef json_arg2 = (jsonval, jsonval) typedef json_arg3 = (jsonval, jsonval, jsonval) @@ -268,6 +271,7 @@ typedef json_arg6 = (jsonval, jsonval, jsonval, jsonval, jsonval, jsonval) typedef json_arg7 = (jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval) typedef json_arg8 = (jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval) typedef json_arg9 = (jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval) +typedef json_arg10 = (jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval, jsonval) fun jsonify0 (guard_name: string): jsonval fun jsonify1 (guard_name: string, arg_name: string, arg_json: jsonval): jsonval @@ -279,6 +283,7 @@ fun jsonify6 (guard_name: string, arg_names: str_arg6, arg_json: json_arg6): jso fun jsonify7 (guard_name: string, arg_names: str_arg7, arg_json: json_arg7): jsonval fun jsonify8 (guard_name: string, arg_names: str_arg8, arg_json: json_arg8): jsonval fun jsonify9 (guard_name: string, arg_names: str_arg9, arg_json: json_arg9): jsonval +fun jsonify10 (guard_name: string, arg_names: str_arg10, arg_json: json_arg10): jsonval overload jsonify with jsonify0 overload jsonify with jsonify1 @@ -290,4 +295,5 @@ overload jsonify with jsonify6 overload jsonify with jsonify7 overload jsonify with jsonify8 overload jsonify with jsonify9 +overload jsonify with jsonify10 (* fun jsonify(guard_name: string, List(@(string, json))): jsonval *) From f6663241d7c0883ecf6493037c1014f3447ce101 Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 11 Dec 2019 18:15:25 -0500 Subject: [PATCH 07/16] updating --- contrib/sparverius/xjsonize/DATS/dynexp1.dats | 81 ++++ contrib/sparverius/xjsonize/DATS/dynexp2.dats | 317 +++++++------- contrib/sparverius/xjsonize/DATS/intrep0.dats | 397 ++++++------------ contrib/sparverius/xjsonize/DATS/staexp2.dats | 16 + contrib/sparverius/xjsonize/SATS/dynexp2.sats | 4 + 5 files changed, 400 insertions(+), 415 deletions(-) diff --git a/contrib/sparverius/xjsonize/DATS/dynexp1.dats b/contrib/sparverius/xjsonize/DATS/dynexp1.dats index 416219a82..671cb3fa6 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp1.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp1.dats @@ -330,3 +330,84 @@ case+ x0.node() of // ) (* end of [jsonize_d1ecl] *) *) + + +local + +implement +jsonize_val = jsonize_d1pat + +in (* in-of-local *) + +implement +jsonize_d1pat + (x0) = +( +case+ +x0.node() of +| D1Pid(tok) => + jsonify("D1Pid", "tok", jsonize(tok)) +// +| D1Pint(tok) => + jsonify("D1Pint", "tok", jsonize(tok)) +| D1Pchr(tok) => + jsonify("D1Pchr", "tok", jsonize(tok)) +| D1Pflt(tok) => + jsonify("D1Pflt", "tok", jsonize(tok)) +| D1Pstr(tok) => + jsonify("D1Pstr", "tok", jsonize(tok)) +// +| D1Papp() => + jsonify("D1Papp") +// +| D1Pbs0() => + jsonify("D1Pbs0") +| D1Pbs1(d1p) => + jsonify("D1Pbs1", "d1p", jsonize(d1p)) +// +| D1Papp1(d1p0, d1p1) => + jsonify("D1Papps", ("d1p0", "d1p1"), (jsonize(d1p0), jsonize(d1p1))) +| D1Papp2(d1p0, d1p1, d1p2) => + jsonify("D1Papps", ("d1p0", "d1p1", "d1p2"), (jsonize(d1p0), jsonize(d1p1), jsonize(d1p2))) +// +| D1Psarg(s1as) => + jsonify("D1Psarg", "s1as", jsonize("...")) +// +| D1Plist(d1ps) => + jsonify("D1Plist1", "d1ps", jsonize("...")) +| D1Plist(d1ps1, d1ps2) => + jsonify("D1Plist2", ("d1ps1", "d1ps2"), (jsonize("..."), jsonize("..."))) +// +| D1Ptuple(tok, d1ps) => + jsonify("D1Ptuple1", ("tok", "d1ps"), (jsonize(tok), jsonize("..."))) +| D1Ptuple(tok, d1ps1, d1ps2) => + jsonify("D1Ptuple2", ("tok", "d1ps1", "d1ps2"), (jsonize(tok), jsonize("..."), jsonize("..."))) +// +| D1Precord(tok, ld1ps) => + jsonify("D1Precord1", ("tok", "ld1ps"), (jsonize(tok), jsonize("..."))) +| D1Precord(tok, ld1ps1, ld1ps2) => + jsonify("D1Precord2", ("tok", "ld1ps1", "ld1ps2"), (jsonize(tok), jsonize("..."), jsonize("..."))) +// +| D1Panno(d1p, s1e) => + jsonify("D1Panno", ("d1p", "s1e"), (jsonize(d1p), jsonize(s1e))) +// +| D1Pnone((*void*)) => + jsonify("D1Pnone") +// +) (* end of [fprint_d1pat] *) + +end // end of [local] + + +implement jsonize_val = jsonize_s1exp + +implement +jsonize_f1unarrow + (x0) = +( +case+ x0 of +| F1UNARROWdflt() => + jsonify("F1UNARROWdflt") +| F1UNARROWlist(s1es) => + jsonify("F1UNARROWlist", "s1es", jsonize_list(s1es)) +) (* end of [fprint_f1unarrow] *) diff --git a/contrib/sparverius/xjsonize/DATS/dynexp2.dats b/contrib/sparverius/xjsonize/DATS/dynexp2.dats index 839f7d72a..b8c8b2f85 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp2.dats @@ -21,8 +21,9 @@ #staload "./../SATS/dynexp0.sats" #staload "./../SATS/staexp0.sats" #staload "./../SATS/lexing.sats" -#staload D1 = "./../SATS/dynexp1.sats" +#staload "./../SATS/dynexp1.sats" #staload "./../SATS/label0.sats" + #staload "./../SATS/dynexp2.sats" @@ -31,8 +32,8 @@ #staload SYM_J = "./../SATS/symbol.sats" #staload STM_J = "./../SATS/stamp0.sats" -overload jsonize with $D1.jsonize_d1exp -overload jsonize with $D1.jsonize_d1ecl +(* overload jsonize with $D1.jsonize_d1exp *) +(* overload jsonize with $D1.jsonize_d1ecl *) overload jsonize with $SYM_J.jsonize_symbol overload jsonize with $STM_J.jsonize_stamp @@ -148,45 +149,14 @@ case+ x0.node() of (* | F2ARGnone(tok) => - fprint!(out, "F2ARGnone(", tok, ")") + jsonize("F2ARGnone", "tok", jsonize(tok)) *) | F2ARGsome_met(s2es) => - (* labval2(jstr("f2arg"), jsonval_sing(jsonize("F2ARGsome_met"))) *) - jsonify("F2ARGsome_met", "s2es", jstr("...")) -(* - let - (* val _ = $showtype(s2es) // s2exp *) - in - ( - labval2(jstr("f2arg"), jsonval_nil()) - ) - end -*) - (* fprint!(out, "F2ARGsome_met(", s2es, ")") *) + jsonify("F2ARGsome_met", "s2es", jsonize("...")) | F2ARGsome_dyn(npf, d2ps) => - (* labval2(jstr("f2arg"), jsonval_sing(jsonize("F2ARGsome_dyn"))) *) - jsonify("F2ARGsome_dyn", ("npf", "d2ps"), (jsonize(npf), jstr("..."))) - (* fprint!(out, "F2ARGsome_dyn(", npf, "; ", d2ps, ")") *) -(* - let - (* val _ = $showtype(npf) *) - in - jnul() - end -*) - + jsonify("F2ARGsome_dyn", ("npf", "d2ps"), (jsonize(npf), jsonize("..."))) | F2ARGsome_sta(s2vs, s2ps) => - (* labval2(jstr("f2arg"), jsonval_sing(jsonize("F2ARGsome_sta"))) *) - jsonify("F2ARGsome_sta", ("s2vs", "s2ps"), (jstr("..."), jstr("..."))) - (* fprint!(out, "F2ARGsome_sta(", s2vs, "; ", s2ps, ")") *) -(* - let - (* val _ = $showtype(s2vs) *) - in - jnul() - end -*) - + jsonify("F2ARGsome_sta", ("s2vs", "s2ps"), (jsonize("..."), jsonize("..."))) ) end @@ -195,187 +165,223 @@ end implement jsonize_val = jsonize_d2pat +implement +jsonize_val = jsonize_s2var + +implement +jsonize_val = jsonize_d2pitm + implement jsonize_d2pat - (x0) = labval2(jsonize("d2pat"), res) where + (x0) = +// labval2(jsonize("d2pat"), res) where +res where val res = ( case- x0.node() of // | D2Pint(tok) => - (* fprint!(out, "D2Pint(", tok, ")") *) - labval2(jsonize("D2Pint"), jnul()) + jsonify("D2Pint", "tok", jsonize(tok)) | D2Pbtf(tok) => - labval2(jsonize("D2Pbtf"), jnul()) // tok, ")") + jsonify("D2Pbtf", "tok", jsonize(tok)) | D2Pchr(tok) => - labval2(jsonize("D2Pchr"), jnul()) // tok, ")") + jsonify("D2Pchr", "tok", jsonize(tok)) | D2Pflt(tok) => - labval2(jsonize("D2Pflt"), jnul()) // tok, ")") + jsonify("D2Pflt", "tok", jsonize(tok)) | D2Pstr(tok) => - labval2(jsonize("D2Pstr"), jnul()) // tok, ")") + jsonify("D2Pstr", "tok", jsonize(tok)) // | D2Pvar(d2v) => - labval2(jsonize("D2Pvar"), jnul()) // d2v, ")") + jsonify("D2Pvar", "d2v", jsonize(d2v)) // | D2Pcon1(d2c0) => - labval2(jsonize("D2Pcon1"), jnul()) // d2c0, ")") + jsonify("D2Pcon1", "d2c0", jsonize(d2c0)) | D2Pcon2(d2cs) => - labval2(jsonize("D2Pcon2"), jnul()) // d2cs, ")") + jsonify("D2Pcon2", "d2cs", jsonize_list(d2cs)) // | D2Psym0(sym, d2pis) => - ( - labval2(jsonize("D2Psym0"), jnul()) // sym, ")"); -(* - labval2(jsonize("D2Psym0"), jnul()) // sym, "; ", d2pis, ")"); -*) - ) + jsonify("D2Psym0", ("sym", "d2pis"), (jsonize(sym), jsonize_list(d2pis))) // | D2Psapp(d2f0, s2vs) => - labval2(jsonize("D2Psapp"), jnul()) // d2f0, "; ", s2vs, ")") + jsonify("D2Psapp", ("d2f0", "s2vs"), + (jsonize(d2f0), jsonize_list(s2vs)) + ) | D2Pdapp(d2f0, npf0, d2ps) => - labval2(jsonize("D2Pdapp"), jnul()) // d2f0, "; ", npf0, "; ", d2ps, ")") + jsonify("D2Pdapp", ("d2f0", "npf0", "d2ps"), + (jsonize(d2f0), jsonize(npf0), jsonize_list(d2ps)) + ) // | D2Ptuple(knd, npf, d2ps) => - labval2(jsonize("D2Ptuple"), jnul()) // knd, "; ", npf, "; ", d2ps, ")") + jsonify("D2Ptuple", ("knd", "npf", "d2ps"), + (jsonize(knd), jsonize(npf), jsonize_list(d2ps)) + ) // | D2Panno(d2p1, s2e2) => - labval2(jsonize("D2Panno"), jnul()) // d2p1, "; ", s2e2, ")") + jsonify("D2Panno", ("d2p1", "s2e2"), (jsonize(d2p1), jsonize(s2e2))) // | D2Pnone0() => - labval2(jsonize("D2Pnone0"), jnul()) // ")") + jsonify("D2Pnone0") | D2Pnone1(d1psrc) => - labval2(jsonize("D2Pnone1"), jnul()) // d1psrc, ")") + jsonify("D2Pnone1", "d1psrc", jsonize(d1psrc)) // ) (* end of [jsonize_d2pat] *) end - - implement jsonize_val = jsonize_d2exp +implement +jsonize_val = jsonize_d2ecl +implement +jsonize_val = jsonize_d2pitm +implement +jsonize_val = jsonize_s2exp +implement +jsonize_val = jsonize_d2clau + +implement +jsonize_val = jsonize_f2arg +implement +jsonize_val = jsonize_effs2expopt + implement jsonize_d2exp - (x0) = labval2(jsonize("d2exp"), res) where + (x0) = +// jsonify("d2exp", res) where +res where val res = ( case- x0.node() of // | D2Eint(tok) => - labval2(jsonize("D2Eint"), jsonize(tok)) // tok, ")") + jsonify("D2Eint", "tok", jsonize(tok)) | D2Ebtf(tok) => - labval2(jsonize("D2Ebtf"), jsonize(tok)) // tok, ")") + jsonify("D2Ebtf", "tok", jsonize(tok)) | D2Echr(tok) => - labval2(jsonize("D2Echr"), jsonize(tok)) // tok, ")") + jsonify("D2Echr", "tok", jsonize(tok)) | D2Eflt(tok) => - labval2(jsonize("D2Eflt"), jsonize(tok)) // tok, ")") + jsonify("D2Eflt", "tok", jsonize(tok)) | D2Estr(tok) => - labval2(jsonize("D2Estr"), jsonize(tok)) // tok, ")") + jsonify("D2Estr", "tok", jsonize(tok)) // | D2Etop(tok) => - labval2(jsonize("D2Etop"), jsonize(tok)) // tok, ")") + jsonify("D2Etop", "tok", jsonize(tok)) // | D2Evar(d2v) => - labval2(jsonize("D2Evar"), jsonize(d2v)) // d2v, ")") + jsonify("D2Evar", "d2v", jsonize(d2v)) // | D2Ecst1(d2c) => - labval2(jsonize("D2Ecst1"), jsonize(d2c)) // d2c, ")") + jsonify("D2Ecst1", "d2c", jsonize(d2c)) | D2Econ1(d2c) => - labval2(jsonize("D2Econ1"), jsonize(d2c)) // d2c, ")") + jsonify("D2Econ1", "d2c", jsonize(d2c)) | D2Ecst2(d2cs) => - labval2(jsonize("D2Ecst2"), j_d2cs) // d2cs, ")") - where - val j_d2cs = jsonize_list(d2cs) - end + jsonify("D2Ecst2", "d2cs", jsonize_list(d2cs)) | D2Econ2(d2cs) => - labval2(jsonize("D2Econ2"), j_d2cs) // d2cs, ")") - where - val j_d2cs = jsonize_list(d2cs) - end + jsonify("D2Econ2", "d2cs", jsonize_list(d2cs)) // | D2Esym0 (d1e1, dpis) => - labval2(jsonize("D2Esym0"), jnul()) // d1e1, ")") - (* where *) - (* val _ = $showtype(d1e1) *) - (* end *) - -(* - fprint! - (out, "D2Esym0"), jnul()) // d1e1, "; ", dpis, ")") -*) + jsonify("D2Esym0", ("d1e1", "dpis"), (jsonize(d1e1), jsonize_list(dpis))) // | D2Esapp (d2f0, s2as) => - labval2(jsonize("D2Esapp"), jnul()) // d2f0, "; ", s2as, ")") + jsonify("D2Esapp", ("d2f0", "s2as"), (jsonize(d2f0), jsonize_list(s2as))) | D2Etapp (d2f0, s2as) => - labval2(jsonize("D2Etapp"), jnul()) // d2f0, "; ", s2as, ")") + jsonify("D2Etapp", ("d2f0", "s2as"), (jsonize(d2f0), jsonize_list(s2as))) | D2Edapp (d2f0, npf0, d2as) => - labval2(jsonize("D2Edapp"), jnul()) // d2f0, "; ", npf0, "; ", d2as, ")") + jsonify( + "D2Edapp", ("d2f0", "npf0", "d2as"), + (jsonize(d2f0), jsonize(npf0), jsonize_list(d2as))) // | D2Elet (d2cs, d2e2) => - labval2(jsonize("D2Elet"), jnul()) // d2cs, "; ", d2e2, ")") + jsonify("D2Elet", ("d2cs", "d2e2"), (jsonize_list(d2cs), jsonize(d2e2))) | D2Ewhere (d2e1, d2cs) => - labval2(jsonize("D2Ewhere"), jnul()) // d2e1, "; ", d2cs, ")") + jsonify("D2Ewhere", ("d2e1", "d2cs"), (jsonize(d2e1), jsonize_list(d2cs))) // | D2Eseqn (d2es, d1e1) => - labval2(jsonize("D2Eseqn"), jnul()) // d2es, "; ", d1e1(*last*), ")") + jsonify("D2Eseqn", ("d2es", "d1e1"(*last*)), + (jsonize_list(d2es), jsonize(d1e1))) // | D2Etuple (knd, npf, d2es) => - labval2(jsonize("D2Etuple"), jnul()) // knd, "; ", npf, "; ", d2es, ")") + jsonify("D2Etuple", ("knd", "npf", "d2es"), + (jsonize(knd), jsonize(npf), jsonize_list(d2es))) // | D2Eassgn (d2e1, d2e2) => - labval2(jsonize("D2Eassgn"), jnul()) // d2e1, "; ", d2e2, ")") + jsonify("D2Eassgn", ("d2e1", "d2e2"), (jsonize(d2e1), jsonize(d2e2))) // | D2Edtsel - ( lab0 - , dpis, npf2, arg3) => + (lab0, dpis, npf2, arg3) => ( - case+ - arg3 of - | - None() => - labval2(jsonize("D2Edtsel"), jnul()) // lab0, "(", dpis, ")", ")") - | - Some(d2es) => - labval2(jsonize("D2Edtsel"), jnul()) // lab0, "(", dpis, ")", "(", npf2, "; ", d2es, ")", ")") + case+ arg3 of + | None() => + jsonify("D2Edtsel", ("lab0", "dpis"), (jsonize(lab0), jsonize_list(dpis))) + | Some(d2es) => + jsonify("D2Edtsel", ("lab0", "dpis", "npf2", "d2es"), + ( + jsonize(lab0), + jsonize_list(dpis), + jsonize(npf2), + jsonize_list(d2es) + ) + ) ) // | D2Eif0 (d2e1, d2e2, opt3) => - labval2(jsonize("D2Eif0"), jnul()) // d2e1, "; ", d2e2, "; ", opt3, ")") + jsonify("D2Eif0", ("d2e1", "d2e2", "opt3"), + (jsonize(d2e1), jsonize(d2e2), jsonize_option(opt3))) // | D2Ecase (knd, d2e1, d2cls) => - labval2(jsonize("D2Ecase"), jnul()) // knd, "; ", d2e1, "; ", d2cls, ")") + jsonify("D2Ecase", ("knd", "d2e1", "d2cls"), + (jsonize(knd), jsonize(d2e1), jsonize_list(d2cls))) // | D2Elam (knd, f2as, tres, arrw, body) => - labval2(jsonize("D2Elam"), jnul()) // knd, "; ", f2as, "; ", tres, "; ", arrw, "; ", body, ")") + jsonify("D2Elam", ("knd", "f2as", "tres", "arrw", "body"), + ( + jsonize(knd), + jsonize_list(f2as), + jsonize(tres), + jsonize(arrw), + jsonize(body) + ) + ) | D2Efix (knd, fid, f2as, tres, arrw, body) => - labval2(jsonize("D2Efix"), jnul()) // knd, "; ", fid, "; ", f2as, "; ", tres, "; ", arrw, "; ", body, ")") + jsonify("D2Efix", ("knd", "fid", "f2as", "tres", "arrw", "body"), + ( + jsonize(knd), + jsonize(fid), + jsonize_list(f2as), + jsonize(tres), + jsonize(arrw), + jsonize(body) + ) + ) // | D2Eaddr(d2e1) => - labval2(jsonize("D2Eaddr"), jnul()) // d2e1, ")") + jsonify("D2Eaddr", "d2e1", jsonize(d2e1)) | D2Efold(d2e1) => - labval2(jsonize("D2Efold"), jnul()) // d2e1, ")") + jsonify("D2Efold", "d2e1", jsonize(d2e1)) // | D2Eanno(d2e1, s2e2) => - labval2(jsonize("D2Eanno"), jnul()) // d2e1, "; ", s2e2, ")") + jsonify("D2Eanno", ("d2e1", "s2e2"), (jsonize(d2e1), jsonize(s2e2))) // -| D2Enone0() => labval2(jsonize("D2Enone0"), jnul()) // ")") -| D2Enone1(d1esrc) => labval2(jsonize("D2Enone1"), jnul()) // d1esrc, ")") +| D2Enone0() => + jsonify("D2Enone0") +| D2Enone1(d1esrc) => + jsonify("D2Enone1", "d1esrc", jsonize(d1esrc)) // ) end // end of where @@ -420,7 +426,7 @@ case- x0.node() of jsonize(tok), jsonize(src), jsonize(knd), - jsonize("..."), + jsonize("..."), (* jsonize_option(fopt), *) jsonize(body) ) where @@ -611,42 +617,37 @@ case- x0.node() of end // end of [local] -(* + implement -fprint_d2itm - (out, x0) = +jsonize_d2itm + (x0) = ( case+ x0 of // | D2ITMvar(d2v0) => - fprint!(out, "D2ITMvar(", d2v0, ")") + jsonify("D2ITMvar", "d2v0", jsonize(d2v0)) // | D2ITMcon(d2cs) => - fprint!(out, "D2ITMcon(", d2cs, ")") + jsonify("D2ITMcon", "d2cs", jsonize_list(d2cs)) // | D2ITMcst(d2cs) => - fprint!(out, "D2ITMcst(", d2cs, ")") + jsonify("D2ITMcst", "d2cs", jsonize_list(d2cs)) // | D2ITMsym(sym, dpis) => - fprint! - (out, "D2ITMsym(", sym, "; ", dpis, ")") -// -) (* end of [fprint_d2itm] *) + jsonify("D2ITMsym", ("sym", "dpis"), (jsonize(sym), jsonize_list(dpis))) // +) (* end of [jsonize_d2itm] *) + implement -fprint_d2pitm - (out, x0) = +jsonize_d2pitm + (x0) = ( case+ x0 of | D2PITMnone(dqid) => - fprint!(out, "D2PITMnone(", dqid, ")") + jsonify("D2PITMnone", "dqid", jsonize(dqid)) | D2PITMsome(pval, d2i0) => - fprint! - (out, "D2PITMsome(", pval, "; ", d2i0, ")") -) -*) - - + jsonify("D2PITMsome", ("pval", "d2i0"), (jsonize(pval), jsonize(d2i0))) +) (* end of [jsonize_d2pitm] *) local @@ -661,7 +662,7 @@ jsonize_sq2arg (x0) = ( jsonval_labval1("sq2arg", jsonize_list(x0.s2vs())) -) (* end of [fprint_sq2arg] *) +) (* end of [jsonize_sq2arg] *) end @@ -670,8 +671,7 @@ implement jsonize_tq2arg (x0) = ( - (* fprint!(out, "<", x0.s2vs(), ">") *) - jsonval_labval1("tq2arg", jstr("...")) + jsonval_labval1("tq2arg", jsonize(x0)) ) (* end of [jsonize_tq2arg] *) @@ -679,17 +679,15 @@ implement jsonize_ti2arg (x0) = ( - jsonify("ti2arg", "s2es", rst) - where - val rst = jsonize("...") - (* val _ = $showtype(x0.s2es()) *) - end + jsonify("ti2arg", "s2es", jsonize("...")) + (* where val _ = $showtype(x0.s2es()) end *) ) (* end of [jsonize_ti2arg] *) local -implement jsonize_val = jsonize_d2cst +implement +jsonize_val = jsonize_d2cst in @@ -705,10 +703,35 @@ IMPLD2CST1(dqid, d2cs) => ) | IMPLD2CST2(dqid, d2cs, opt2) => - jsonify("IMPLD2CST2", ("d2qid", "d2cs", "opt"), ( - jsonize(dqid), jsonize_list(d2cs), jstr("...") + jsonify("IMPLD2CST2", ("d2qid", "d2cs", "opt2"), ( + jsonize(dqid), jsonize_list(d2cs), jsonize_option(opt2) ) ) ) // end of [fprint_impld2cst] end + + +implement +jsonize_d2clau + (x0) = +( +case+ +x0.node() of +| D2CLAUpat(d2gp) => + jsonify("D2CLAUpat", "d2gp", jsonize(d2gp)) +| D2CLAUexp(d2gp, d0e0) => + jsonify("D2CLAUexp", ("d2gp", "d0e0"), (jsonize(d2gp), jsonize(d0e0))) +) + +implement +jsonize_d2gpat + (x0) = +( +case+ +x0.node() of +| D2GPATpat(d2p) => + jsonify("D2GPATpat", "d2p", jsonize(d2p)) +| D2GPATgua(d2p, d2gs) => + jsonify("D2GPATgua", ("d2p", "d2gs"), (jsonize(d2p), jsonize("..."))) +) diff --git a/contrib/sparverius/xjsonize/DATS/intrep0.dats b/contrib/sparverius/xjsonize/DATS/intrep0.dats index 709567068..8c20e66e4 100644 --- a/contrib/sparverius/xjsonize/DATS/intrep0.dats +++ b/contrib/sparverius/xjsonize/DATS/intrep0.dats @@ -3,32 +3,31 @@ #include "./../HATS/libxatsopt.hats" -#staload "./../SATS/json.sats" -#staload _ = "./json.dats" - #define XATS_targetloc "./../../../../srcgen/xats" -(* -#staload "{$XATS}/SATS/dynexp0.sats" -#staload "{$XATS}/SATS/staexp0.sats" -*) #staload "{$XATS}/SATS/dynexp1.sats" #staload "{$XATS}/SATS/dynexp2.sats" #staload "{$XATS}/SATS/dynexp3.sats" -(* #staload "{$XATS}/SATS/staexp2.sats" *) + #staload "./../SATS/json.sats" #staload _ = "./json.dats" -#staload "./../SATS/dynexp0.sats" -#staload "./../SATS/staexp0.sats" + #staload "./../SATS/lexing.sats" -#staload "./../SATS/dynexp1.sats" #staload "./../SATS/label0.sats" -#staload "./../SATS/dynexp2.sats" -#staload "./../SATS/dynexp3.sats" + +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/dynexp0.sats" + +#staload "./../SATS/staexp1.sats" +#staload "./../SATS/dynexp1.sats" + #staload "./../SATS/statyp2.sats" #staload "./../SATS/staexp2.sats" +#staload "./../SATS/dynexp2.sats" +#staload "./../SATS/dynexp3.sats" + #staload "./../SATS/intrep0.sats" @@ -40,7 +39,6 @@ case+ x0.node() of // | IR0Pnil() => jsonify("IR0Pnil") - | IR0Pint(tok) => jsonify("IR0Pint", "tok", jsonize(tok)) | IR0Pbtf(tok) => @@ -62,7 +60,7 @@ case+ x0.node() of | IR0Pnone1(d3p) => jsonify("IR0Pnone1", "d3p", jsonize("...")) // -) +) // end of [jsonize_ir0pat] implement jsonize_val(x) = jsonize_ir0pat(x) @@ -71,10 +69,10 @@ implement jsonize_ir0arg (x0) = let -val+IR0ARGsome(npf, irps) = x0 + val+IR0ARGsome(npf, irps) = x0 in -jsonify("IR0ARGsome", ("npf", "irps"), (jsonize(npf), jsonize_list(irps))) -end + jsonify("IR0ARGsome", ("npf", "irps"), (jsonize(npf), jsonize_list(irps))) +end // end of [jsonize_ir0arg] local @@ -84,21 +82,22 @@ implement jsonize_val = jsonize_ir0dcl implement jsonize_val = jsonize_t2ype implement jsonize_val = jsonize_ir0arg +implement jsonize_val = jsonize_ti2arg + in // implement jsonize_ir0exp(x0) = - (* (x0) = jsonval_labval2("node", jsonize("ir0exp"), "val", res) where *) - (* jsonval_labval1("ir0exp", res) where *) - res where -val res = +(* + jsonval_labval1("ir0exp", res) where +*) +res where val res = ( case+ x0.node() of // | IR0Eint(tok) => - jsonval_labval2("node", jsonize("IR0Eint"), "val", JSONlist(list_nil())) - (* jsonize("IR0Eint") //, tok, ")") *) + jsonify("IR0Eint", "tok", jsonize(tok)) | IR0Ebtf(tok) => jsonify("IR0Ebtf", "tok", jsonize(tok)) (* @@ -122,14 +121,11 @@ x0.node() of // | IR0Etcst (d2c1, ti3a, ti2s) => - jsonify("IR0Etcst", ("d2c1", "ti3a", "ti2s"), - (jsonize(d2c1), jsonize(ti3a), jsonize("...")) + (jsonize(d2c1), jsonize(ti3a), jsonize_list(ti2s)) ) - where val _ = $showtype(ti2s) end | IR0Etimp - ( ire1 - , targ, irc2, tsub) => + (ire1, targ, irc2, tsub) => jsonify( "IR0Etimp", ("ire1", "targ", "irc2", "tsub"), ( @@ -142,135 +138,61 @@ x0.node() of // | IR0Edapp (irf0, npf1, ires) => - jsonify("IR0Edapp", ("irf0", "npf1", "ires"), (jsonize(irf0), jsonize(npf1), jsonize_list(ires))) + jsonify( + "IR0Edapp", ("irf0", "npf1", "ires"), + (jsonize(irf0), jsonize(npf1), jsonize_list(ires)) + ) // | IR0Eproj (ire1, lab2, idx2) => - jsonify("IR0Eproj", ("ire1", "lab2", "idx2"), (jsonize(ire1), jsonize(lab2), jsonize(idx2))) + jsonify( + "IR0Eproj", ("ire1", "lab2", "idx2"), + (jsonize(ire1), jsonize(lab2), jsonize(idx2)) + ) // | IR0Elet(irds, ire1) => - jsonify("IR0Elet", args, rst) where - (* val _ = $showtype(irds) *) - val args = ( - "irds", - "ire1" - ) - val rst = ( - fst, - snd - ) where - val fst = jsonize_list(irds) - val snd = jsonize(ire1) - end - end + jsonify( + "IR0Elet", ("irds", "ire1"), + (jsonize_list(irds), jsonize(ire1)) + ) | IR0Ewhere(ire1, irds) => - (* jsonize("IR0Ewhere") //, ire1, "; [", irds, "])") *) - jsonify("IR0Ewhere", args, rst) where - val args = ( - "ire1", - "irds" - ) - val rst = ( - fst, - snd - ) where - val fst = jsonize(ire1) - val snd = jsonize_list(irds) - end - end + jsonify("IR0Ewhere", ("ire1", "irds"), + (jsonize(ire1), jsonize_list(irds)) + ) // | IR0Etuple (knd0, npf1, ires) => - (* jsonize("IR0Etuple") //, knd0, "; ", npf1, "; [", ires, "])") *) - jsonify("IR0Etuple", args, rst) where - val args = ( - "knd0", - "npf1", - "ires" - ) - val rst = (fst,snd,thd) where - val fst = jstr("...") - val snd = jsonize(npf1) - val thd = jsonize_list(ires) - (* val _ = $showtype(ires) *) - end - end + jsonify( + "IR0Etuple", ("knd0", "npf1", "ires"), + (jsonize("..."), jsonize(npf1), jsonize_list(ires)) + ) | IR0Eassgn(irel, irer) => jsonify("IR0Eassgn", ("irel", "irer"), (jsonize(irel), jsonize(irer))) - - // | IR0Eif0 (ire1, ire2, opt3) => - (* jsonize("IR0Eif0") //, ire1, "; ", ire2, "; ", opt3, ")") *) - jsonify("IR0Eif0", args, rst) where - val args = ( - "ire1", - "ire2", - "opt3" - ) - val rst = (fst,snd,thd) where - val fst = jsonize(ire1) - val snd = jsonize(ire2) - val thd = jstr("...") - end - end + jsonify("IR0Eif0", + ("ire1", "ire2", "opt3"), + (jsonize(ire1), jsonize(ire2), jsonize("...")) + ) // | IR0Ecase (knd0, ire1, ircls) => - (* jsonize("IR0Ecase") //, knd0, "; ", ire1, "; ", "...", ")") *) - jsonify("IR0Ecase", args, rst) where - (* val _ = $showtype(ircls) *) - val args = ( - "knd0", - "ire1", - "ircls" - ) - val rst = (fst,snd,thd) where - val fst = jstr("...") - val snd = jstr("...") - val thd = jstr("...") - end - end + jsonify("IR0Ecase", ("knd0", "ire1", "ircls"), + (jsonize("..."), jsonize("..."), jsonize("...")) + ) // | IR0Elam (knd0, farg, body) => - (* jsonize("IR0Elam") //, knd0, "; [", farg, "]; ", body, ")") *) - jsonify("IR0Elam", args, rst) where - val args = ( - "knd0", - "farg", - "body" - ) - val rst = (fst,snd,thd) where - val fst = jsonize(knd0) - (* val _ = $showtype(body) *) - val snd = jsonize_list(farg) - val thd = jsonize(body) - end - end + jsonify( + "IR0Elam", ("knd0", "farg", "body"), + (jsonize(knd0), jsonize_list(farg), jsonize(body)) + ) | IR0Efix (knd0, d2v0, farg, body) => - (* jsonize("IR0Efix") //, knd0, "; ", d2v0, "; [", farg, "]; ", body, ")") *) - jsonify("IR0Efix", args, rst) where - val args = ( - "knd0", - "d2v0", - "farg", - "body" - ) - val rst = ( - fst, - snd, - thd, - frh - ) where - val fst = jstr("...") - val snd = jstr("...") - val thd = jstr("...") - val frh = jstr("...") - end - end + jsonify("IR0Efix", ("knd0", "d2v0", "farg", "body"), + (jsonize("..."), jsonize("..."), jsonize("..."), jsonize("...")) + ) // | IR0Eaddr(ire1) => jsonify("IR0Eaddr", "ire1", jsonize(ire1)) @@ -289,9 +211,9 @@ x0.node() of ) // ) -end +end // end of [jsonize_ir0exp] -end +end // end of local implement @@ -301,12 +223,8 @@ jsonize_ir0gua case+ x0.node() of | IR0GUAexp(ir0e) => - (* fprint! *) - (* (out, "IR0GUAexp(", ir0e, ")") *) jsonify("IR0GUAexp", "ir0e", jsonize(ir0e)) | IR0GUAmat(ir0e, ir0p) => - (* fprint! *) - (* (out, "IR0GUAmat(", ir0e, "; ", ir0p, ")") *) jsonify("IR0GUAmat", ("ir0e", "ir0p"), ( jsonize(ir0e), @@ -323,17 +241,11 @@ jsonize_ir0clau case+ x0.node() of // -| -IR0CLAUpat(ir0gp) => -(* fprint! *) -(* (out, "IR0CLAUpat(", ir0gp, ")") *) -jsonify("IR0CLAUpat", "ir0gp", jsonize(ir0gp)) +| IR0CLAUpat(ir0gp) => + jsonify("IR0CLAUpat", "ir0gp", jsonize(ir0gp)) // -| -IR0CLAUexp(ir0gp, d0e0) => -(* fprint! *) -(* (out, "IR0CLAUexp(", ir0gp, "; ", d0e0, ")") *) -jsonify("IR0CLAUpat", ("ir0gp", "d0e0"), (jstr("..."), jstr("..."))) +| IR0CLAUexp(ir0gp, d0e0) => + jsonify("IR0CLAUpat", ("ir0gp", "d0e0"), (jsonize("..."), jsonize("..."))) // ) (* end of [jsonize_ir0clau] *) @@ -347,27 +259,17 @@ jsonize_ir0gpat case+ x0.node() of // -| -IR0GPATpat(ir0p) => -(* fprint! *) -(* (out, "IR0GPATpat(", ir0p, ")") *) -jsonify("IR0GPATpat", "ir0p", jsonize(ir0p)) -// -| -IR0GPATgua(ir0p, ir0gs) => -(* fprint! *) -(* (out, "IR0GPATgua(", ir0p, "; ", ir0gs, ")") *) -jsonify("IR0CLAUpat", ("ir0p", "ir0gs"), - ( - (* jstr("..."), *) - (* jstr("...") *) - jsonize(ir0p), - jsonize_list(ir0gs) +| IR0GPATpat(ir0p) => + jsonify("IR0GPATpat", "ir0p", jsonize(ir0p)) +| IR0GPATgua(ir0p, ir0gs) => + jsonify("IR0CLAUpat", ("ir0p", "ir0gs"), + ( + jsonize(ir0p), + jsonize_list(ir0gs) + ) ) -) -// -) (* end of [fprint_ir0gpat] *) // +) (* end of [jsonize_ir0gpat] *) implement jsonize_val = jsonize_ir0dcl @@ -386,48 +288,26 @@ case+ x0.node() of // | IR0Cstatic (tok, irc1) => - (* fprint!(out,"IR0Cstatic(", tok, "; ", irc1, ")") *) - jsonify("IR0Cstatic", ("tok", "irc1"), (jsonize(tok), jstr("..."))) + jsonify("IR0Cstatic", ("tok", "irc1"), (jsonize(tok), jsonize(irc1))) | IR0Cextern (tok, irc1) => - (* fprint!(out,"IR0Cextern(", tok, "; ", irc1, ")") *) - jsonify("IR0Cextern", ("tok", "irc1"), (jsonize(tok), jstr("..."))) + jsonify("IR0Cextern", ("tok", "irc1"), (jsonize(tok), jsonize(irc1))) // | IR0Cinclude (tok, src, knd, fopt, body) => - jsonify("IR0Cinclude", ("tok", "src", "knd", "fopt", "body"), rst) where - (* val _ = $showtype(fopt) // filpath *) - val jsrc = jsonize(src) - val jknd = jsonize(knd) - val jfopt = jstr("...") + jsonify("IR0Cinclude", ("tok", "src", "knd", "fopt", "body"), + (jsonize(tok), jsonize(src), jsonize(knd), jsonize("..."), jbody) + ) where val jbody = ( case+ body of | Some(x) => jsonize_list(x) | None() => JSONlist(list_nil()) ) - val rst = (jsonize(tok), jsrc, jknd, jfopt, jbody) - end -(* - ( - (* fprint!(out,"IR0Cinclude(", "src= ", src, "; ", "knd= ", knd, "; ", fopt, "; ", body, ")") *) - ) where - { - val body = - ( - case+ body of - | None _ => "None()" - | Some _ => "Some()"): string - } -*) + end // | IR0Clocal (head, body) => - (* fprint!(out,"IR0Clocal(", head, "; ", body, ")") *) - jsonify("IR0Clocal", ("head", "body"), rst) where - val jhead = jstr("...") - val jbody = jstr("...") - val rst = (jhead, jbody) - end + jsonify("IR0Clocal", ("head", "body"), (jsonize("..."), jsonize("..."))) // | IR0Cvardecl (knd, mopt, irds) => @@ -442,50 +322,44 @@ case+ x0.node() of // | IR0Cfundecl (knd, mopt, tqas, irds) => - (* fprint!(out,"IR0Cfundecl(", knd, "; ", mopt, "; ", tqas, "; ", irds, ")") *) - jsonify("IR0Cfundecl", ("knd", "mopt", "tqas", "irds"), rst) where - val jknd = jsonize(knd) - val jmopt = jsonize(mopt) - (* val _ = $showtype(tqas) // list tq2arg *) - val jtqas = //jstr("...") - jsonize_list(tqas) - (* val _ = $showtype(irds) // list ir0fundecl *) - val jirds = //jstr("...") + jsonify("IR0Cfundecl", ("knd", "mopt", "tqas", "irds"), + ( + jsonize(knd), + jsonize(mopt), + jsonize_list(tqas), jsonize_list(irds) - val rst = (jknd, jmopt, jtqas, jirds) - end + ) + ) // | IR0Cimpdecl3 (knd, mopt, sqas, tqas, id2c, ti3a, ti2s, iras, body) => - (* fprint!(out,"IR0Cimpdecl3(", knd, "; ", mopt, "; ", sqas, "; ", tqas, "; ", id2c, "; ", ti3a, "; ", ti2s, "; ", iras, "; ", body, ")") *) - jsonify("IR0Cimpdecl3", args, rst) where - val args = ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "iras", "body") - val jknd = jsonize(knd)//jstr("...") - val jmopt = jsonize(mopt)//jstr("...") - val jsqas = jsonize_list(sqas) - val jtqas = jsonize_list(tqas) - val jid2c = jsonize(id2c) - val jti3a = jsonize(ti3a) - val jti2s = jsonize_list(ti2s) - val jiras = jsonize_list(iras) where val _ = $showtype(iras) end - val jbody = jsonize(body) - val rst = (jknd, jmopt, jsqas, jtqas, jid2c, jti3a, jti2s, jiras, jbody) - end - + jsonify( + "IR0Cimpdecl3", + ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "iras", "body"), + ( + jsonize(knd), + jsonize(mopt), + jsonize_list(sqas), + jsonize_list(tqas), + jsonize(id2c), + jsonize(ti3a), + jsonize_list(ti2s), + jsonize_list(iras), + jsonize(body) + ) + ) + (* where val _ = $showtype(iras) end *) // | IR0Cnone0() => - (* fprint!(out, "IR0Cnone0(", ")") *) jsonify("IR0Cnone0") - | IR0Cnone1(d3cl) => - (* fprint!(out, "IR0Cnone1(", d3cl, ")") *) - jsonify("IR0Cnone1", "d3cl", rst) where - val rst = jstr("...") - end + jsonify("IR0Cnone1", "d3cl", jsonize("...")) // -) // end of jsonize_ +) // end of [jsonize_ir0dcl] +implement jsonize_val = jsonize_ir0exp + implement jsonize_ir0vardecl (x0) = let @@ -493,9 +367,11 @@ jsonize_ir0vardecl val+IR0VARDECL(rcd) = x0 // in - jsonify ("IR0VARDECL", ("d2v", "ini"), (jsonize(rcd.d2v), jsonize("..."))) - (* , rcd.ini *) -end // end of [fprint_ir0vardecl] + jsonify ( + "IR0VARDECL", ("d2v", "ini"), + (jsonize(rcd.d2v), jsonize_option(rcd.ini)) + ) +end // end of [jsonize_ir0vardecl] implement @@ -516,7 +392,7 @@ in | Some(x) => jsonize(x) ) end -end // end of [fprint_ir0valdecl] +end // end of [jsonize_ir0valdecl] implement jsonize_val = jsonize_f2arg @@ -528,35 +404,20 @@ jsonize_ir0fundecl val+IR0FUNDECL(rcd) = x0 // in -(* - fprint! - ( out - , "IR0FUNDECL@{" - , ", nam=", rcd.nam - , ", d2c=", rcd.d2c - , ", a2g=", rcd.a2g -(* - , ", a3g=", rcd.a3g -*) - , ", def=", rcd.def, "}") -*) -jsonify("IR0FUNDECL", ("nam", "d2c", "a2g", "a3g", "def"), rst) where - val jnam = jsonize(rcd.nam) - val jd2c = jsonize(rcd.d2c) - (* val _ = $showtype(rcd.a2g) *) - val ja2g = jsonize_list(rcd.a2g) //jstr("...")//jsonize(rcd.a2g) - val ja3g = ( - case+ rcd.a3g of - | None() => JSONlist(list_nil()) - | Some(x) => jsonize_list(rcd.a2g) - ) - val jdef = ( - case+ rcd.def of - | None() => JSONlist(list_nil()) - | Some(x) => jsonize_list(rcd.a2g) + jsonify( + "IR0FUNDECL", ("nam", "d2c", "a2g", "a3g", "def"), + (jsonize(rcd.nam), jsonize(rcd.d2c), jsonize_list(rcd.a2g), ja3g, jdef) ) - (* val _ = $showtype(rcd.def) *) - - val rst = (jnam, jd2c, ja2g, ja3g, jdef) -end -end + where + val ja3g = ( + case+ rcd.a3g of + | None() => JSONlist(list_nil()) + | Some(x) => jsonize_list(rcd.a2g) + ) + val jdef = ( + case+ rcd.def of + | None() => JSONlist(list_nil()) + | Some(x) => jsonize_list(rcd.a2g) + ) + end +end // end of [jsonize_ir0fundecl] diff --git a/contrib/sparverius/xjsonize/DATS/staexp2.dats b/contrib/sparverius/xjsonize/DATS/staexp2.dats index e2b207344..6fe40609b 100644 --- a/contrib/sparverius/xjsonize/DATS/staexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/staexp2.dats @@ -442,3 +442,19 @@ case+ x0 of jsonify("S2ITMcst", "fmod", jsonize("...")) ) end + + +implement +jsonize_effs2expopt + (x0) = +( +case+ x0 of +| EFFS2EXPnone() => + jsonify("EFFS2EXPnone") +| EFFS2EXPsome(s2e) => + jsonify("EFFS2EXPsome", "s2e", jsonize(s2e)) +(* +| EFFS2EXPsome(s2f, s2e) => + jsonify("EFFS2EXPsome", ("s2f", "s2e"), (jsonize(s2f), jsonize(s2e))) +*) +) (* end of [fprint_effs2expopt] *) diff --git a/contrib/sparverius/xjsonize/SATS/dynexp2.sats b/contrib/sparverius/xjsonize/SATS/dynexp2.sats index c360a6b87..d29575d93 100644 --- a/contrib/sparverius/xjsonize/SATS/dynexp2.sats +++ b/contrib/sparverius/xjsonize/SATS/dynexp2.sats @@ -28,6 +28,10 @@ fun jsonize_d2itm : jsonize_type(d2itm) overload jsonize with jsonize_d2itm +fun +jsonize_d2pitm : jsonize_type(d2pitm) +overload jsonize with jsonize_d2pitm + fun jsonize_d2pat : jsonize_type(d2pat) overload jsonize with jsonize_d2pat From 63ad9269ba55c4925c8e5752843f3327642454ae Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 12 Dec 2019 01:05:07 -0500 Subject: [PATCH 08/16] updating --- contrib/sparverius/xjsonize/DATS/basics.dats | 6 +- contrib/sparverius/xjsonize/DATS/dynexp1.dats | 544 +++++++++++++++--- contrib/sparverius/xjsonize/DATS/dynexp2.dats | 4 +- contrib/sparverius/xjsonize/DATS/dynexp3.dats | 23 +- contrib/sparverius/xjsonize/DATS/filpath.dats | 22 + contrib/sparverius/xjsonize/DATS/staexp1.dats | 59 +- contrib/sparverius/xjsonize/DATS/staexp2.dats | 31 +- contrib/sparverius/xjsonize/DATS/statyp2.dats | 19 +- contrib/sparverius/xjsonize/DATS/symbol.dats | 2 - contrib/sparverius/xjsonize/SATS/filpath.sats | 13 + 10 files changed, 552 insertions(+), 171 deletions(-) create mode 100644 contrib/sparverius/xjsonize/DATS/filpath.dats create mode 100644 contrib/sparverius/xjsonize/SATS/filpath.sats diff --git a/contrib/sparverius/xjsonize/DATS/basics.dats b/contrib/sparverius/xjsonize/DATS/basics.dats index 1ddb66b50..45d28a750 100644 --- a/contrib/sparverius/xjsonize/DATS/basics.dats +++ b/contrib/sparverius/xjsonize/DATS/basics.dats @@ -31,7 +31,7 @@ case+ vlk of *) | VLKprval() => jstr("VLKprval") // -) (* end of [fprint_valkind] *) +) (* end of [jsonize_valkind] *) end implement @@ -53,7 +53,7 @@ case+ fnk of // | FNKcastfn() => jsonize("FNKcastfn") // -) (* end of [fprint_funkind] *) +) (* end of [jsonize_funkind] *) end @@ -68,7 +68,7 @@ case+ knd of | IMPfun() => jsonize("IMPfun") | IMPtmp() => jsonize("IMPtmp") | IMPgen() => jsonize("IMPgen") -) (* end of [fprint_impkind] *) +) (* end of [jsonize_impkind] *) end diff --git a/contrib/sparverius/xjsonize/DATS/dynexp1.dats b/contrib/sparverius/xjsonize/DATS/dynexp1.dats index 671cb3fa6..aa4fe296c 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp1.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp1.dats @@ -29,6 +29,154 @@ #staload "./../SATS/dynexp1.sats" +implement +jsonize_q1arg + (x0) = +( +// +case+ x0.node() of +(* +| Q1ARGnone(tok) => + jsonify("Q1ARGnone", "tok", jsonize(tok)) +*) +| Q1ARGsome(tok, opt) => + jsonify("Q1ARGsome", ("tok", "opt"), + ( + jsonize(tok), + jsonize("...") //jsonize_option(opt) + ) + ) +// +) (* end of [jsonize_q1arg] *) + +implement +jsonize_a1typ + (x0) = +( +// +case+ x0.node() of +| A1TYPsome(s1e, opt) => + jsonify("A1TYPsome", ("s1e", "opt"), + ( + jsonize(s1e), + jsonize("...") // jsonize_option(opt) + ) + ) +// +) (* end of [jsonize_a1typ] *) + + + +local +// +fun +jsonize_a1typlstopt +(opt: a1typlstopt): jsonval = +( +case+ opt of +| None() => jsonify("None") +| Some(a1ts) => jsonval_labval1("Some", jsonize("..."))// jsonize_list(a1ts)) +) +// +overload jsonize with jsonize_a1typlstopt of 100 +// +in (* in-of-local *) + +implement +jsonize_d1arg + (x0) = +( +// +case+ x0.node() of +// +| D1ARGsome_sta(s1qs) => + jsonify("D1ARGsome_sta", "s1qs", jsonize("...")(* jsonize(s1qs) *)) +// +| D1ARGsome_dyn1(tok) => + jsonify("D1ARGsome_dyn1", "tok", jsonize(tok)) +| D1ARGsome_dyn2(arg0, opt1) => + jsonify("D1ARGsome_dyn2", ("arg0", "opt1"), + ( + jsonize("..."), //jsonize(arg0), + jsonize("...") //jsonize(opt1) + ) + ) +// +) (* end of [jsonize_d1arg] *) + +end // end of [local] + + + +implement +jsonize_f1arg + (x0) = +( +// +case+ +x0.node() of +(* +| F1ARGnone(tok) => + jsonify("F1ARGnone", "tok", jsonize(tok)) +*) +| F1ARGsome_dyn(d1p0) => + jsonify("F1ARGsome_dyn", "d1p0", jsonize(d1p0)) +| F1ARGsome_sta(s1qs) => + jsonify("F1ARGsome_sta", "s1qs", jsonize("...")) +| F1ARGsome_met(s1es) => + jsonify("F1ARGsome_met", "s1es", jsonize("...")) +// +) (* end of [jsonize_f1arg] *) + +(* ****** ****** *) + +implement +jsonize_sq1arg + (x0) = +( +// +case+ +x0.node() of +| SQ1ARGnone(tok) => + jsonify("SQ1ARGnone", "tok", jsonize(tok)) +| SQ1ARGsome(q1as) => + jsonify("SQ1ARGsome", "q1as", jsonize("...")) +// +) (* end of [jsonize_sq1arg] *) + +(* ****** ****** *) + +implement +jsonize_ti1arg + (x0) = +( +// +case+ +x0.node() of +| TI1ARGnone(tok) => + jsonify("TI1ARGnone", "tok", jsonize(tok)) +| TI1ARGsome(s1es) => + jsonify("TI1ARGsome", "s1es", jsonize("...")) +// +) (* end of [jsonize_ti1arg] *) + +(* ****** ****** *) + +implement +jsonize_tq1arg + (x0) = +( +// +case+ +x0.node() of +| TQ1ARGnone(tok) => + jsonify("TQ1ARGnone", "tok", jsonize(tok)) +| TQ1ARGsome(q1as) => + jsonify("TQ1ARGsome", "q1as", jsonize("...")) +// +) (* end of [jsonize_tq1arg] *) + + implement jsonize_val = jsonize_d1exp implement jsonize_val = jsonize_d1ecl @@ -161,48 +309,65 @@ case+ x0.node() of } +implement jsonize_val = jsonize_d1exp +implement jsonize_val = jsonize_v1aldecl +(* implement jsonize_val = jsonize_g1exp *) + +(* implement jsonize_val = jsonize_g1marg *) +(* implement jsonize_val = jsonize_s1marg *) +(* implement jsonize_val = jsonize_t1marg *) + + implement jsonize_d1ecl - (x0) = jsonize("...") -(* + (x0) = ( case+ x0.node() of // | D1Cnone() => - fprint!(out, "D1Cnone(", ")") + jsonify("D1Cnone") | D1Cnone(d0c) => - fprint!(out, "D1Cnone(", d0c, ")") + jsonify("D1Cnone", "d0c", jsonize(d0c)) // | D1Cstatic(knd, d1c) => - fprint! - (out, "D1Cstatic(", knd, "; ", d1c, ")") + jsonify("D1Cstatic", ("knd", "d1c"), (jsonize(knd), jsonize(d1c))) // | D1Cextern(knd, d1c) => - fprint! - (out, "D1Cextern(", knd, "; ", d1c, ")") + jsonify("D1Cextern", ("knd", "d1c"), (jsonize(knd), jsonize(d1c))) // | D1Cdefine (tok, sym, arg, def) => - fprint! - ( out - , "D1Cdefine(" - , tok, "; ", sym, "; ", arg, "; ", def, ")") + jsonify("D1Cdefine", ("tok", "sym", "arg", "def"), + ( + jsonize(tok), + jsonize(sym), + jsonize("..."), //jsonize_list(arg), + jsonize("...") //jsonize_option(def) + ) + ) | D1Cmacdef (tok, sym, arg, def) => - fprint! - ( out - , "D1Cmacdef(" - , tok, "; ", sym, "; ", arg, "; ", def, ")") + jsonify("D1Cmacdef", ("tok", "sym", "arg", "def"), + ( + jsonize(tok), + jsonize(sym), + jsonize("..."), //jsonize_list(arg), + jsonize_option(def) + ) + ) // | D1Cinclude (tok, src, knd, opt, body) => ( - fprint! - ( out - , "D1Cinclude(" - , tok, "; " - , src, "; " // src: d1exp - , knd, "; ", opt, "; ", body, ")") + jsonify("D1Cinclude", ("tok", "src", "knd", "opt", "body"), + ( + jsonize(tok), + jsonize(src), + jsonize(knd), + jsonize("..."), + jsonize(body) + ) + ) ) where { val body = @@ -213,16 +378,13 @@ case+ x0.node() of } // | D1Cstaload - ( tok, src - , knd, opt, flag, body) => + ( tok, src, knd, opt, flag, body) => ( - fprint! - ( out - , "D1Cstaload(" - , tok, "; " - , src, "; " // src: d1exp - , knd, "; " // knd: stadyn - , opt, "; ", flag, "; ", body, ")") + jsonify("D1Cstaload", + ("tok", "src", "knd", "opt", "flag", "body"), + (jsonize(tok), jsonize(src), jsonize(knd), + jsonize("..."), jsonize(flag), jsonize(body)) + ) ) where { val body = @@ -233,103 +395,156 @@ case+ x0.node() of } // | D1Cabssort(tok, tid) => - fprint! - (out, "D1Cabssort(", tok, "; ", tid, ")") + jsonify("D1Cabssort", ("tok", "tid"), (jsonize(tok), jsonize(tid))) // | D1Cstacst0 (tok, sid, tmas, s0t) => - fprint! - ( out - , "D1Cstacst0(" - , tok, "; ", sid, "; ", tmas, "; ", s0t, ")") + jsonify("D1Cstacst0", ("tok", "sid", "tmas", "s0t"), + ( + jsonize(tok), + jsonize(sid), + jsonize("..."), //jsonize_list(tmas), + jsonize(s0t) + ) + ) // | D1Csortdef (knd, tok, def) => - fprint! - ( out - , "D1Csortdef(", knd, "; ", tok, "; ", def, ")") + jsonify("D1Csortdef", ("knd", "tok", "def"), + (jsonize(knd), jsonize(tok), jsonize("...")) + ) // | D1Csexpdef - ( knd, sid - , arg, res, def) => - fprint! - ( out, "D1Csexpdef(" - , knd, "; ", sid, "; ", arg, "; ", res, "; ", def, ")") + ( knd, sid, arg, res, def) => + jsonify("D1Csexpdef", ("knd", "sid", "arg", "res", "def"), + ( + jsonize(knd), + jsonize(sid), + jsonize("..."), //jsonize_list(arg), + jsonize("..."), + jsonize(def) + ) + ) // | D1Cabstype (knd, sid, arg, res, def) => - fprint! - ( out, "D1Cabstype(" - , knd, "; ", sid, "; ", arg, "; ", res, "; ", def, ")") + jsonify("D1Cabstype", ("knd", "sid", "arg", "res", "def"), + ( + jsonize(knd), + jsonize(sid), + jsonize("..."), //jsonize(arg), + jsonize("..."), //jsonize(res), + jsonize(def) + ) + ) // | D1Cabsimpl (tok, sqid, smas, res0, def1) => - fprint! - ( out, "D1Cabsimpl(" - , tok, "; ", sqid, "; ", smas, "; ", res0, "; ", def1, ")") + jsonify("D1Cabsimpl", ("tok", "sqid", "smas", "res0", "def1"), + (jsonize(tok), + jsonize(sqid), + jsonize("..."), //jsonize(smas), + jsonize("..."), //jsonize(res0), + jsonize(def1)) + ) // | D1Cvaldecl (tok, mods, d1cs) => - fprint! - ( out - , "D1Cvaldecl(", tok, "; ", mods, "; ", d1cs, ")") + jsonify("D1Cvaldecl", ("tok", "mods", "d1cs"), + (jsonize(tok), jsonize(mods), + jsonize("...") //jsonize_list(d1cs) + ) + ) // -| D1Cvardecl(tok, d1cs) => - ( - fprint!(out, "D1Cvardecl(", tok, "; ", d1cs, ")") +| D1Cvardecl(tok, mopt, d1cs) => + jsonify("D1Cvardecl", ("tok", "mopt", "d1cs"), + ( + jsonize(tok), + jsonize(mopt), + jsonize("...") //jsonize_list(d1cs) + ) ) // | D1Cfundecl (tok, mopt, tqas, d1cs) => - fprint! - ( out - , "D1Cfundecl(", tok, "; ", mopt, "; ", tqas, "; ", d1cs, ")") + jsonify("D1Cfundecl", ("tok", "mopt", "tqas", "d1cs"), + (jsonize(tok), jsonize(mopt), + jsonize("..."), // jsonize(tqas), + jsonize("...") //jsonize(d1cs) + ) + ) // | D1Cimpdecl - ( tok, mopt, sqas, tqas - , dqid, tias, f1as, res0, teq1, d1e2) => - fprint! - ( out - , "D1Cimpdecl(" - , tok, "; ", mopt, "; ", sqas, "; ", tqas, "; " - , dqid, "; ", tias, "; ", f1as, "; ", res0, "; ", teq1, "; ", d1e2, ")") + (tok, mopt, sqas, tqas, dqid, tias, f1as, res0, teq1, d1e2) => + jsonify("D1Cimpdecl", + ("tok", "mopt", "sqas", "tqas", "dqid", "tias", "f1as", "res0", "teq1", "d1e2"), + ( + jsonize(tok), + jsonize(mopt), + jsonize("..."), //jsonize(sqas), + jsonize("..."), //jsonize(tqas), + jsonize(dqid), + jsonize("..."), //jsonize(tias), + jsonize("..."), //jsonize(f1as), + jsonize("..."), //jsonize(res0), + jsonize("..."), //jsonize(teq1), + jsonize(d1e2) + ) + ) // | D1Csymload (knd, sym, dqid, tint) => - fprint! - ( out, "D1Csymload(" - , knd, "; ", sym, "; ", dqid, "; ", tint, ")") + jsonify("D1Csymload", ("knd", "sym", "dqid", "tint"), + (jsonize(knd), jsonize(sym), jsonize(dqid), + jsonize("...") //jsonize(tint) + ) + ) // | D1Cdatasort (knd, d1tsts) => - fprint! - ( out, "D1Cdatasort(", knd, "; ", d1tsts, ")" ) + jsonify("D1Cdatasort", ("knd", "d1tsts"), + (jsonize(knd), + jsonize("...") //jsonize(d1tsts) + ) + ) // | D1Cdatatype (knd, d1typs, wopt) => - fprint! - ( out - , "D1Cdatatype(", knd, "; ", d1typs, "; ", wopt, ")") + jsonify("D1Cdatatype", ("knd", "d1typs", "wopt"), + ( + jsonize(knd), + jsonize("..."), //jsonize(d1typs), + jsonize(wopt) + ) + ) // | D1Cdynconst (tok, tqas, d1cs) => - fprint! - (out, "D1Cdynconst(", tok, "; ", tqas, "; ", d1cs, ")") + jsonify("D1Cdynconst", ("tok", "tqas", "d1cs"), + (jsonize(tok), + jsonize("..."), //jsonize(tqas), + jsonize("...") //jsonize(d1cs) + ) + ) // | D1Clocal (d1cs_head, d1cs_body) => - fprint! - (out, "D1Clocal(", d1cs_head, "; ", d1cs_body, ")") + jsonify("D1Clocal", ("d1cs_head", "d1cs_body"), + ( + jsonize("..."), //jsonize(d1cs_head), + jsonize("...") //jsonize(d1cs_body)) + ) + ) // -| D1Ctokerr(d0c0) => fprint!(out, "D1Ctokerr(", d0c0, ")") +| D1Ctokerr(d0c0) => + jsonify("D1Ctokerr", "d0c0", jsonize(d0c0)) // (* | _(*rest-of-d1ecl*) => - fprint!(out, "fprint_d1ecl: D1C...: not-yet-implemented") + jsonize!(out, "jsonize_d1ecl: D1C...: not-yet-implemented") *) // ) (* end of [jsonize_d1ecl] *) -*) local @@ -394,7 +609,7 @@ x0.node() of | D1Pnone((*void*)) => jsonify("D1Pnone") // -) (* end of [fprint_d1pat] *) +) (* end of [jsonize_d1pat] *) end // end of [local] @@ -410,4 +625,165 @@ case+ x0 of jsonify("F1UNARROWdflt") | F1UNARROWlist(s1es) => jsonify("F1UNARROWlist", "s1es", jsonize_list(s1es)) -) (* end of [fprint_f1unarrow] *) +) (* end of [jsonize_f1unarrow] *) + + +implement +jsonize_teqd1expopt + (x0) = +( +case+ x0 of +| TEQD1EXPnone() => + jsonify("TEQD1EXPnone") + +| TEQD1EXPsome(tok, d1e) => + jsonify("TEQD1EXPsome", ("tok", "d1e"), (jsonize(tok), jsonize(d1e))) +) + + +implement +jsonize_wths1expopt + (x0) = +( +case+ x0 of +| WTHS1EXPnone() => + jsonify("WTHS1EXPnone") +| WTHS1EXPsome(tok, s1e) => + jsonify("WTHS1EXPsome", ("tok", "s1e"), (jsonize(tok), jsonize(s1e))) +) + +implement +jsonize_d1gua + (x0) = +( +case+ +x0.node() of +| D1GUAexp(d1e) => + jsonify("D1GUAexp", "d1e", jsonize(d1e)) +| D1GUAmat(d1e, d1p) => + jsonify("D1GUAexp", ("d1e", "d1p"), (jsonize(d1e), jsonize(d1p))) +) (* end of [jsonize_d1gua] *) + + +implement +jsonize_d1clau + (x0) = +( +case+ +x0.node() of +| D1CLAUgpat(d1gp) => + jsonify("D1CLAUgpat", "d1gp", jsonize(d1gp)) +| D1CLAUclau(d1gp, d0e0) => + jsonify("D1CLAUclau", ("d1gp", "d0e0"), (jsonize(d1gp), jsonize(d0e0))) +) (* end of [jsonize_d1clau] *) + +implement +jsonize_d1gpat + (x0) = +( +case+ +x0.node() of +| D1GPATpat(d1p) => + jsonify("D1GPATpat", "d1p", jsonize(d1p)) +| D1GPATgua(d1p, d1gs) => + jsonify("D1GPATgua", ("d1p", "d1gs"), (jsonize(d1p), jsonize("..."))) +) (* end of [jsonize_d1gpat] *) + + +implement +jsonize_abstdf1 + (x0) = +( +case+ x0 of +| ABSTDF1some() => + jsonify("ABSTDF1some") +| ABSTDF1lteq(s0e) => + jsonify("ABSTDF1lteq", "s0e", jsonize(s0e)) +| ABSTDF1eqeq(s0e) => + jsonify("ABSTDF1eqeq", "s0e", jsonize(s0e)) +) (* end of [jsonize_abstdf1] *) + + +implement +jsonize_wd1eclseq + (x0) = +( +case+ x0 of +| WD1CSnone() => + jsonify("WD1CSnone") +| WD1CSsome(d1cs) => + jsonify("WD1CSsome", "d1cs", jsonize("...")) +) (* end of [jsonize_wd1eclseq] *) + + +implement +jsonize_v1aldecl + (x0) = let +// +val+V1ALDECL(rcd) = x0 +// +in + jsonify("V1ALDECL", ("pat", "def", "wtp"), + ( + jsonize(rcd.pat), + jsonize("..."), // jsonize(rcd.def), + jsonize(rcd.wtp) + ) + ) +end // end of [jsonize_v1aldecl] + + +implement +jsonize_v1ardecl + (x0) = let +// +val+V1ARDECL(rcd) = x0 +// +in + jsonify("V1ARDECL", ("nam", "wth", "res", "ini"), + ( + jsonize(rcd.nam), + jsonize("..."), // jsonize(rcd.wth), + jsonize("..."), // jsonize(rcd.res), + jsonize(rcd.ini) + ) + ) +end // end of [jsonize_v1ardecl] + + +implement +jsonize_f1undecl + (x0) = let +// +val+F1UNDECL(rcd) = x0 +// +in + jsonify("F1UNDECL", ("nam", "arg", "res", "def", "wtp"), + ( + jsonize(rcd.nam), + jsonize("..."), // jsonize(rcd.arg), + jsonize("..."), // jsonize(rcd.res), + jsonize("..."), // jsonize(rcd.def), + jsonize(rcd.wtp) + ) + ) +end // end of [jsonize_f1undecl] + + +implement +jsonize_d1cstdecl + (x0) = let +// +val+D1CSTDECL(rcd) = x0 +// +in + jsonify( + "D1CSTDEC", ("nam", "arg", "res", "def"), + ( + jsonize(rcd.nam), + jsonize("..."), // jsonize(rcd.arg), + jsonize("..."), // jsonize(rcd.res), + jsonize(rcd.def) + ) + ) +end // end of [jsonize_d1cstdecl] diff --git a/contrib/sparverius/xjsonize/DATS/dynexp2.dats b/contrib/sparverius/xjsonize/DATS/dynexp2.dats index b8c8b2f85..fdf5c78e8 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp2.dats @@ -612,7 +612,7 @@ case- x0.node() of | D2Cnone1(d1csrc) => jsonify("D2Csortdef", "d1csrc", jsonize(d1csrc)) // -) (* end of [fprint_d2ecl] *) +) (* end of [jsonize_d2ecl] *) end // end of [local] @@ -707,7 +707,7 @@ IMPLD2CST2(dqid, d2cs, opt2) => jsonize(dqid), jsonize_list(d2cs), jsonize_option(opt2) ) ) -) // end of [fprint_impld2cst] +) // end of [jsonize_impld2cst] end diff --git a/contrib/sparverius/xjsonize/DATS/dynexp3.dats b/contrib/sparverius/xjsonize/DATS/dynexp3.dats index 9b7982f0b..7a2de5ecf 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp3.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp3.dats @@ -8,33 +8,28 @@ #staload _ = "./json.dats" #define XATS_targetloc "./../../../../srcgen/xats" -(* -#staload "{$XATS}/SATS/dynexp0.sats" -#staload "{$XATS}/SATS/staexp0.sats" -*) #staload "{$XATS}/SATS/dynexp1.sats" #staload "{$XATS}/SATS/dynexp2.sats" #staload "{$XATS}/SATS/dynexp3.sats" -(* #staload "{$XATS}/SATS/staexp2.sats" *) #staload "./../SATS/json.sats" #staload _ = "./json.dats" -#staload "./../SATS/dynexp0.sats" -#staload "./../SATS/staexp0.sats" #staload "./../SATS/lexing.sats" -#staload "./../SATS/dynexp1.sats" #staload "./../SATS/label0.sats" -#staload "./../SATS/dynexp2.sats" -#staload "./../SATS/dynexp3.sats" + +#staload "./../SATS/staexp0.sats" +#staload "./../SATS/dynexp0.sats" + +#staload "./../SATS/staexp1.sats" +#staload "./../SATS/dynexp1.sats" + #staload "./../SATS/statyp2.sats" #staload "./../SATS/staexp2.sats" +#staload "./../SATS/dynexp2.sats" -(* -#staload SYM_J = "./../SATS/symbol.sats" -#staload STM_J = "./../SATS/stamp0.sats" -*) +#staload "./../SATS/dynexp3.sats" local diff --git a/contrib/sparverius/xjsonize/DATS/filpath.dats b/contrib/sparverius/xjsonize/DATS/filpath.dats new file mode 100644 index 000000000..22bc4c93b --- /dev/null +++ b/contrib/sparverius/xjsonize/DATS/filpath.dats @@ -0,0 +1,22 @@ +#include "share/atspre_staload.hats" +#staload UN = "prelude/SATS/unsafe.sats" + +#include "./../HATS/libxatsopt.hats" + +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/filpath.sats" + + +#staload "./../SATS/json.sats" +#staload _ = "./json.dats" + + +#staload "./../SATS/filpath.sats" + + +implement jsonize_filpath + (x) = + jsonval_labval1("fpath", jsonize(full1)) +where + val full1 = filpath_get_full1(x) +end diff --git a/contrib/sparverius/xjsonize/DATS/staexp1.dats b/contrib/sparverius/xjsonize/DATS/staexp1.dats index f81f33ac0..52ebb03e9 100644 --- a/contrib/sparverius/xjsonize/DATS/staexp1.dats +++ b/contrib/sparverius/xjsonize/DATS/staexp1.dats @@ -49,13 +49,12 @@ case+ x0.node() of // (* | S1Ttype(knd) => - fprint!(out, "S1Ttype", knd, ")") + jsonify("S1Ttype", "knd", jsonize(knd)) *) // (* | S1Tapp(s1t0, s1ts) => - fprint! - (out, "S1Tapp(", s1t0, "; ", s1ts, ")") + jsonify("S1Tapp", ("s1t0", "s1ts"), (jsonize(s1t0), jsonize(s1ts))) *) // | S1Tapp1 @@ -100,70 +99,78 @@ jsonize_s1exp case+ x0.node() of // | S1Eid(sid) => - jsonize("S1Eid") + jsonify("S1Eid", "sid", jsonize(sid)) // | S1Eint(tok) => - jsonize("S1Eint") + jsonify("S1Eint", "tok", jsonize(tok)) | S1Echr(tok) => - jsonize("S1Echr") + jsonify("S1Echr", "tok", jsonize(tok)) | S1Eflt(tok) => - jsonize("S1Eflt") + jsonify("S1Eflt", "tok", jsonize(tok)) | S1Estr(tok) => - jsonize("S1Estr") + jsonify("S1Estr", "tok", jsonize(tok)) // | S1Eapp() => - jsonize("S1Eapp") + jsonify("S1Eapp") // | S1Eapp1 (s1e0, s1e1) => - jsonize("S1Eapp1") + jsonify("S1Eapp1", ("s1e0", "s1e1"), (jsonize(s1e0), jsonize(s1e1))) | S1Eapp2 (s1e0, s1e1, s1e2) => - jsonize("S1Eapp2") + jsonify("S1Eapp2", ("s1e0", "s1e1", "s1e2"), (jsonize(s1e0), jsonize(s1e1), jsonize(s1e2))) // | S1Ebs0() => - jsonize("S1Ebs0") + jsonify("S1Ebs0") | S1Ebs1(s1e) => - jsonize("S1Ebs1") + jsonify("S1Ebs1", "s1e", jsonize(s1e)) // | S1Eimp(s1es) => - jsonize("S1Eimp") + jsonify("S1Eimp", "s1es", jsonize("...")) // (* | S1Eapp(s1e0, s1es) => + jsonify("S1Eimp", ("s1e0", "s1es"), (jsonize(s1e0), jsonize(s1es))) *) // | S1Elist(s1es) => - jsonize("S1Elist") + jsonify("S1Elist", "s1es", jsonize("...")) | S1Elist(s1es1, s1es2) => - jsonize("S1Elist") + jsonify("S1Elist", ("s1es1", "s1es2"), (jsonize("..."), jsonize("..."))) // | S1Etuple(k0, s1es) => - jsonize("S1Etuple") + jsonify("S1Etuple", ("k0", "s1es"), (jsonize(k0), jsonize("..."))) | S1Etuple(k0, s1es1, s1es2) => - jsonize("S1Etuple") + jsonify("S1Etuple", ("k0", "s1es1", "s1es2"), (jsonize(k0), jsonize("..."), jsonize("...") + )) // | S1Erecord(k0, ls1es) => - jsonize("S1Erecord") + jsonify("S1Erecord", ("k0", "ls1es"), (jsonize(k0), jsonize("..."))) | S1Erecord(k0, ls1es1, ls1es2) => - jsonize("S1Erecord") + jsonify("S1Erecord", ("k0", "ls1es1", "ls1es2"), (jsonize(k0), jsonize("..."), jsonize("..."))) // | S1Eforall(s1qs) => - jsonize("S1Eforall") + jsonify("S1Eforall", "s1qs", jsonize("...")) | S1Eexists(k0, s1qs) => - jsonize("S1Eexists") + jsonify("S1Eexists", ("k0", "s1qs"), (jsonize(k0), jsonize("..."))) // | S1Elam(arg, res, s1e) => - jsonize("S1Elam") + jsonify("S1Elam", ("arg", "res", "s1e"), + ( + jsonize("..."), //jsonize(arg), + jsonize("..."), //jsonize(res), + jsonize(s1e) + ) + ) // | S1Eanno(s1e, s1t) => - jsonize("S1Eanno") + jsonify("S1Eanno", ("s1e", "s1t"), (jsonize(s1e), jsonize(s1t))) // | S1Equal(tok, s1e) => - jsonize("S1Equal") + jsonify("S1Equal", ("tok", "s1e"), (jsonize(tok), jsonize(s1e))) // | S1Enone(loc) => - jsonize("S1Enone") + jsonify("S1Enone", "loc", jsonize("...")) // ) (* jsonize_s0exp *) diff --git a/contrib/sparverius/xjsonize/DATS/staexp2.dats b/contrib/sparverius/xjsonize/DATS/staexp2.dats index 6fe40609b..deb03fe37 100644 --- a/contrib/sparverius/xjsonize/DATS/staexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/staexp2.dats @@ -100,7 +100,6 @@ case+ s2tb of | T2BASdat(dat) => jsonify("T2BASabs", "dat", jsonize(dat)) | T2BASimp(knd, sym) => - (* fprint!(out, "T2BASimp(", knd, "; ", sym, ")") *) jsonify("T2BASimp", ("knd", "sym"), (jsonize(knd), jsonize(sym))) ) @@ -155,12 +154,12 @@ case+ knd of jsonify("TYRECflt0") (* | TYRECflt1(stm) => - fprint!(out, "TYRECflt1(", stm, ")") + jsonize("TYRECflt1", "stm", jsonize(stm)) *) | TYRECflt2(nam) => jsonify("TYRECflt2", "nam", jsonize(nam)) // -) (* end of [fprint_tyrec] *) +) (* end of [jsonize_tyrec] *) @@ -192,26 +191,14 @@ s2e0.node() of jsonify("S2Estr", "s0", jsonize(s0)) // | S2Ecst(s2c) => - jsonify("S2Ecst", "s2c", jsonize(s2c)) -(* - fprint! - (out, "S2Ecst(", s2c, "; ", s2c.sort(), ")") -*) + jsonify("S2Ecst", "s2c", jsonize(s2c.sort())) // s2c | S2Evar(s2v) => - jsonify("S2Evar", "s2v", jsonize(s2v)) -(* - fprint! - (out, "S2Evar(", s2v, "; ", s2v.sort(), ")") -*) + jsonify("S2Evar", "s2v", jsonize(s2v.sort())) // | S2Extv(xtv) => let -(* - val s2e = "..." -*) val s2e = s2xtv_get_sexp(xtv) in - (* fprint!(out, "S2Extv(", s2e, ")") *) jsonify("S2Extv", "xtv", jsonize(s2e)) end // @@ -324,12 +311,6 @@ s2e0.node() of jsonize(s2t) ) ) -(* - fprint! - ( out - , "S2Ecast(" - , loc, "; ", s2e, "; ", s2t, ")") -*) // | S2Emet (s2es, body) => @@ -369,7 +350,7 @@ s2e0.node() of // (* | S2Elist(s2es) => - fprint!(out, "S2Elist(", s2es, ")") + jsonify("S2Elist", "s2es", jsonize(s2es)) *) // | S2Etyrec @@ -457,4 +438,4 @@ case+ x0 of | EFFS2EXPsome(s2f, s2e) => jsonify("EFFS2EXPsome", ("s2f", "s2e"), (jsonize(s2f), jsonize(s2e))) *) -) (* end of [fprint_effs2expopt] *) +) (* end of [jsonize_effs2expopt] *) diff --git a/contrib/sparverius/xjsonize/DATS/statyp2.dats b/contrib/sparverius/xjsonize/DATS/statyp2.dats index 97fa9f379..33baa6aa5 100644 --- a/contrib/sparverius/xjsonize/DATS/statyp2.dats +++ b/contrib/sparverius/xjsonize/DATS/statyp2.dats @@ -46,14 +46,10 @@ case+ x0.node() of // | T2Pbas(sym) => - (* fprint!(out, "T2Pbas(", sym, ")") *) jsonify("T2Pbas", "sym", jsonize(sym)) - (* where val _ = $showtype(sym) end *) | T2Pcst(s2c) => - (* fprint!(out, "T2Pcst(", s2c, ")") *) jsonify("T2Pcst", "s2c", jsonize(s2c)) | T2Pvar(s2v) => - (* fprint!(out, "T2Pvar(", s2v, ")") *) jsonify("T2Pvar", "s2v", jsonize(s2v)) // | T2Pxtv(xtv) => @@ -68,10 +64,6 @@ x0.node() of | T2Pnone0() => ( jsonify("T2Pxtv", "xtv", rst) - (* end *) - (* fprint! *) - (* (out, "T2Pxtv(", stm, ")") *) - (* ) *) where { val stm = xtv.stamp((*void*)) @@ -79,7 +71,6 @@ x0.node() of } ) | _ (* else *) => - (* fprint!(out, "T2Pxtv(", t2p, ")") *) jsonify("T2Pxtv", "xtv", rst) where { @@ -133,7 +124,6 @@ x0.node() of (jsonize(tnm1), jsonize_list(t2ps)) ) | T2Ptyrec(knd1, npf2, lt2ps) => - jsonify( "T2Ptyrec", ("knd1", "npf2", "lt2ps"), ( @@ -143,9 +133,9 @@ x0.node() of ) ) // -| T2Pnone0() => //fprint!(out, "T2Pnone0(", ")") +| T2Pnone0() => jsonify("T2Pnone0") -| T2Pnone1(s2e) => //fprint!(out, "T2Pnone1(", s2e, ")") +| T2Pnone1(s2e) => jsonify("T2Pnone1", "s2e", jsonize(s2e)) // @@ -159,7 +149,6 @@ jsonize_labt2ype (lt2p) = ( case+ lt2p of -| TLABELED(l0, t2p) => //fprint!(out, l0, "=", t2p) +| TLABELED(l0, t2p) => jsonify("TLABELED", ("l0", "t2p"), (jsonize(l0), jsonize(t2p))) - (* where val _ = $showtype(l0) end *) -) (* end of [fprint_labt2ype] *) +) (* end of [jsonize_labt2ype] *) diff --git a/contrib/sparverius/xjsonize/DATS/symbol.dats b/contrib/sparverius/xjsonize/DATS/symbol.dats index f736d73aa..2f1cd1f63 100644 --- a/contrib/sparverius/xjsonize/DATS/symbol.dats +++ b/contrib/sparverius/xjsonize/DATS/symbol.dats @@ -14,9 +14,7 @@ implement jsonize_symbol(x0) = -(* jsonval_labval2("node", jstr("symbol"), "val", jsonize(x0.name())) *) jsonval_labval1("symbol", jsonize(x0.name())) implement labify_symbol(x0) = ("symbol", jsonize(x0.name())) -(* jsonval_labval2("node", jstr("symbol"), "val", jsonize(x0.name())) *) diff --git a/contrib/sparverius/xjsonize/SATS/filpath.sats b/contrib/sparverius/xjsonize/SATS/filpath.sats new file mode 100644 index 000000000..15f2124e5 --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/filpath.sats @@ -0,0 +1,13 @@ +#define XATS_targetloc "./../../../../srcgen/xats" +#staload "{$XATS}/SATS/filpath.sats" + +#staload "./json.sats" + +(* +implement +fprint_val = fprint_filpath_full2 +*) + +fun +jsonize_filpath : jsonize_type(filpath) +overload jsonize with jsonize_filpath From 13edd93dc6186c2e534b29492b0b1528d315e242 Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 13 Dec 2019 21:04:45 -0500 Subject: [PATCH 09/16] updating --- contrib/sparverius/xjsonize/DATS/basics.dats | 12 +- contrib/sparverius/xjsonize/DATS/dynexp0.dats | 7 +- contrib/sparverius/xjsonize/DATS/dynexp1.dats | 307 ++++++++--- contrib/sparverius/xjsonize/DATS/dynexp2.dats | 326 +++++++---- contrib/sparverius/xjsonize/DATS/interp0.dats | 14 + contrib/sparverius/xjsonize/DATS/intrep0.dats | 43 +- contrib/sparverius/xjsonize/DATS/json.dats | 515 +++++++++++------- contrib/sparverius/xjsonize/DATS/label0.dats | 3 +- .../xjsonize/DATS/lexing_token.dats | 184 ++++--- contrib/sparverius/xjsonize/DATS/locinfo.dats | 89 +++ contrib/sparverius/xjsonize/DATS/staexp0.dats | 2 +- contrib/sparverius/xjsonize/DATS/staexp1.dats | 319 +++++++++++ contrib/sparverius/xjsonize/DATS/staexp2.dats | 111 +++- contrib/sparverius/xjsonize/SATS/json.sats | 39 ++ contrib/sparverius/xjsonize/SATS/locinfo.sats | 14 + contrib/sparverius/xjsonize/SATS/staexp1.sats | 8 +- contrib/sparverius/xjsonize/SATS/staexp2.sats | 3 + 17 files changed, 1503 insertions(+), 493 deletions(-) diff --git a/contrib/sparverius/xjsonize/DATS/basics.dats b/contrib/sparverius/xjsonize/DATS/basics.dats index 45d28a750..0ecebbee6 100644 --- a/contrib/sparverius/xjsonize/DATS/basics.dats +++ b/contrib/sparverius/xjsonize/DATS/basics.dats @@ -18,7 +18,7 @@ UN = "prelude/SATS/unsafe.sats" implement jsonize_valkind - (vlk) = lab("valkind", res) where + (vlk) = node("valkind", res) where val res = ( // @@ -36,7 +36,7 @@ end implement jsonize_funkind - (fnk) = lab("funkind", res) where + (fnk) = node("funkind", res) where val res = ( // @@ -59,7 +59,7 @@ end implement jsonize_impkind - (knd) = lab("impkind", res) where + (knd) = node("impkind", res) where val res = ( case+ knd of @@ -74,13 +74,13 @@ end implement jsonize_funclo2 - (fc2) = lab("impkind", res) where + (fc2) = node("funclo2", res) where val res = ( case+ fc2 of | FC2fun() => - jsonize("FC2fun()") + jsonize("FC2fun") | FC2clo(knd) => - lab("FC2clo", jsonize(knd))(* jsonize("FC2clo(", knd, ")") *) + jsonify("FC2clo", "knd", jsonize(knd)) ) end diff --git a/contrib/sparverius/xjsonize/DATS/dynexp0.dats b/contrib/sparverius/xjsonize/DATS/dynexp0.dats index 4747ac71d..b390a9c5a 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp0.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp0.dats @@ -46,7 +46,8 @@ x0.node() of jsonify("Q0ARGnone", "tok", jsonize(tok)) *) | Q0ARGsome(sid, opt) => - jsonify("Q0ARGsome", ("sid", "opt"), (jsonize(sid), jsonize_option(opt))) + jsonify("Q0ARGsome", ("sid", "opt"), + (jsonize(sid), jsonize_option(opt))) // ) (* end of [jsonize_q0arg] *) @@ -604,6 +605,8 @@ implement jsonize_val(x) = jsonize_i0dnt(x) implement jsonize_decmodopt (x0) = +node("decmodopt", res) where +val res = ( case+ x0 of // @@ -622,7 +625,7 @@ case+ x0 of val rst = (jsonize(tok), jsonize(tbeg), xys, jsonize(tend)) end ) - +end implement jsonize_teqd0expopt diff --git a/contrib/sparverius/xjsonize/DATS/dynexp1.dats b/contrib/sparverius/xjsonize/DATS/dynexp1.dats index aa4fe296c..bf4668076 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp1.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp1.dats @@ -29,9 +29,17 @@ #staload "./../SATS/dynexp1.sats" +implement +jsonize_val = jsonize_token +implement +jsonize_val = jsonize_sort1 + + implement jsonize_q1arg (x0) = +node("q1arg", res) where +val res = ( // case+ x0.node() of @@ -43,15 +51,18 @@ case+ x0.node() of jsonify("Q1ARGsome", ("tok", "opt"), ( jsonize(tok), - jsonize("...") //jsonize_option(opt) + jsonize_option(opt) ) ) // ) (* end of [jsonize_q1arg] *) +end implement jsonize_a1typ (x0) = +node("a1typ", res) where +val res = ( // case+ x0.node() of @@ -59,58 +70,76 @@ case+ x0.node() of jsonify("A1TYPsome", ("s1e", "opt"), ( jsonize(s1e), - jsonize("...") // jsonize_option(opt) + jsonize_option(opt) ) ) // ) (* end of [jsonize_a1typ] *) - +end local // +implement +jsonize_val = jsonize_a1typ + fun jsonize_a1typlstopt (opt: a1typlstopt): jsonval = ( case+ opt of | None() => jsonify("None") -| Some(a1ts) => jsonval_labval1("Some", jsonize("..."))// jsonize_list(a1ts)) +| Some(a1ts) => jsonval_labval1("Some", jsonize_list(a1ts)) ) // overload jsonize with jsonize_a1typlstopt of 100 // + +implement +jsonize_val = jsonize_s1qua + in (* in-of-local *) implement jsonize_d1arg (x0) = +node("d1arg", res) where +val res = ( // case+ x0.node() of // | D1ARGsome_sta(s1qs) => - jsonify("D1ARGsome_sta", "s1qs", jsonize("...")(* jsonize(s1qs) *)) + jsonify("D1ARGsome_sta", "s1qs", jsonize_list(s1qs)) // | D1ARGsome_dyn1(tok) => jsonify("D1ARGsome_dyn1", "tok", jsonize(tok)) | D1ARGsome_dyn2(arg0, opt1) => jsonify("D1ARGsome_dyn2", ("arg0", "opt1"), ( - jsonize("..."), //jsonize(arg0), - jsonize("...") //jsonize(opt1) + jsonize_list(arg0), + jsonize(opt1) ) ) // ) (* end of [jsonize_d1arg] *) - +end end // end of [local] +implement +jsonize_val = jsonize_s1qua +implement +jsonize_val = jsonize_s1exp +implement +jsonize_val = jsonize_q1arg + implement jsonize_f1arg (x0) = +node("f1arg", res) where +val res = ( // case+ @@ -122,17 +151,20 @@ x0.node() of | F1ARGsome_dyn(d1p0) => jsonify("F1ARGsome_dyn", "d1p0", jsonize(d1p0)) | F1ARGsome_sta(s1qs) => - jsonify("F1ARGsome_sta", "s1qs", jsonize("...")) + jsonify("F1ARGsome_sta", "s1qs", jsonize_list(s1qs)) | F1ARGsome_met(s1es) => - jsonify("F1ARGsome_met", "s1es", jsonize("...")) + jsonify("F1ARGsome_met", "s1es", jsonize_list(s1es)) // ) (* end of [jsonize_f1arg] *) +end (* ****** ****** *) implement jsonize_sq1arg (x0) = +node("sq1arg", res) where +val res = ( // case+ @@ -140,15 +172,18 @@ x0.node() of | SQ1ARGnone(tok) => jsonify("SQ1ARGnone", "tok", jsonize(tok)) | SQ1ARGsome(q1as) => - jsonify("SQ1ARGsome", "q1as", jsonize("...")) + jsonify("SQ1ARGsome", "q1as", jsonize_list(q1as)) // ) (* end of [jsonize_sq1arg] *) +end (* ****** ****** *) implement jsonize_ti1arg (x0) = +node("ti1arg", res) where +val res = ( // case+ @@ -156,15 +191,18 @@ x0.node() of | TI1ARGnone(tok) => jsonify("TI1ARGnone", "tok", jsonize(tok)) | TI1ARGsome(s1es) => - jsonify("TI1ARGsome", "s1es", jsonize("...")) + jsonify("TI1ARGsome", "s1es", jsonize_list(s1es)) // ) (* end of [jsonize_ti1arg] *) +end (* ****** ****** *) implement jsonize_tq1arg (x0) = +node("tq1arg", res) where +val res = ( // case+ @@ -172,20 +210,22 @@ x0.node() of | TQ1ARGnone(tok) => jsonify("TQ1ARGnone", "tok", jsonize(tok)) | TQ1ARGsome(q1as) => - jsonify("TQ1ARGsome", "q1as", jsonize("...")) + jsonify("TQ1ARGsome", "q1as", jsonize_list(q1as)) // ) (* end of [jsonize_tq1arg] *) - +end implement jsonize_val = jsonize_d1exp implement jsonize_val = jsonize_d1ecl - +implement jsonize_val = jsonize_f1arg implement jsonize_val = jsonize_s1exp implement jsonize_d1exp - (x0) = labval2(jsonize("d1exp"), res) where + (x0) = //labval2(jsonize("d1exp"), res) where +(* res where *) +node("d1exp", res) where { val res = ( @@ -246,7 +286,7 @@ case+ x0.node() of jsonify("D1Ebrack", "d1es", jsonize_list(d1es)) | D1Edtsel(lab1, arg2) => - jsonify("D1Edtsel", ("lab1", "arg2"), (jsonize(lab1), jstr("..."))) + jsonify("D1Edtsel", ("lab1", "arg2"), (jsonize(lab1), jsonize_option(arg2))) // | D1Elet(d1cs, d1es) => jsonify("D1Elet", ("d1cs", "d1es"), @@ -260,7 +300,7 @@ case+ x0.node() of // | D1Eif0(d1e1, d1e2, opt3) => jsonify("D1Eif0", ("d1e1", "d1e2", "opt3"), - (jsonize(d1e1), jsonize(d1e2), jsonize("...")) + (jsonize(d1e1), jsonize(d1e2), jsonize_option(opt3)) ) // | D1Ecase(knd, d1e1, dcls) => @@ -271,7 +311,13 @@ case+ x0.node() of | D1Elam (knd, farg, tres, arrw, body) => jsonify("D1Elam", ("knd", "farg", "tres", "arrw", "body"), - (jsonize(knd), jsonize("..."), jsonize("..."), jsonize("..."), jsonize("...")) + ( + jsonize(knd), + jsonize_list(farg), + jsonize(tres), + jsonize(arrw), + jsonize(body) + ) ) | D1Efix @@ -279,18 +325,18 @@ case+ x0.node() of jsonify( "D1Efix", ("knd", "fid", "farg", "tres", "arrw", "body"), ( jsonize(knd), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("...") + jsonize(fid), + jsonize_list(farg), + jsonize(tres), + jsonize(arrw), + jsonize(body) ) ) // | D1Erecord(tok, ld1es) => jsonify ( "D1Erecord", ("tok", "ld1es"), - (jsonize(tok), jsonize("...")) + (jsonize(tok), jsonize("...")) // jsonize_list(ld1es) ) | D1Erecord(tok, ld1es1, ld1es2) => jsonify ( @@ -298,7 +344,7 @@ case+ x0.node() of (jsonize(tok), jsonize("..."), jsonize("...")) ) | D1Eanno(d1e1, s1e2) => - jsonify("D1Eanno", ("d1e1", "s1e2"), (jsonize(d1e1), jsonize("..."))) + jsonify("D1Eanno", ("d1e1", "s1e2"), (jsonize(d1e1), jsonize(s1e2))) // | D1Equal(tok1, d1e2) => jsonify("D1Equal", ("tok1", "d1e2"), (jsonize(tok1), jsonize(d1e2))) @@ -309,18 +355,33 @@ case+ x0.node() of } +implement jsonize_val = jsonize_d1ecl implement jsonize_val = jsonize_d1exp implement jsonize_val = jsonize_v1aldecl -(* implement jsonize_val = jsonize_g1exp *) +implement jsonize_val = jsonize_v1ardecl +implement jsonize_val = jsonize_g1exp -(* implement jsonize_val = jsonize_g1marg *) -(* implement jsonize_val = jsonize_s1marg *) -(* implement jsonize_val = jsonize_t1marg *) +implement jsonize_val = jsonize_f1undecl +implement jsonize_val = jsonize_f1arg +implement jsonize_val = jsonize_ti1arg +implement jsonize_val = jsonize_tq1arg +implement jsonize_val = jsonize_sq1arg + +implement jsonize_val = jsonize_g1marg +implement jsonize_val = jsonize_s1marg +implement jsonize_val = jsonize_t1marg +implement jsonize_val = jsonize_t0int + +implement jsonize_val = jsonize_d1atype +implement jsonize_val = jsonize_d1tsort +implement jsonize_val = jsonize_d1cstdecl implement jsonize_d1ecl (x0) = +node("d1ecl", res) where +val res = ( case+ x0.node() of // @@ -341,8 +402,8 @@ case+ x0.node() of ( jsonize(tok), jsonize(sym), - jsonize("..."), //jsonize_list(arg), - jsonize("...") //jsonize_option(def) + jsonize_list(arg), + jsonize_option(def) ) ) | D1Cmacdef @@ -351,7 +412,7 @@ case+ x0.node() of ( jsonize(tok), jsonize(sym), - jsonize("..."), //jsonize_list(arg), + jsonize_list(arg), jsonize_option(def) ) ) @@ -382,8 +443,14 @@ case+ x0.node() of ( jsonify("D1Cstaload", ("tok", "src", "knd", "opt", "flag", "body"), - (jsonize(tok), jsonize(src), jsonize(knd), - jsonize("..."), jsonize(flag), jsonize(body)) + ( + jsonize(tok), + jsonize(src), + jsonize(knd), + jsonize("..."), + jsonize(flag), + jsonize(body) + ) ) ) where { @@ -403,7 +470,7 @@ case+ x0.node() of ( jsonize(tok), jsonize(sid), - jsonize("..."), //jsonize_list(tmas), + jsonize_list(tmas), jsonize(s0t) ) ) @@ -411,7 +478,7 @@ case+ x0.node() of | D1Csortdef (knd, tok, def) => jsonify("D1Csortdef", ("knd", "tok", "def"), - (jsonize(knd), jsonize(tok), jsonize("...")) + (jsonize(knd), jsonize(tok), jsonize(def)) ) // | D1Csexpdef @@ -420,8 +487,8 @@ case+ x0.node() of ( jsonize(knd), jsonize(sid), - jsonize("..."), //jsonize_list(arg), - jsonize("..."), + jsonize_list(arg), + jsonize_option(res), jsonize(def) ) ) @@ -432,8 +499,8 @@ case+ x0.node() of ( jsonize(knd), jsonize(sid), - jsonize("..."), //jsonize(arg), - jsonize("..."), //jsonize(res), + jsonize_list(arg), + jsonize_option(res), jsonize(def) ) ) @@ -443,16 +510,18 @@ case+ x0.node() of jsonify("D1Cabsimpl", ("tok", "sqid", "smas", "res0", "def1"), (jsonize(tok), jsonize(sqid), - jsonize("..."), //jsonize(smas), - jsonize("..."), //jsonize(res0), + jsonize_list(smas), + jsonize_option(res0), jsonize(def1)) ) // | D1Cvaldecl (tok, mods, d1cs) => jsonify("D1Cvaldecl", ("tok", "mods", "d1cs"), - (jsonize(tok), jsonize(mods), - jsonize("...") //jsonize_list(d1cs) + ( + jsonize(tok), + jsonize(mods), + jsonize_list(d1cs) ) ) // @@ -461,16 +530,18 @@ case+ x0.node() of ( jsonize(tok), jsonize(mopt), - jsonize("...") //jsonize_list(d1cs) + jsonize_list(d1cs) ) ) // | D1Cfundecl (tok, mopt, tqas, d1cs) => jsonify("D1Cfundecl", ("tok", "mopt", "tqas", "d1cs"), - (jsonize(tok), jsonize(mopt), - jsonize("..."), // jsonize(tqas), - jsonize("...") //jsonize(d1cs) + ( + jsonize(tok), + jsonize(mopt), + jsonize_list(tqas), + jsonize_list(d1cs) ) ) // @@ -481,13 +552,13 @@ case+ x0.node() of ( jsonize(tok), jsonize(mopt), - jsonize("..."), //jsonize(sqas), - jsonize("..."), //jsonize(tqas), + jsonize_list(sqas), + jsonize_list(tqas), jsonize(dqid), - jsonize("..."), //jsonize(tias), - jsonize("..."), //jsonize(f1as), - jsonize("..."), //jsonize(res0), - jsonize("..."), //jsonize(teq1), + jsonize_list(tias), + jsonize_list(f1as), + jsonize(res0), + jsonize(teq1), jsonize(d1e2) ) ) @@ -495,16 +566,15 @@ case+ x0.node() of | D1Csymload (knd, sym, dqid, tint) => jsonify("D1Csymload", ("knd", "sym", "dqid", "tint"), - (jsonize(knd), jsonize(sym), jsonize(dqid), - jsonize("...") //jsonize(tint) - ) + (jsonize(knd), jsonize(sym), jsonize(dqid), jsonize_option(tint)) ) // | D1Cdatasort (knd, d1tsts) => jsonify("D1Cdatasort", ("knd", "d1tsts"), - (jsonize(knd), - jsonize("...") //jsonize(d1tsts) + ( + jsonize(knd), + jsonize_list(d1tsts) ) ) // @@ -513,7 +583,7 @@ case+ x0.node() of jsonify("D1Cdatatype", ("knd", "d1typs", "wopt"), ( jsonize(knd), - jsonize("..."), //jsonize(d1typs), + jsonize_list(d1typs), jsonize(wopt) ) ) @@ -521,9 +591,10 @@ case+ x0.node() of | D1Cdynconst (tok, tqas, d1cs) => jsonify("D1Cdynconst", ("tok", "tqas", "d1cs"), - (jsonize(tok), - jsonize("..."), //jsonize(tqas), - jsonize("...") //jsonize(d1cs) + ( + jsonize(tok), + jsonize_list(tqas), + jsonize_list(d1cs) ) ) // @@ -531,8 +602,8 @@ case+ x0.node() of (d1cs_head, d1cs_body) => jsonify("D1Clocal", ("d1cs_head", "d1cs_body"), ( - jsonize("..."), //jsonize(d1cs_head), - jsonize("...") //jsonize(d1cs_body)) + jsonize_list(d1cs_head), + jsonize_list(d1cs_body) ) ) // @@ -545,18 +616,23 @@ case+ x0.node() of *) // ) (* end of [jsonize_d1ecl] *) +end local implement jsonize_val = jsonize_d1pat +implement +jsonize_val = jsonize_s1arg in (* in-of-local *) implement jsonize_d1pat (x0) = +node("d1pat", res) where +val res = ( case+ x0.node() of @@ -586,22 +662,36 @@ x0.node() of jsonify("D1Papps", ("d1p0", "d1p1", "d1p2"), (jsonize(d1p0), jsonize(d1p1), jsonize(d1p2))) // | D1Psarg(s1as) => - jsonify("D1Psarg", "s1as", jsonize("...")) + jsonify("D1Psarg", "s1as", jsonize_list(s1as)) // | D1Plist(d1ps) => - jsonify("D1Plist1", "d1ps", jsonize("...")) + jsonify("D1Plist1", "d1ps", jsonize_list(d1ps)) | D1Plist(d1ps1, d1ps2) => - jsonify("D1Plist2", ("d1ps1", "d1ps2"), (jsonize("..."), jsonize("..."))) + jsonify("D1Plist2", ("d1ps1", "d1ps2"), (jsonize_list(d1ps1), jsonize_list(d1ps2))) // | D1Ptuple(tok, d1ps) => - jsonify("D1Ptuple1", ("tok", "d1ps"), (jsonize(tok), jsonize("..."))) + jsonify("D1Ptuple1", ("tok", "d1ps"), (jsonize(tok), jsonize_list(d1ps))) | D1Ptuple(tok, d1ps1, d1ps2) => - jsonify("D1Ptuple2", ("tok", "d1ps1", "d1ps2"), (jsonize(tok), jsonize("..."), jsonize("..."))) + jsonify("D1Ptuple2", ("tok", "d1ps1", "d1ps2"), + ( + jsonize(tok), + jsonize_list(d1ps1), + jsonize_list(d1ps2) + ) + ) // | D1Precord(tok, ld1ps) => - jsonify("D1Precord1", ("tok", "ld1ps"), (jsonize(tok), jsonize("..."))) + jsonify("D1Precord1", ("tok", "ld1ps"), + (jsonize(tok), jsonize("...")) + ) | D1Precord(tok, ld1ps1, ld1ps2) => - jsonify("D1Precord2", ("tok", "ld1ps1", "ld1ps2"), (jsonize(tok), jsonize("..."), jsonize("..."))) + jsonify("D1Precord2", ("tok", "ld1ps1", "ld1ps2"), + ( + jsonize(tok), + jsonize("..."), + jsonize("...") + ) + ) // | D1Panno(d1p, s1e) => jsonify("D1Panno", ("d1p", "s1e"), (jsonize(d1p), jsonize(s1e))) @@ -610,6 +700,7 @@ x0.node() of jsonify("D1Pnone") // ) (* end of [jsonize_d1pat] *) +end end // end of [local] @@ -619,6 +710,8 @@ implement jsonize_val = jsonize_s1exp implement jsonize_f1unarrow (x0) = +node("f1unarrow", res) where +val res = ( case+ x0 of | F1UNARROWdflt() => @@ -626,11 +719,13 @@ case+ x0 of | F1UNARROWlist(s1es) => jsonify("F1UNARROWlist", "s1es", jsonize_list(s1es)) ) (* end of [jsonize_f1unarrow] *) - +end implement jsonize_teqd1expopt (x0) = +node("teqd1expopt", res) where +val res = ( case+ x0 of | TEQD1EXPnone() => @@ -639,11 +734,13 @@ case+ x0 of | TEQD1EXPsome(tok, d1e) => jsonify("TEQD1EXPsome", ("tok", "d1e"), (jsonize(tok), jsonize(d1e))) ) - +end implement jsonize_wths1expopt (x0) = +node("wths1expopt", res) where +val res = ( case+ x0 of | WTHS1EXPnone() => @@ -651,10 +748,13 @@ case+ x0 of | WTHS1EXPsome(tok, s1e) => jsonify("WTHS1EXPsome", ("tok", "s1e"), (jsonize(tok), jsonize(s1e))) ) +end implement jsonize_d1gua (x0) = +node("d1gua", res) where +val res = ( case+ x0.node() of @@ -663,11 +763,14 @@ x0.node() of | D1GUAmat(d1e, d1p) => jsonify("D1GUAexp", ("d1e", "d1p"), (jsonize(d1e), jsonize(d1p))) ) (* end of [jsonize_d1gua] *) +end implement jsonize_d1clau (x0) = +node("d1clau", res) where +val res = ( case+ x0.node() of @@ -676,23 +779,31 @@ x0.node() of | D1CLAUclau(d1gp, d0e0) => jsonify("D1CLAUclau", ("d1gp", "d0e0"), (jsonize(d1gp), jsonize(d0e0))) ) (* end of [jsonize_d1clau] *) +end + +implement +jsonize_val = jsonize_d1gua implement jsonize_d1gpat (x0) = +node("d1gpat", res) where +val res = ( case+ x0.node() of | D1GPATpat(d1p) => jsonify("D1GPATpat", "d1p", jsonize(d1p)) | D1GPATgua(d1p, d1gs) => - jsonify("D1GPATgua", ("d1p", "d1gs"), (jsonize(d1p), jsonize("..."))) + jsonify("D1GPATgua", ("d1p", "d1gs"), (jsonize(d1p), jsonize_list(d1gs))) ) (* end of [jsonize_d1gpat] *) - +end implement jsonize_abstdf1 (x0) = +node("abstdf1", res) where +val res = ( case+ x0 of | ABSTDF1some() => @@ -702,19 +813,21 @@ case+ x0 of | ABSTDF1eqeq(s0e) => jsonify("ABSTDF1eqeq", "s0e", jsonize(s0e)) ) (* end of [jsonize_abstdf1] *) - +end implement jsonize_wd1eclseq (x0) = +node("wd1eclseq", res) where +val res = ( case+ x0 of | WD1CSnone() => jsonify("WD1CSnone") | WD1CSsome(d1cs) => - jsonify("WD1CSsome", "d1cs", jsonize("...")) + jsonify("WD1CSsome", "d1cs", jsonize_list(d1cs)) ) (* end of [jsonize_wd1eclseq] *) - +end implement jsonize_v1aldecl @@ -723,13 +836,18 @@ jsonize_v1aldecl val+V1ALDECL(rcd) = x0 // in +node("v1aldecl", res) where +val res = + jsonify("V1ALDECL", ("pat", "def", "wtp"), ( jsonize(rcd.pat), - jsonize("..."), // jsonize(rcd.def), + jsonize_option(rcd.def), jsonize(rcd.wtp) ) ) +end + end // end of [jsonize_v1aldecl] @@ -740,14 +858,19 @@ jsonize_v1ardecl val+V1ARDECL(rcd) = x0 // in +node("v1ardecl", res) where +val res = + jsonify("V1ARDECL", ("nam", "wth", "res", "ini"), ( jsonize(rcd.nam), - jsonize("..."), // jsonize(rcd.wth), - jsonize("..."), // jsonize(rcd.res), + jsonize_option(rcd.wth), + jsonize_option(rcd.res), jsonize(rcd.ini) ) ) +end + end // end of [jsonize_v1ardecl] @@ -758,18 +881,23 @@ jsonize_f1undecl val+F1UNDECL(rcd) = x0 // in +node("f1undecl", res) where +val res = jsonify("F1UNDECL", ("nam", "arg", "res", "def", "wtp"), ( jsonize(rcd.nam), - jsonize("..."), // jsonize(rcd.arg), - jsonize("..."), // jsonize(rcd.res), - jsonize("..."), // jsonize(rcd.def), + jsonize_list(rcd.arg), + jsonize(rcd.res), + jsonize_option(rcd.def), jsonize(rcd.wtp) ) ) +end end // end of [jsonize_f1undecl] +implement jsonize_val = jsonize_d1arg + implement jsonize_d1cstdecl (x0) = let @@ -777,13 +905,16 @@ jsonize_d1cstdecl val+D1CSTDECL(rcd) = x0 // in +node("d1cstdecl", res) where +val res = jsonify( "D1CSTDEC", ("nam", "arg", "res", "def"), ( jsonize(rcd.nam), - jsonize("..."), // jsonize(rcd.arg), - jsonize("..."), // jsonize(rcd.res), + jsonize_list(rcd.arg), + jsonize(rcd.res), jsonize(rcd.def) ) ) +end end // end of [jsonize_d1cstdecl] diff --git a/contrib/sparverius/xjsonize/DATS/dynexp2.dats b/contrib/sparverius/xjsonize/DATS/dynexp2.dats index fdf5c78e8..95be888a1 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp2.dats @@ -18,11 +18,14 @@ #staload "./../SATS/json.sats" #staload _ = "./json.dats" +#staload "./../SATS/lexing.sats" +#staload "./../SATS/locinfo.sats" + +#staload "./../SATS/label0.sats" + #staload "./../SATS/dynexp0.sats" #staload "./../SATS/staexp0.sats" -#staload "./../SATS/lexing.sats" #staload "./../SATS/dynexp1.sats" -#staload "./../SATS/label0.sats" #staload "./../SATS/dynexp2.sats" @@ -39,6 +42,10 @@ overload jsonize with $SYM_J.jsonize_symbol overload jsonize with $STM_J.jsonize_stamp +implement +jsonize_val = jsonize_s2exp + + implement jsonize_val = jsonize_d2con @@ -46,33 +53,8 @@ implement jsonize_d2con (x0) = ( -(* - labval2(nd,vl) where - { - val nd = jstr("d2con") - val sym = $SYM_J.jsonize_symbol(x0.sym()) - val stamp = $STM_J.jsonize_stamp(x0.stamp()) - val vl = list_cons(sym, list_sing(stamp)) - val vl = JSONlist(vl) - } -*) -(* - jsonval_labval1("d2con", rst) where - { - val sym = $SYM_J.jsonize_symbol(x0.sym()) - val stamp = $STM_J.jsonize_stamp(x0.stamp()) - val rst = JSONlist($list{jsonval}(sym, stamp)) - } -*) - -(* - jsonval_conarg2("d2con", sym, stamp) where - val sym = $SYM_J.jsonize_symbol(x0.sym()) - val stamp = $STM_J.jsonize_stamp(x0.stamp()) - end -*) - jsonval_labval1("d2con", rst) where - (* labval2(jsonize("d2con"), rst) where *) + (* jsonval_labval1("d2con", rst) where *) + node("d2con", rst) where val lst = $list{labjsonval}($SYM_J.labify_symbol(x0.sym()), $STM_J.labify_stamp(x0.stamp())) val rst = JSONlablist(lst) end @@ -86,18 +68,10 @@ implement jsonize_d2cst (x0) = ( -(* - labval2(nd, vl) where - { - val nd = jstr("d2cst") - val sym = $SYM_J.jsonize_symbol(x0.sym()) - val stamp = $STM_J.jsonize_stamp(x0.stamp()) - val vl = list_cons(sym, list_sing(stamp)) - val vl = JSONlist(vl) - } -*) - jsonval_labval1("d2cst", rst) where - (* labval2(jsonize("d2var"), rst) where *) + (* jsonval_labval1("d2cst", rst) where *) + (* node("d2cst", rst) where *) + node2("d2cst", jsonize(x0.loc()), rst) where + (* rst where *) val lst = $list{labjsonval}( $SYM_J.labify_symbol(x0.sym()), $STM_J.labify_stamp(x0.stamp()) ) @@ -115,20 +89,10 @@ jsonize_val = jsonize_d2var implement jsonize_d2var (x0) = -(* -( - labval2(nd, vl) where - { - val nd = jstr("d2var") - val sym = $SYM_J.jsonize_symbol(x0.sym()) - val stamp = $STM_J.jsonize_stamp(x0.stamp()) - val vl = list_cons(sym, list_sing(stamp)) - val vl = JSONlist(vl) - } -) -*) - jsonval_labval1("d2var", rst) where - (* labval2(jsonize("d2var"), rst) where *) + (* jsonval_labval1("d2var", rst) where *) + (* node("d2var", rst) where *) + node2("d2var", jsonize(x0.loc()), rst) where + (* rst where *) val lst = $list{labjsonval}( $SYM_J.labify_symbol(x0.sym()), $STM_J.labify_stamp(x0.stamp()) ) @@ -138,11 +102,26 @@ jsonize_d2var implement jsonize_val = jsonize_f2arg +implement +jsonize_val = jsonize_d2pat +implement +jsonize_val = jsonize_s2var +implement +jsonize_val = jsonize_s2exp + implement jsonize_f2arg - (x0) = let + (x0) = +(* jsonval_labval1("f2arg", rst) where *) +(* res where *) +(* node("f2arg", res) where *) +node2("f2arg", jsonize(x0.loc()), res) where +(* +let in +*) +val res = ( // case+ @@ -152,11 +131,20 @@ x0.node() of jsonize("F2ARGnone", "tok", jsonize(tok)) *) | F2ARGsome_met(s2es) => - jsonify("F2ARGsome_met", "s2es", jsonize("...")) + jsonify("F2ARGsome_met", "s2es", jsonize_list(s2es)) | F2ARGsome_dyn(npf, d2ps) => - jsonify("F2ARGsome_dyn", ("npf", "d2ps"), (jsonize(npf), jsonize("..."))) + jsonify("F2ARGsome_dyn", ("npf", "d2ps"), + (jsonval_labval1("npf", jsonize(npf)), + jsonize_list(d2ps) + ) + ) | F2ARGsome_sta(s2vs, s2ps) => - jsonify("F2ARGsome_sta", ("s2vs", "s2ps"), (jsonize("..."), jsonize("..."))) + jsonify("F2ARGsome_sta", ("s2vs", "s2ps"), + ( + jsonize_list(s2vs), + jsonize_list(s2ps) + ) + ) ) end @@ -175,8 +163,10 @@ jsonize_val = jsonize_d2pitm implement jsonize_d2pat (x0) = +(* jsonval_labval1("d2pat", res) where *) // labval2(jsonize("d2pat"), res) where -res where +(* res where *) +node("d2pat", res) where val res = ( case- x0.node() of @@ -209,12 +199,12 @@ case- x0.node() of ) | D2Pdapp(d2f0, npf0, d2ps) => jsonify("D2Pdapp", ("d2f0", "npf0", "d2ps"), - (jsonize(d2f0), jsonize(npf0), jsonize_list(d2ps)) + (jsonize(d2f0), jsonval_labval1("npf", jsonize(npf0)), jsonize_list(d2ps)) ) // | D2Ptuple(knd, npf, d2ps) => jsonify("D2Ptuple", ("knd", "npf", "d2ps"), - (jsonize(knd), jsonize(npf), jsonize_list(d2ps)) + (jsonize(knd), jsonval_labval1("npf", jsonize(npf)), jsonize_list(d2ps)) ) // | D2Panno(d2p1, s2e2) => @@ -249,8 +239,9 @@ jsonize_val = jsonize_effs2expopt implement jsonize_d2exp (x0) = -// jsonify("d2exp", res) where -res where +(* jsonval_labval1("d2exp", res) where *) +(* res where *) +node("d2exp", res) where val res = ( case- x0.node() of @@ -296,7 +287,7 @@ case- x0.node() of (d2f0, npf0, d2as) => jsonify( "D2Edapp", ("d2f0", "npf0", "d2as"), - (jsonize(d2f0), jsonize(npf0), jsonize_list(d2as))) + (jsonize(d2f0), jsonval_labval1("npf", jsonize(npf0)), jsonize_list(d2as))) // | D2Elet (d2cs, d2e2) => @@ -313,7 +304,7 @@ case- x0.node() of | D2Etuple (knd, npf, d2es) => jsonify("D2Etuple", ("knd", "npf", "d2es"), - (jsonize(knd), jsonize(npf), jsonize_list(d2es))) + (jsonize(knd), jsonval_labval1("npf", jsonize(npf)), jsonize_list(d2es))) // | D2Eassgn (d2e1, d2e2) => @@ -330,7 +321,7 @@ case- x0.node() of ( jsonize(lab0), jsonize_list(dpis), - jsonize(npf2), + jsonval_labval1("npf", jsonize(npf2)), jsonize_list(d2es) ) ) @@ -388,6 +379,9 @@ end // end of where + + + local implement @@ -399,20 +393,40 @@ jsonize_val = jsonize_v2ardecl implement jsonize_val = jsonize_f2undecl +implement +jsonize_val = jsonize_f2arg +implement +jsonize_val = jsonize_ti2arg +implement +jsonize_val = jsonize_tq2arg +implement +jsonize_val = jsonize_sq2arg + +overload jsonize with jsonize_loc_t of 1 + in (* in-of-local *) implement jsonize_d2ecl (x0) = +(* jsonval_labval1("d2ecl", res) where *) +(* res where *) +(* node("d2ecl", res) where *) +node2("d2ecl", jsonize(x0.loc()), res) where +(* +val _ = $showtype(x0.loc()) +val _ = $showtype((x0.loc()).beg_ntot()) +*) +val res = ( case- x0.node() of // | D2Cstatic (tok, d2c) => - jsonify("D2static", "d2c", jsonize(d2c)) + jsonify("D2Cstatic", "d2c", jsonize(d2c)) | D2Cextern (tok, d2c) => - jsonify("D2extern", ("tok", "d2c"), (jsonize(tok), jsonize(d2c))) + jsonify("D2Cextern", ("tok", "d2c"), (jsonize(tok), jsonize(d2c))) // | D2Cinclude ( tok @@ -491,7 +505,7 @@ case- x0.node() of ), ( jsonize(knd), - jsonize("..."), + jsonize(sqid), jsonize(def0) ) ) @@ -507,7 +521,7 @@ case- x0.node() of ( jsonize(tok), jsonize(sym0), - jsonize("...") + jsonize(dpi1) (* jsonize("...") *) ) ) // @@ -521,7 +535,7 @@ case- x0.node() of ( jsonize(knd), jsonize(mopt), - jsonize("...") + jsonize_list(v2ds) (* jsonize("...") *) ) ) @@ -535,8 +549,8 @@ case- x0.node() of ( jsonize(knd), jsonize(mopt), - jsonize("..."), - jsonize("...") + jsonize_list(tqas), + jsonize_list(f2ds) ) ) @@ -556,15 +570,15 @@ case- x0.node() of "knd", "mopt", "sqas", "tqas", "dqid", "tias", "f2as", "res0", "d2e1" ), ( - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("...") + jsonize(knd), + jsonize(mopt), + jsonize_list(sqas), + jsonize_list(tqas), + jsonize(dqid), + jsonize_list(tias), + jsonize_list(f2as), + jsonize(res0), + jsonize(d2e1) ) ) | D2Cimpdecl2 @@ -576,15 +590,15 @@ case- x0.node() of "knd", "mopt", "sqas", "tqas", "dqid", "tias", "f2as", "res0", "d2e1" ), ( - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("..."), - jsonize("...") + jsonize(knd), + jsonize(mopt), + jsonize_list(sqas), + jsonize_list(tqas), + jsonize(dqid), + jsonize_list(tias), + jsonize_list(f2as), + jsonize(res0), + jsonize(d2e1) ) ) // @@ -601,9 +615,9 @@ case- x0.node() of "knd", "tqas", "d2cs" ), ( - jsonize("..."), - jsonize("..."), - jsonize("...") + jsonize(knd), + jsonize_list(tqas), + jsonize_list(d2cs) ) ) // @@ -613,6 +627,7 @@ case- x0.node() of jsonify("D2Csortdef", "d1csrc", jsonize(d1csrc)) // ) (* end of [jsonize_d2ecl] *) +end end // end of [local] @@ -621,6 +636,9 @@ end // end of [local] implement jsonize_d2itm (x0) = +(* jsonval_labval1("d2itm", res) where *) +node("d2itm", res) where +val res = ( case+ x0 of // @@ -637,10 +655,15 @@ case+ x0 of jsonify("D2ITMsym", ("sym", "dpis"), (jsonize(sym), jsonize_list(dpis))) // ) (* end of [jsonize_d2itm] *) +end implement jsonize_d2pitm (x0) = +(* jsonval_labval1("d2pitm", res) where *) +(* res where *) +node("d2pitm", res) where +val res = ( case+ x0 of | D2PITMnone(dqid) => @@ -648,7 +671,7 @@ case+ x0 of | D2PITMsome(pval, d2i0) => jsonify("D2PITMsome", ("pval", "d2i0"), (jsonize(pval), jsonize(d2i0))) ) (* end of [jsonize_d2pitm] *) - +end local @@ -661,26 +684,29 @@ implement jsonize_sq2arg (x0) = ( - jsonval_labval1("sq2arg", jsonize_list(x0.s2vs())) + (* jsonval_labval1("sq2arg", jsonize_list(x0.s2vs())) *) + node("sq2arg", jsonize_list(x0.s2vs())) ) (* end of [jsonize_sq2arg] *) -end implement jsonize_tq2arg (x0) = ( - jsonval_labval1("tq2arg", jsonize(x0)) + (* jsonval_labval1("tq2arg", jsonize_list(x0.s2vs())) *) + node("tq2arg", jsonize_list(x0.s2vs())) ) (* end of [jsonize_tq2arg] *) +end implement jsonize_ti2arg (x0) = ( - jsonify("ti2arg", "s2es", jsonize("...")) - (* where val _ = $showtype(x0.s2es()) end *) + (* jsonify("ti2arg", "s2es", jsonize("...")) *) + (* jsonval_labval1("ti2arg", jsonize_list(x0.s2es())) *) + node("ti2arg", jsonize_list(x0.s2es())) ) (* end of [jsonize_ti2arg] *) @@ -694,6 +720,10 @@ in implement jsonize_impld2cst (x0) = +(* jsonval_labval1("impld2cst", res) where *) +(* res where *) +node("impld2cst", res) where +val res = ( case+ x0 of | @@ -708,6 +738,23 @@ IMPLD2CST2(dqid, d2cs, opt2) => ) ) ) // end of [jsonize_impld2cst] +end + +implement +jsonize_impls2cst + (x0) = +node("impls2cst", res) where +val res = +( +case+ x0 of +| IMPLS2CST1(sqid, s2cs) => + jsonify("IMPLS2CST1", ("sqid", "s2cs"), (jsonize("..."), jsonize("..."))) +| IMPLS2CST2(sqid, s2cs, opt2) => + jsonify("IMPLS2CST2", ("sqid", "s2cs", "opt2"), + (jsonize("..."), jsonize("..."), jsonize("...")) + ) +) // end of [jsonize_impls2cst] +end end @@ -715,6 +762,10 @@ end implement jsonize_d2clau (x0) = +(* jsonval_labval1("d2clau", res) where *) +(* res where *) +node("d2clau", res) where +val res = ( case+ x0.node() of @@ -723,10 +774,15 @@ x0.node() of | D2CLAUexp(d2gp, d0e0) => jsonify("D2CLAUexp", ("d2gp", "d0e0"), (jsonize(d2gp), jsonize(d0e0))) ) +end implement jsonize_d2gpat (x0) = +(* jsonval_labval1("d2gpat", res) where *) +(* res where *) +node("d2gpat", res) where +val res = ( case+ x0.node() of @@ -735,3 +791,71 @@ x0.node() of | D2GPATgua(d2p, d2gs) => jsonify("D2GPATgua", ("d2p", "d2gs"), (jsonize(d2p), jsonize("..."))) ) +end + +implement +jsonize_v2aldecl + (x0) = let +// +val+V2ALDECL(rcd) = x0 +// +in + node("v2aldecl", res) where + (* node2("v2arlecl", jsonize(rcd.loc), res) where *) + val res = + jsonify("V2ALDECL", ("pat", "def", "wtp"), + ( + jsonize(rcd.pat), + jsonize_option(rcd.def), + jsonize_option(rcd.wtp) + ) + ) + end +end // end of [jsonize_v2aldecl] + + +implement +jsonize_v2ardecl + (x0) = let +// +val+V2ARDECL(rcd) = x0 +// +in + node("v2ardecl", res) where + (* node2("v2ardecl", jsonize(rcd.loc), res) where *) + val res = + jsonify( + "V2ARDECL", ("d2v", "wth", "res", "ini"), + ( + jsonize(rcd.d2v), + jsonize_option(rcd.wth), + jsonize_option(rcd.res), + jsonize_option(rcd.ini) + ) + ) + end +end // end of [jsonize_v2ardecl] + + +implement +jsonize_f2undecl + (x0) = let +// +val+F2UNDECL(rcd) = x0 +// +in + node("f2undecl", res) where + (* node2("f2undecl", jsonize(rcd.loc), res) where *) + val res = + jsonify("F2UNDECL", ("nam", "d2c", "arg", "res", "def", "wtp"), + ( + jsonize(rcd.nam), + jsonize(rcd.d2c), + jsonize_list(rcd.arg), + jsonize(rcd.res), + jsonize_option(rcd.def), + jsonize_option(rcd.wtp) + ) + ) + end +end // end of [jsonize_f2undecl] diff --git a/contrib/sparverius/xjsonize/DATS/interp0.dats b/contrib/sparverius/xjsonize/DATS/interp0.dats index b2af8ecc2..6bd509e31 100644 --- a/contrib/sparverius/xjsonize/DATS/interp0.dats +++ b/contrib/sparverius/xjsonize/DATS/interp0.dats @@ -101,8 +101,11 @@ UN = "prelude/SATS/unsafe.sats" #staload _ = "./json.dats" +implement jsonize_val = jsonize_d0ecl +implement jsonize_val = jsonize_d1ecl implement jsonize_val = jsonize_d2ecl + (* #dynload "./json.dats" *) (* #dynload "./basics.dats" *) (* #dynload "./stamp0.dats" *) @@ -770,6 +773,13 @@ println! ("process_fpath: d0cs = ", d0cs) *) // +val () = println!("\n\n", "JSONIZED", "\n\n") +val json = jsonize_list(d0cs) +val () = fprint_jsonval(stdout_ref, json) +val () = println!() + + + val () = synread_main(d0cs) // val @@ -779,6 +789,10 @@ val () = println! ("process_fpath: d1cs = ", d1cs) *) +val () = println!("\n\n", "JSONIZED", "\n\n") +val json = jsonize_list(d1cs) +val () = fprint_jsonval(stdout_ref, json) +val () = println!() // val () = t1xread_main(d1cs) // diff --git a/contrib/sparverius/xjsonize/DATS/intrep0.dats b/contrib/sparverius/xjsonize/DATS/intrep0.dats index 8c20e66e4..844d90cc4 100644 --- a/contrib/sparverius/xjsonize/DATS/intrep0.dats +++ b/contrib/sparverius/xjsonize/DATS/intrep0.dats @@ -34,6 +34,8 @@ implement jsonize_ir0pat (x0) = +node("ir0pat", res) where +val res = ( case+ x0.node() of // @@ -61,7 +63,7 @@ case+ x0.node() of jsonify("IR0Pnone1", "d3p", jsonize("...")) // ) // end of [jsonize_ir0pat] - +end implement jsonize_val(x) = jsonize_ir0pat(x) @@ -71,7 +73,10 @@ jsonize_ir0arg let val+IR0ARGsome(npf, irps) = x0 in +node("ir0arg", res) where +val res = jsonify("IR0ARGsome", ("npf", "irps"), (jsonize(npf), jsonize_list(irps))) +end end // end of [jsonize_ir0arg] @@ -88,10 +93,10 @@ in // implement jsonize_ir0exp(x0) = -(* - jsonval_labval1("ir0exp", res) where -*) -res where val res = +(* jsonval_labval1("ir0exp", res) where *) +(* res where val res = *) +node("ir0exp", res) where +val res = ( case+ x0.node() of @@ -160,6 +165,9 @@ x0.node() of (jsonize(ire1), jsonize_list(irds)) ) // +| IR0Eseqn + (ires, ire1) => + jsonify("IR0Eseqn", ("ires", "ire1"), (jsonize_list(ires), jsonize(ire1))) | IR0Etuple (knd0, npf1, ires) => jsonify( @@ -219,6 +227,8 @@ end // end of local implement jsonize_ir0gua (x0) = +node("ir0gua", res) where +val res = ( case+ x0.node() of @@ -232,11 +242,13 @@ x0.node() of ) ) ) (* end of [jsonize_ir0gua] *) - +end implement jsonize_ir0clau (x0) = +node("ir0clau", res) where +val res = ( case+ x0.node() of @@ -248,13 +260,15 @@ x0.node() of jsonify("IR0CLAUpat", ("ir0gp", "d0e0"), (jsonize("..."), jsonize("..."))) // ) (* end of [jsonize_ir0clau] *) - +end implement jsonize_val = jsonize_ir0gua implement jsonize_ir0gpat (x0) = +node("ir0gpat", res) where +val res = ( case+ x0.node() of @@ -270,7 +284,7 @@ x0.node() of ) // ) (* end of [jsonize_ir0gpat] *) - +end implement jsonize_val = jsonize_ir0dcl implement jsonize_val = jsonize_ir0fundecl @@ -283,6 +297,8 @@ implement jsonize_val = jsonize_ir0vardecl implement jsonize_ir0dcl(x0) = +node("ir0dcl", res) where +val res = ( case+ x0.node() of // @@ -356,7 +372,7 @@ case+ x0.node() of jsonify("IR0Cnone1", "d3cl", jsonize("...")) // ) // end of [jsonize_ir0dcl] - +end implement jsonize_val = jsonize_ir0exp @@ -367,10 +383,13 @@ jsonize_ir0vardecl val+IR0VARDECL(rcd) = x0 // in +node("ir0vardecl", res) where +val res = jsonify ( "IR0VARDECL", ("d2v", "ini"), (jsonize(rcd.d2v), jsonize_option(rcd.ini)) ) +end end // end of [jsonize_ir0vardecl] @@ -381,6 +400,8 @@ jsonize_ir0valdecl val+IR0VALDECL(rcd) = x0 // in +node("ir0valdecl", res) where +val res = jsonify("IR0VALDECL", ("pat", "def"), ( jsonize(rcd.pat), defopt @@ -392,6 +413,7 @@ in | Some(x) => jsonize(x) ) end +end end // end of [jsonize_ir0valdecl] @@ -404,6 +426,8 @@ jsonize_ir0fundecl val+IR0FUNDECL(rcd) = x0 // in +node("ir0fundecl", res) where +val res = jsonify( "IR0FUNDECL", ("nam", "d2c", "a2g", "a3g", "def"), (jsonize(rcd.nam), jsonize(rcd.d2c), jsonize_list(rcd.a2g), ja3g, jdef) @@ -420,4 +444,5 @@ in | Some(x) => jsonize_list(rcd.a2g) ) end +end end // end of [jsonize_ir0fundecl] diff --git a/contrib/sparverius/xjsonize/DATS/json.dats b/contrib/sparverius/xjsonize/DATS/json.dats index e9485bf8f..e00f256a4 100644 --- a/contrib/sparverius/xjsonize/DATS/json.dats +++ b/contrib/sparverius/xjsonize/DATS/json.dats @@ -8,8 +8,10 @@ UN = "prelude/SATS/unsafe.sats" implement jsonval_int (i) = JSONint (i) -(* implement *) -(* jsonval_intinf (i) = JSONintinf (i) *) +(* +implement +jsonval_intinf (i) = JSONintinf (i) +*) implement jsonval_bool (b) = JSONbool (b) @@ -88,6 +90,24 @@ jsonval_labval8 ( (l1, x1) :: (l2, x2) :: (l3, x3) :: (l4, x4) :: (l5, x5) :: (l6, x6) :: (l7, x7) :: (l8, x8) :: list_nil ) +implement +jsonval_labval9 +( + l1, x1, l2, x2, l3, x3, l4, x4, l5, x5, l6, x6, l7, x7, l8, x8, l9, x9 +) = JSONlablist +( + (l1, x1) :: (l2, x2) :: (l3, x3) :: (l4, x4) :: (l5, x5) :: (l6, x6) :: (l7, x7) :: (l8, x8) + :: (l9, x9) :: list_nil +) +implement +jsonval_labval10 +( + l1, x1, l2, x2, l3, x3, l4, x4, l5, x5, l6, x6, l7, x7, l8, x8, l9, x9, l10, x10 +) = JSONlablist +( + (l1, x1) :: (l2, x2) :: (l3, x3) :: (l4, x4) :: (l5, x5) :: (l6, x6) :: (l7, x7) :: (l8, x8) + :: (l9, x9) :: (l10, x10) :: list_nil +) // (* ****** ****** *) // @@ -206,12 +226,14 @@ case+ x0 of | JSONnul () => prstr "{}" // | JSONint (i) => fprint_int (out, i) -(* | JSONintinf (i) => *) -(* { *) -(* val () = fprint_char (out, '"') *) -(* val () = $INTINF.fprint_intinf (out, i) *) -(* val () = fprint_char (out, '"') *) -(* } *) +(* +| JSONintinf (i) => + { + val () = fprint_char (out, '"') + val () = $INTINF.fprint_intinf (out, i) + val () = fprint_char (out, '"') + } +*) // | JSONbool (b) => fprint_bool (out, b) | JSONfloat (d) => fprint_double (out, d) @@ -333,6 +355,13 @@ end // end of [fprint_labjsonvalist] (* ****** ****** *) +implement +print_jsonval(x) = fprint_jsonval(stdout_ref, x) +implement +prerr_jsonval(x) = fprint_jsonval(stderr_ref, x) + +implement fprint_val = fprint_jsonval + (* ****** ****** *) // @@ -418,7 +447,6 @@ implement jsonize_val(x) = jsonize_double(x) implement{a} jsonize_list(xs) = JSONlist(res) where { - (* val _ = $showtype(xs) *) val xys = list_map(xs) where { implement list_map$fopr(x) = jsonize_val(x) @@ -454,238 +482,345 @@ implement(a:t@ype) jsonize_list(xs) = JSONlist(res) where } *) -(* implement(a:t@ype) jsonize_val(xs) = jsonize_list(xs) *) +(* +implement(a:t@ype) jsonize_val(xs) = jsonize_list(xs) +*) implement listj(x) = JSONlist(list_sing(x)) implement listj2(x, y) = JSONlist(cons(x, cons(y, nil()))) -implement labval2(x, y) = jsonval_labval2("node", x, "val", y) +implement node(x, y) = + jsonval_labval1(x, y) + (* jsonval_labval2("node", jsonize(x), "json", y) *) + (* jsonval_labval2("node", jsonize(x), "val", y) *) -implement jsonify0(guard_name) = JSONstring(guard_name) +implement node2(x, y, z) = + jsonval_labval1(x, z) + (* jsonval_labval3("name", jsonize(x), "loc", y, "node", z) *) + (* jsonval_labval2("node", jsonize(x), "json", z) *) +implement jsonify0(guard_name) = JSONstring(guard_name) implement jsonify1(guard_name, name, json) = -jsonval_labval1(guard_name, rst) where - val rst = jsonval_labval1(name, json) - val rst = json -end - -implement jsonify2(guard_name, names, json) = -jsonval_labval1(guard_name, rst) where + jsonval_labval1(guard_name, json) (* - val rst = jsonval_labval2 ( - names.0, json.0, - names.1, json.1 - ) +jsonval_labval1(guard_name, jsonval_labval1(name, json)) *) - val lst = $list{labjsonval}( - (names.0, json.0), - (names.1, json.1) + +fun jsontyp(xs: jsonval): string = +( + case+ xs of + | JSONnul() => "JSONnul" + | JSONint(int) => "JSONint" + | JSONbool(bool) => "JSONbool" + | JSONfloat(double) => "JSONfloat" + | JSONstring(string) => "JSONstring" + | JSONlist(jsonvalist) => "JSONlist" + | JSONlablist(labjsonvalist) => "JSONlablist" + | JSONoption(jsonvalopt) => "JSONoption" +) + +#define JSON_OUTPUT 0 + +implement jsonify2(guard_name, names, json) = +jsonval_labval1(guard_name, rst) where + val rst = + ( + case JSON_OUTPUT of + | 0 => JSONlist($list{jsonval}(json.0, json.1)) + | 1 => + ( + jsonval_labval2 ( + names.0, json.0, + names.1, json.1 + ) + ) + | _ => ( + JSONlablist($list{labjsonval}( + (names.0, json.0), + (names.1, json.1) + )) + ) ) - val rst = JSONlablist(lst) - val rst = JSONlist($list{jsonval}(json.0, json.1)) end implement jsonify3(guard_name, names, json) = jsonval_labval1(guard_name, rst) where -(* - val rst = jsonval_labval3 ( - names.0, json.0, - names.1, json.1, - names.2, json.2 - ) -*) - - val lst = $list{labjsonval}( - (names.0, json.0), - (names.1, json.1), - (names.2, json.2) - ) - val rst = JSONlablist(lst) - val rst = JSONlist($list{jsonval}(json.0, json.1, json.2)) -end + val rst = + ( + case JSON_OUTPUT of + | + 0 => ( + JSONlist($list{jsonval}(json.0, json.1, json.2)) + ) + | 1 => ( + jsonval_labval3 ( + names.0, json.0, + names.1, json.1, + names.2, json.2 + ) + ) + | _ => ( + JSONlablist($list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2) + )) + ) + )end implement jsonify4(guard_name, names, json) = jsonval_labval1(guard_name, rst) where -(* - val rst = jsonval_labval4 ( - names.0, json.0, - names.1, json.1, - names.2, json.2, - names.3, json.3 - ) -*) - val lst = $list{labjsonval}( - (names.0, json.0), - (names.1, json.1), - (names.2, json.2), - (names.3, json.3) + val rst = + ( + case JSON_OUTPUT of + | 0 => ( + JSONlist($list{jsonval}(json.0, json.1, json.2, json.3)) + ) + | 1 => ( + jsonval_labval4 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3 + ) + ) + | _ => ( + JSONlablist($list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3) + )) + ) ) - val rst = JSONlablist(lst) - val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3)) end implement jsonify5 (guard_name, names, json) = jsonval_labval1(guard_name, rst) where -(* - val rst = jsonval_labval5 ( - names.0, json.0, - names.1, json.1, - names.2, json.2, - names.3, json.3, - names.4, json.4 - ) -*) - val lst = $list{labjsonval}( - (names.0, json.0), - (names.1, json.1), - (names.2, json.2), - (names.3, json.3), - (names.4, json.4) + val rst = + ( + case JSON_OUTPUT of + | 0 => ( + JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4)) + ) + | 1 => ( + jsonval_labval5 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4 + ) + ) + | _ => ( + JSONlablist($list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4) + )) + ) ) - val rst = JSONlablist(lst) - val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4)) end implement jsonify6 (guard_name, names, json) = jsonval_labval1(guard_name, rst) where -(* - val rst = jsonval_labval6 ( - names.0, json.0, - names.1, json.1, - names.2, json.2, - names.3, json.3, - names.4, json.4, - names.5, json.5 - ) -*) - val lst = $list{labjsonval}( - (names.0, json.0), - (names.1, json.1), - (names.2, json.2), - (names.3, json.3), - (names.4, json.4), - (names.5, json.5) + val rst = + ( + case JSON_OUTPUT of + | 0 => ( + JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5)) + ) + | 1 => ( + jsonval_labval6 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4, + names.5, json.5 + ) + ) + | _ => ( + JSONlablist($list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4), + (names.5, json.5) + )) + ) ) - val rst = JSONlablist(lst) - val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5)) end implement jsonify7 (guard_name, names, json) = jsonval_labval1(guard_name, rst) where -(* - val rst = jsonval_labval7 ( - names.0, json.0, - names.1, json.1, - names.2, json.2, - names.3, json.3, - names.4, json.4, - names.5, json.5, - names.6, json.6 - ) -*) - val lst = $list{labjsonval}( - (names.0, json.0), - (names.1, json.1), - (names.2, json.2), - (names.3, json.3), - (names.4, json.4), - (names.5, json.5), - (names.6, json.6) + val rst = + ( + case JSON_OUTPUT of + | 0 => ( + JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6)) + ) + | 1 => ( + jsonval_labval7 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4, + names.5, json.5, + names.6, json.6 + ) + ) + | _ => ( + JSONlablist($list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4), + (names.5, json.5), + (names.6, json.6) + )) + ) ) - val rst = JSONlablist(lst) - val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6)) end implement jsonify8 (guard_name, names, json) = jsonval_labval1(guard_name, rst) where -(* - val rst = jsonval_labval8 ( - names.0, json.0, - names.1, json.1, - names.2, json.2, - names.3, json.3, - names.4, json.4, - names.5, json.5, - names.6, json.6, - names.7, json.7 - ) -*) - val lst = $list{labjsonval}( - (names.0, json.0), - (names.1, json.1), - (names.2, json.2), - (names.3, json.3), - (names.4, json.4), - (names.5, json.5), - (names.6, json.6), - (names.7, json.7) + val rst = + ( + case JSON_OUTPUT of + | 0 => ( + JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6, json.7)) + ) + | 1 => ( + jsonval_labval8 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4, + names.5, json.5, + names.6, json.6, + names.7, json.7 + ) + ) + | _ => ( + JSONlablist($list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4), + (names.5, json.5), + (names.6, json.6), + (names.7, json.7) + )) + ) ) - val rst = JSONlablist(lst) - val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6, json.7)) end implement jsonify9 (guard_name, names, json) = jsonval_labval1(guard_name, rst) where -(* - val rst = jsonval_labval8 ( - names.0, json.0, - names.1, json.1, - names.2, json.2, - names.3, json.3, - names.4, json.4, - names.5, json.5, - names.6, json.6, - names.7, json.7 - ) -*) - val lst = $list{labjsonval}( - (names.0, json.0), - (names.1, json.1), - (names.2, json.2), - (names.3, json.3), - (names.4, json.4), - (names.5, json.5), - (names.6, json.6), - (names.7, json.7), - (names.8, json.8) + val rst = + ( + case JSON_OUTPUT of + | 0 => ( + JSONlist($list{jsonval}( + json.0, + json.1, + json.2, + json.3, + json.4, + json.5, + json.6, + json.7, + json.8 + )) + ) + | 1 => ( + jsonval_labval9 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4, + names.5, json.5, + names.6, json.6, + names.7, json.7, + names.8, json.8 + ) + ) + | _ => ( + JSONlablist($list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4), + (names.5, json.5), + (names.6, json.6), + (names.7, json.7), + (names.8, json.8) + )) + ) ) - val rst = JSONlablist(lst) - val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6, json.7, json.8)) end implement jsonify10 (guard_name, names, json) = jsonval_labval1(guard_name, rst) where -(* - val rst = jsonval_labval8 ( - names.0, json.0, - names.1, json.1, - names.2, json.2, - names.3, json.3, - names.4, json.4, - names.5, json.5, - names.6, json.6, - names.7, json.7 + val rst = + ( + case JSON_OUTPUT of + | 0 => ( + JSONlist($list{jsonval}( + json.0, + json.1, + json.2, + json.3, + json.4, + json.5, + json.6, + json.7, + json.8, + json.9 + )) + ) + | 1 => ( + jsonval_labval10 ( + names.0, json.0, + names.1, json.1, + names.2, json.2, + names.3, json.3, + names.4, json.4, + names.5, json.5, + names.6, json.6, + names.7, json.7, + names.8, json.8, + names.9, json.9 + ) + ) + | _ => ( + JSONlablist($list{labjsonval}( + (names.0, json.0), + (names.1, json.1), + (names.2, json.2), + (names.3, json.3), + (names.4, json.4), + (names.5, json.5), + (names.6, json.6), + (names.7, json.7), + (names.8, json.8), + (names.9, json.9) + )) + ) ) -*) - val lst = $list{labjsonval}( - (names.0, json.0), - (names.1, json.1), - (names.2, json.2), - (names.3, json.3), - (names.4, json.4), - (names.5, json.5), - (names.6, json.6), - (names.7, json.7), - (names.8, json.8), - (names.9, json.9) -) - val rst = JSONlablist(lst) - val rst = JSONlist($list{jsonval}(json.0, json.1, json.2, json.3, json.4, json.5, json.6, json.7, json.8, json.9)) end - -(* implement jsonify(guard_name: string, args: List(@(string, json))): jsonval = *) diff --git a/contrib/sparverius/xjsonize/DATS/label0.dats b/contrib/sparverius/xjsonize/DATS/label0.dats index 9a67d1211..a110c67c8 100644 --- a/contrib/sparverius/xjsonize/DATS/label0.dats +++ b/contrib/sparverius/xjsonize/DATS/label0.dats @@ -52,7 +52,8 @@ case+ l0 of implement jsonize_label - (l0) = labval2(jsonize("label"), rst) where + (l0) = //labval2(jsonize("label"), rst) where + jsonval_labval1("label", rst) where val rst = ( case+ label_get_int(l0) of diff --git a/contrib/sparverius/xjsonize/DATS/lexing_token.dats b/contrib/sparverius/xjsonize/DATS/lexing_token.dats index a1b81f915..7fdbe5bdd 100644 --- a/contrib/sparverius/xjsonize/DATS/lexing_token.dats +++ b/contrib/sparverius/xjsonize/DATS/lexing_token.dats @@ -7,6 +7,8 @@ #staload _ = "./json.dats" #staload "./../SATS/lexing.sats" +#staload "./../SATS/locinfo.sats" +#staload "./../SATS/basics.sats" #staload SYM_J = "./../SATS/symbol.sats" @@ -15,7 +17,9 @@ overload jsonize with $SYM_J.jsonize_symbol implement jsonize_tnode(tnd) = //labval2(jsonize("tnode"), res) where -jsonval_labval1("tnode", res) where +//jsonval_labval1("tnode", res) where +(* res where *) +node("tnode", res) where val res = ( case+ tnd of @@ -26,79 +30,86 @@ case+ tnd of | T_EOL() => jsonize("EOL") // | T_BLANK(x) => - labval2(jsonize("BLANK"), jnul()) // x, ")") + jsonify("BLANK", "x", jsonize(x)) // | T_CLNLT(x) => - labval2(jsonize("CLNLT"), jnul()) // x, ")") + jsonify("CLNLT", "x", jsonize(x)) | T_DOTLT(x) => - labval2(jsonize("DOTLT"), jnul()) // x, ")") + jsonify("DOTLT", "x", jsonize(x)) // | T_IDENT_alp(x) => - labval2(jsonize("IDENT_alp"), jnul()) // x, ")") + jsonify("IDENT_alp", "x", jsonize(x)) | T_IDENT_sym(x) => - labval2(jsonize("IDENT_sym"), jnul()) // x, ")") + jsonify("IDENT_sym", "x", jsonize(x)) // | T_IDENT_srp(x) => - labval2(jsonize("IDENT_srp"), jnul()) // x, ")") + jsonify("IDENT_srp", "x", jsonize(x)) | T_IDENT_dlr(x) => - labval2(jsonize("IDENT_dlr"), jnul()) // x, ")") + jsonify("IDENT_dlr", "x", jsonize(x)) // | T_IDENT_qual(x) => - labval2(jsonize("IDENT_qual"), jnul()) // x, ")") + jsonify("IDENT_qual", "x", jsonize(x)) // | T_INT1(rep) => - labval2(jsonize("INT1"), jnul()) // rep, ")") + jsonify("INT1", "rep", jsonize(rep)) | T_INT2(base, rep) => - labval2(jsonize("INT3"), jnul()) // base, ", ", rep, ")") + jsonify("INT3", ("base", "rep"), (jsonize(base), jsonize(rep))) | T_INT3(base, rep, k0(*sfx*)) => - labval2(jsonize("INT3"), jnul()) // base, ", ", rep, ", ", k0, ")") + jsonify("INT3", ("base", "rep", "k0"), + (jsonize(base), jsonize(rep), jsonize(k0))) // | T_FLOAT1(rep) => - labval2(jsonize("FLOAT1"), jnul()) // rep, ")") + jsonify("FLOAT1", "rep", jsonize(rep)) | T_FLOAT2(base, rep) => - labval2(jsonize("FLOAT2"), jnul()) // base, ", ", rep, ")") + jsonify("FLOAT2", ("base", "rep"), (jsonize(base), jsonize(rep))) + | T_FLOAT3(base, rep, k0(*sfx*)) => - labval2(jsonize("FLOAT3"), jnul()) // base, ", ", rep, ", ", k0, ")") + jsonify("FLOAT3", ("base", "rep", "k0"), + (jsonize(base), jsonize(rep), jsonize(k0))) // (* | T_CHAR(chr) => let val chr = int2char0(chr) in - labval2(jsonize("CHAR"), jnul()) // chr, ")") + jsonify("CHAR"), jnul()) // chr, ")") end *) | T_CHAR_nil(rep) => - labval2(jsonize("CHAR_nil"), jnul()) // rep, ")") + jsonify("CHAR_nil", "rep", jsonize(rep)) | T_CHAR_char(rep) => - labval2(jsonize("CHAR_char"), jnul()) // rep, ")") + jsonify("CHAR_char", "rep", jsonize(rep)) | T_CHAR_slash(rep) => - labval2(jsonize("CHAR_slash"), jnul()) // rep, ")") + jsonify("CHAR_slash", "rep", jsonize(rep)) // | T_STRING_closed(str) => - labval2(jsonize("STRING_closed"), jnul()) // str, ")") + jsonify("STRING_closed", "str", jsonize(str)) | T_STRING_unclsd(str) => - labval2(jsonize("STRING_unclsd"), jnul()) // str, ")") + jsonify("STRING_unclsd", "str", jsonize(str)) // (* -| T_CDATA(cdata, asz) => labval2(jsonize("CDATA(...)") +| T_CDATA(cdata, asz) => jsonify(("CDATA(...)") *) // | T_SPECHAR(c) => - labval2(jsonize("SPECHAR"), jnul()) // int2char0(c), ")") + jsonify("SPECHAR", "c", jsonize(int2char0(c))) // | T_COMMENT_line (init, content) => - labval2(jsonize("T_COMMENT_line"), jnul()) // init, "; ", "...)") + jsonify("T_COMMENT_line", ("init", "content"), + (jsonize(init), jsonize(content))) | T_COMMENT_rest (init, content) => - labval2(jsonize("T_COMMENT_rest"), jnul()) // init, "; ", "...)") + jsonify("T_COMMENT_rest", ("init", "content"), + (jsonize(init), jsonize(content))) | T_COMMENT_cblock (level, content) => - labval2(jsonize("T_COMMENT_cblock"), jnul()) // level, "; ", "...)") + jsonify("T_COMMENT_cblock", ("level", "content"), + (jsonize(level), jsonize(content))) | T_COMMENT_mlblock (level, content) => - labval2(jsonize("T_COMMENT_mlblock"), jnul()) // level, "; ", "...)") + jsonify("T_COMMENT_mlblock", ("level", "content"), + (jsonize(level), jsonize(content))) // | T_AT() => jsonize("AT") // @@ -145,12 +156,12 @@ case+ tnd of | T_RBRACK() => jsonize("RBRACK") // | T_EXISTS(knd) => - labval2(jsonize("EXISTS"), jnul()) // knd, ")") + jsonify("EXISTS", "knd", jsonize(knd)) // | T_TUPLE(knd) => - labval2(jsonize("TUPLE"), jnul()) // knd, ")") + jsonify("TUPLE", "knd", jsonize(knd)) | T_RECORD(knd) => - labval2(jsonize("RECORD"), jnul()) // knd, ")") + jsonify("RECORD", "knd", jsonize(knd)) (* | T_STRUCT() => jsonize("STRUCT") *) @@ -162,101 +173,101 @@ case+ tnd of | T_OP() => jsonize("OP") // | T_OP_par() => - jsonize("OP_par()") + jsonify("OP_par") | T_OP_sym(id) => - labval2(jsonize("OP_sym"), jnul()) // id, ")") + jsonify("OP_sym", "id",jsonize(id)) // -| T_IN() => jsonize("IN") +| T_IN() => jsonify("IN") // -| T_AND() => jsonize("AND") -| T_END() => jsonize("END") +| T_AND() => jsonify("AND") +| T_END() => jsonify("END") // -| T_IF() => jsonize("IF") -| T_SIF() => jsonize("SIF") -| T_THEN() => jsonize("THEN") -| T_ELSE() => jsonize("ELSE") +| T_IF() => jsonify("IF") +| T_SIF() => jsonify("SIF") +| T_THEN() => jsonify("THEN") +| T_ELSE() => jsonify("ELSE") // -| T_WHEN() => jsonize("WHEN") -| T_WITH() => jsonize("WITH") +| T_WHEN() => jsonify("WHEN") +| T_WITH() => jsonify("WITH") // | T_CASE(k0) => - labval2(jsonize("CASE"), jnul()) // k0, ")") + jsonify("CASE", "k0", jsonize(k0)) // -| T_SCASE() => jsonize("SCASE()") +| T_SCASE() => jsonify("SCASE") // -| T_ENDIF() => jsonize("ENDIF") -| T_ENDSIF() => jsonize("ENDSIF") -| T_ENDCASE() => jsonize("ENDCASE") -| T_ENDSCASE() => jsonize("ENDSCASE") +| T_ENDIF() => jsonify("ENDIF") +| T_ENDSIF() => jsonify("ENDSIF") +| T_ENDCASE() => jsonify("ENDCASE") +| T_ENDSCASE() => jsonify("ENDSCASE") // | T_LAM(knd) => - labval2(jsonize("LAM"), jnul()) // knd, ")") + jsonify("LAM", "knd", jsonize(knd)) | T_FIX(knd) => - labval2(jsonize("FIX"), jnul()) // knd, ")") + jsonify("FIX", "knd", jsonize(knd)) // -| T_LET() => jsonize("LET") -| T_WHERE() => jsonize("WHERE") -| T_LOCAL() => jsonize("LOCAL") +| T_LET() => jsonify("LET") +| T_WHERE() => jsonify("WHERE") +| T_LOCAL() => jsonify("LOCAL") // -| T_ENDLAM() => jsonize("ENDLAM") -| T_ENDLET() => jsonize("ENDLET") -| T_ENDWHERE() => jsonize("ENDWHERE") -| T_ENDLOCAL() => jsonize("ENDLOCAL") +| T_ENDLAM() => jsonify("ENDLAM") +| T_ENDLET() => jsonify("ENDLET") +| T_ENDWHERE() => jsonify("ENDWHERE") +| T_ENDLOCAL() => jsonify("ENDLOCAL") // | T_VAL(vlk) => - labval2(jsonize("VAL"), jnul()) // vlk, ")") -| T_VAR() => jsonize("VAR") + jsonify("VAL", "vlk", jsonize(vlk)) +| T_VAR() => jsonify("VAR") // | T_FUN(fnk) => - labval2(jsonize("FUN"), jnul()) // fnk, ")") + jsonify("FUN", "fnk", jsonize(fnk)) // | T_IMPLMNT(knd) => - labval2(jsonize("IMPLMNT"), jnul()) // knd, ")") + jsonify("IMPLMNT", "knd", jsonize(knd)) // | T_ABSSORT() => - jsonize("ABSSORT") + jsonify("ABSSORT") // | T_SORTDEF() => - labval2(jsonize("SORTDEF"), jnul()) // ")") + jsonify("SORTDEF") // | T_SEXPDEF(srt) => - labval2(jsonize("SEXPDEF"), jnul()) // srt, ")") + jsonify("SEXPDEF", "srt", jsonize(srt)) // | T_ABSTYPE(srt) => - labval2(jsonize("ABSTYPE"), jnul()) // srt, ")") + jsonify("ABSTYPE", "srt", jsonize(srt)) // | T_ABSIMPL() => - jsonize("ABSIMPL") + jsonify("ABSIMPL") | T_ABSOPEN() => - jsonize("ABSOPEN") + jsonify("ABSOPEN") // | T_DATASORT() => - jsonize("DATASORT") + jsonify("DATASORT") | T_DATATYPE(srt) => - labval2(jsonize("DATATYPE"), jnul()) // srt, ")") + jsonify("DATATYPE", "srt", jsonize(srt)) // | T_WITHTYPE(srt) => - labval2(jsonize("WITHTYPE"), jnul()) // srt, ")") + jsonify("WITHTYPE", "srt", jsonize(srt)) // | T_SRP_NONFIX() => - jsonize("#NONFIX") + jsonify("#NONFIX") | T_SRP_FIXITY(knd) => - labval2(jsonize("#FIXIXTY"), jnul()) // knd, ")") + jsonify("#FIXIXTY", "knd", jsonize(knd)) // -| T_SRP_STACST() => jsonize("#STACST") +| T_SRP_STACST() => jsonify("#STACST") // -| T_SRP_STATIC() => jsonize("#STATIC") -| T_SRP_EXTERN() => jsonize("#EXTERN") +| T_SRP_STATIC() => jsonify("#STATIC") +| T_SRP_EXTERN() => jsonify("#EXTERN") // -| T_SRP_DEFINE() => jsonize("#DEFINE") -| T_SRP_MACDEF() => jsonize("#MACDEF") +| T_SRP_DEFINE() => jsonify("#DEFINE") +| T_SRP_MACDEF() => jsonify("#MACDEF") // -| T_SRP_INCLUDE() => jsonize("#INCLUDE") +| T_SRP_INCLUDE() => jsonify("#INCLUDE") // -| T_SRP_STALOAD() => jsonize("#STALOAD") -| T_SRP_DYNLOAD() => jsonize("#DYNLOAD") +| T_SRP_STALOAD() => jsonify("#STALOAD") +| T_SRP_DYNLOAD() => jsonify("#DYNLOAD") // -| T_SRP_SYMLOAD() => jsonize("#SYMLOAD") +| T_SRP_SYMLOAD() => jsonify("#SYMLOAD") // ) (* end of [jsonize_tnode] *) end @@ -264,4 +275,15 @@ end implement jsonize_token(tok) = (* labval2(jsonize("token"), jsonize_tnode(tok.node())) *) - jsonval_labval1("token", jsonize_tnode(tok.node())) + (* jsonval_labval1("token", jsonize_tnode(tok.node())) *) + (* jsonify("token", ("loc", "tok"), (jsonize(tok.loc()), jsonize_tnode(tok.node()))) *) +(* + node("token", JSONlist( + $list{jsonval}( + jsonize_location(tok.loc()), + jsonize_tnode(tok.node()) + ) + )) +*) + +node2("token", jsonize_location(tok.loc()), jsonize_tnode(tok.node())) diff --git a/contrib/sparverius/xjsonize/DATS/locinfo.dats b/contrib/sparverius/xjsonize/DATS/locinfo.dats index dc42d82e9..a01dbc6be 100644 --- a/contrib/sparverius/xjsonize/DATS/locinfo.dats +++ b/contrib/sparverius/xjsonize/DATS/locinfo.dats @@ -16,9 +16,98 @@ #staload "./../SATS/locinfo.sats" +implement labify_loc_t(loc) = @("loc", jsonize_loc_t(loc)) + +implement +jsonize_loc_t(loc) = +( + JSONlablist($list{labjsonval}( + ("path", + jsonize($FIL.filpath_get_full1(loc.filpath())) + ), + ("beg", jsonize(loc.beg_ntot()+1)) + (* JSONlablist($list{labjsonval}( *) + (* ("chrs", jsonize(loc.beg_ntot()+1)), *) + (* ("line", jsonize(loc.beg_nrow()+1)), *) + (* ("offs", jsonize(loc.beg_ncol())) *) + (* )) *) + (* ) *) + , + ("end", jsonize(loc.end_ntot()+1)) + (* JSONlablist($list{labjsonval}( *) + (* ("chrs", jsonize(loc.end_ntot()+1)), *) + (* ("line", jsonize(loc.end_nrow()+1)), *) + (* ("offs", jsonize(loc.end_ncol())) *) + (* )) *) + (* ) *) + )) +) + + +implement +jsonize_locrange(loc) = +( + (* jsonval_labval1("pos", *) +(* + JSONlablist($list{labjsonval}( + ("beg", + JSONlablist($list{labjsonval}( + ("chrs", jsonize(loc.beg_ntot()+1)), + ("line", jsonize(loc.beg_nrow()+1)), + ("offs", jsonize(loc.beg_ncol())) + )) + ), + ("end", + JSONlablist($list{labjsonval}( + ("chrs", jsonize(loc.end_ntot()+1)), + ("line", jsonize(loc.end_nrow()+1)), + ("offs", jsonize(loc.end_ncol())) + )) + ) + )) +*) + JSONlablist($list{labjsonval}( + ("path", jsonize($FIL.filpath_get_full1(loc.filpath()))), + ("beg", jsonize(loc.beg_ntot()+1)), + ("end", jsonize(loc.end_ntot()+1)) + )) + + (* ) *) +) + +(* implement jsonize_location(loc) = res where val fp0 = location_filpath(loc) val jfil = jsonize($FIL.filpath_get_full1(fp0)) val res = jsonval_labval1("loc", jfil) end +*) + +(* +implement +jsonize_location(loc) = res where + val fp0 = location_filpath(loc) + val jfil = jsonize($FIL.filpath_get_full1(fp0)) + val res = jsonval_labval1("loc", jfil) + + val res = node("loc", rst) where + val fst = ("path", jfil) + val snd = ("pos", jsonize_locrange(loc)) + val rst = JSONlablist($list{labjsonval}(fst, snd)) + end +end +*) + +implement +jsonize_location(loc) = res where + val fp0 = location_filpath(loc) + val jfil = jsonize($FIL.filpath_get_full1(fp0)) + (* val res = jsonval_labval1("loc", jfil) *) + + (* val fst = ("path", jfil) *) + (* val snd = ("pos", jsonize_locrange(loc)) *) + (* val res = JSONlablist($list{labjsonval}(fst, snd)) *) + + val res = jsonize_locrange(loc) +end diff --git a/contrib/sparverius/xjsonize/DATS/staexp0.dats b/contrib/sparverius/xjsonize/DATS/staexp0.dats index 3f8d7b5aa..ca1643a40 100644 --- a/contrib/sparverius/xjsonize/DATS/staexp0.dats +++ b/contrib/sparverius/xjsonize/DATS/staexp0.dats @@ -764,7 +764,7 @@ case+ x0.node() of (* val _ = $showtype(argopt) *) val jargopt = ( case+ argopt of - | None() => jsonize("None") + | None() => jsonify("None") | Some(x) => jsonize(x) ) end diff --git a/contrib/sparverius/xjsonize/DATS/staexp1.dats b/contrib/sparverius/xjsonize/DATS/staexp1.dats index 52ebb03e9..609ae6431 100644 --- a/contrib/sparverius/xjsonize/DATS/staexp1.dats +++ b/contrib/sparverius/xjsonize/DATS/staexp1.dats @@ -25,6 +25,84 @@ overload jsonize with $SYM_J.jsonize_symbol +implement +jsonize_val = jsonize_s1exp + +implement +jsonize_val = jsonize_token + + +local + +implement +jsonize_val = jsonize_g1exp + +in (* in-of-local *) + +implement +jsonize_g1exp + (x0) = +node("g1exp", res) where +val res = +( +case+ x0.node() of +// +| G1Eid(tok) => + jsonify("G1Eid", "tok", jsonize(tok)) +// +| G1Eint(int) => + jsonify("G1Eint", "int", jsonize(int)) +// +| G1Eapp() => + jsonify("G1Eapp") +// +| G1Eapp1 + (g1e0, g1e1) => + jsonify("G1Eapp1", ("g1e0", "g1e1"), (jsonize(g1e0), jsonize(g1e1))) +| G1Eapp2 + (g1e0, g1e1, g1e2) => + jsonify("G1Eapp2", ("g1e0", "g1e1", "g1e2"), + (jsonize(g1e0), jsonize(g1e1), jsonize(g1e2)) + ) +// +| G1Elist(g1es) => + jsonify("G1Elist", "g1es", jsonize_list(g1es)) +// +| G1Enone(loc) => + jsonify("G1Enone") +// +) (* end of [jsonize_g1exp] *) +end + +end // end of [local] + + +local + +implement +jsonize_val = jsonize_token + +in(* in-of-local *) + +implement +jsonize_g1marg + (x0) = +node("g1marg", res) where +val res = +( +case+ +x0.node() of +| G1MARGsarg(g1as) => + jsonify("G1MARGsarg", "g1as", jsonize_list(g1as)) +| G1MARGdarg(g1as) => + jsonify("G1MARGdarg", "g1as", jsonize_list(g1as)) +) (* end of [jsonize_g1marg] *) +end + +end // end of [local] + + + local implement @@ -35,6 +113,8 @@ in (* in-of-local *) implement jsonize_sort1 (x0) = +node("sort1", res) where +val res = ( case+ x0.node() of // @@ -80,10 +160,182 @@ case+ x0.node() of jsonify("S1Tnone") // ) (* end of [jsonize_sort1] *) +end end // end of [local] +implement +jsonize_val = jsonize_sort1 +implement +jsonize_val = jsonize_s1rtcon + + +implement +jsonize_s1rtcon + (x0) = +node("s1rtcon", res) where +val res = +( +case+ x0.node() of +| S1RTCON(sid, opt) => + jsonify("S1RTCON", ("sid", "opt"), + ( + jsonize(sid), + jsonize_option(opt) + ) + ) +) (* end of [jsonize_s1rtcon] *) +end + + + +implement +jsonize_d1tsort + (x0) = +node("d1sort", res) where +val res = +( +case+ x0.node() of +| D1TSORT(tid, s1cs) => + jsonify("D1TSORT", ("tid", "s1cs"), + (jsonize(tid), jsonize_list(s1cs)) + ) +) (* end of [jsonize_d1tsort] *) +end + +implement +jsonize_s1rtdef + (x0) = +node("s1rtdef", res) where +val res = +( +case+ x0.node() of +| S1RTDEFsort(s1t) => + jsonify("S1RTDEFsort", "s1t", jsonize(s1t)) +| S1RTDEFsbst(s1a0, s1es) => + jsonify("S1RTDEFsbst(", ("s1a0", "s1es"), (jsonize(s1a0), jsonize_list(s1es))) +) (* end of [jsonize_s1rtdef] *) +end + +implement +jsonize_s1arg + (x0) = +node("s1arg", res) where +val res = +( +case+ +x0.node() of +(* +| S1ARGnone() => + jsonify("S1ARGnone()") +*) +| S1ARGsome(tok, opt) => + jsonify("S1ARGsome(", ("tok", "opt"), (jsonize(tok), jsonize_option(opt))) +) (* jsonize_s1arg *) +end + +local + +implement +jsonize_val = jsonize_s1arg + +in (* in-of-local *) + +implement +jsonize_s1marg + (x0) = +node("s1marg", res) where +val res = +( +case+ +x0.node() of +(* +| S1MARGnone _ => ... +| S1MARGsing _ => ... +*) +| S1MARGlist(s1as) => + jsonify("S1MARGlist", "s1as", jsonize_list(s1as)) +) (* jsonize_s1marg *) +end + +end // end of [local] + + +implement jsonize_val = jsonize_t1arg + +implement +jsonize_t1arg + (x0) = +node("t1arg", res) where +val res = +( +case+ +x0.node() of +(* +| T1ARGnone() => + jsonify("T1ARGnone") +*) +| T1ARGsome(tok, opt) => + jsonify("T1ARGsome", ("tok", "opt"), (jsonize(tok), jsonize_option(opt))) +) (* jsonize_t1arg *) +end + +local + +implement +jsonize_val = jsonize_t1arg + +in (* in-of-local *) + +implement +jsonize_t1marg + (x0) = +node("t1marg", res) where +val res = +( +case+ +x0.node() of +(* +| T1MARGnone _ => ... +*) +| T1MARGlist(t1as) => + jsonify("T1MARGlist", "t1as", jsonize_list(t1as)) +) (* jsonize_t1marg *) +end + +end // end of [local] + + +implement +jsonize_s1qua + (x0) = +node("", res) where +val res = +( +case+ x0.node() of +| S1QUAprop(s1e) => + jsonify("S1QUAprop(", "s1e", jsonize(s1e)) +| S1QUAvars(ids, opt) => + jsonify("S1QUAvars(", ("ids", "opt"), (jsonize_list(ids), jsonize_option(opt))) +) +end + +implement +jsonize_val = jsonize_s1qua + +implement +jsonize_s1uni + (x0) = +node("s1uni", res) where +val res = +( +case+ x0.node() of +| S1UNIsome(s1qs) => + jsonify("S1UNIsome", "s1qs", jsonize_list(s1qs)) +) +end + local @@ -95,6 +347,8 @@ in (* in-of-local *) implement jsonize_s1exp (x0) = +node("", res) where +val res = ( case+ x0.node() of // @@ -173,5 +427,70 @@ case+ x0.node() of jsonify("S1Enone", "loc", jsonize("...")) // ) (* jsonize_s0exp *) +end end // end of [local] + + +implement +jsonize_effs1expopt + (x0) = +node("effs1expopt", res) where +val res = +( +case+ x0 of +| EFFS1EXPnone() => + jsonify("EFFS1EXPnone") +| EFFS1EXPsome(s1e) => + jsonify("EFFS1EXPsome", "s1e", jsonize(s1e)) +(* +| EFFS1EXPsome(s1f, s1e) => + jsonify("EFFS1EXPsome", ("s1f", "s1e"), (jsonize(s1f), jsonize(s1e))) +*) +) (* end of [jsonize_effs1expopt] *) +end + +implement +jsonize_val = jsonize_t1marg +implement +jsonize_val = jsonize_d1atcon +implement +jsonize_val = jsonize_s1uni + +implement +jsonize_d1atype + (x0) = +node("d1atype", res) where +val res = +( +case+ x0.node() of +| D1ATYPE(tok, arg, res, d1cs) => + jsonify("D1ATYPE", ("tok", "arg", "res", "d1cs"), + ( + jsonize(tok), + jsonize_list(arg), + jsonize_option(res), + jsonize_list(d1cs) + ) + ) +) (* end of [jsonize_d1atype] *) +end + +implement +jsonize_d1atcon + (x0) = +node("d1atcon", res) where +val res = +( +case+ x0.node() of +| D1ATCON(s1us, tok, s1is, argopt) => + jsonify("D1ATCON", ("s1us", "tok", "s1is", "argopt"), + ( + jsonize_list(s1us), + jsonize(tok), + jsonize_list(s1is), + jsonize_option(argopt) + ) + ) +) (* end of [jsonize_d1atcon] *) +end diff --git a/contrib/sparverius/xjsonize/DATS/staexp2.dats b/contrib/sparverius/xjsonize/DATS/staexp2.dats index deb03fe37..911989839 100644 --- a/contrib/sparverius/xjsonize/DATS/staexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/staexp2.dats @@ -37,6 +37,8 @@ overload jsonize with $STM.jsonize_stamp overload jsonize with $LAB.jsonize_label +overload labify with $SYM.labify_symbol + local @@ -48,6 +50,8 @@ in (* in-of-local *) implement jsonize_sort2 (s2t0) = +node("sort2", res) where +val res = ( case+ s2t0 of // @@ -84,6 +88,51 @@ case+ s2t0 of | S2Tnone1(s1tsrc) => jsonify("S2Tnone1", "s1tsrc", jsonize(s1tsrc)) ) (* end of [jsonize_sort2] *) +end + + +implement +labify_sort2 + (s2t0) = +@("sort2", res) where +val res = +( +case+ s2t0 of +// +| S2Tid(id) => + jsonify("S2Tid", "id", jsonize(id)) +| S2Tint(i0) => + jsonify("S2Tint", "i0", jsonize(i0)) +| S2Tbas(s2tb) => + jsonify("S2Tbas", "s2tb", jsonize(s2tb)) +| S2Ttup() => + jsonify("S2Ttup") +| S2Ttup(s2ts) => + jsonify("S2tup", "s2ts", jsonize_list(s2ts)) +| S2Tfun() => + jsonify("S2Tfun") +| S2Tfun(s2ts, s2t1) => + jsonify("S2fun", + ("s2ts", "s2t1"), + ( + jsonize_list(s2ts), + jsonize(s2t1) + ) + ) +| S2Tapp(s2t1, s2ts) => + jsonify("S2app", + ("s2t1", "s2ts"), + ( + jsonize(s2t1), + jsonize_list(s2ts) + ) + ) +| S2Tnone0() => + jsonify("S2Tnone0") +| S2Tnone1(s1tsrc) => + jsonify("S2Tnone1", "s1tsrc", jsonize(s1tsrc)) +) (* end of [labify_sort2] *) +end end // end of [local] @@ -91,6 +140,8 @@ end // end of [local] implement jsonize_t2bas (s2tb) = +node("t2bas", res) where +val res = ( case+ s2tb of | T2BASpre(sym) => @@ -100,24 +151,41 @@ case+ s2tb of | T2BASdat(dat) => jsonify("T2BASabs", "dat", jsonize(dat)) | T2BASimp(knd, sym) => - jsonify("T2BASimp", ("knd", "sym"), (jsonize(knd), jsonize(sym))) +(* + jsonify("T2BASimp", ("knd", "sym"), + ( + jsonval_labval1("knd", jsonize(knd)), // jsonize(knd), + jsonize(sym) + ) + ) +*) + jsonval_labval1("T2BASabs", + JSONlablist($list{labjsonval}( + ("knd", jsonize(knd)), + labify(sym) + ) + ) + ) ) - +end implement jsonize_t2abs(x0) = -jsonval_labval1("t2abs", jsonize(x0.sym())) +(* jsonval_labval1("t2abs", jsonize(x0.sym())) *) +node("t2abs", jsonize(x0.sym())) implement jsonize_t2dat(x0) = -jsonval_labval1("t2dat", $SYM.jsonize_symbol(x0.sym())) +(* jsonval_labval1("t2dat", $SYM.jsonize_symbol(x0.sym())) *) +node("t2dat", $SYM.jsonize_symbol(x0.sym())) implement jsonize_s2cst (x0) = - jsonval_labval1("s2cst", rst) where + (* jsonval_labval1("s2cst", rst) where *) + node("s2cst", rst) where val lst = $list{labjsonval}( $SYM.labify_symbol(x0.sym()), $STM.labify_stamp(x0.stamp()) ) @@ -129,6 +197,7 @@ jsonize_s2cst implement jsonize_s2var (x0) = +(* jsonval_labval2("s2var", rst, "sort", jsrt) where val lst = $list{labjsonval}( $SYM.labify_symbol(x0.sym()), @@ -137,11 +206,24 @@ jsonval_labval2("s2var", rst, "sort", jsrt) where val rst = JSONlablist(lst) val jsrt = jsonize(x0.sort()) end +*) +node("s2var", rst) where + val lst = $list{labjsonval}( + $SYM.labify_symbol(x0.sym()), + $STM.labify_stamp(x0.stamp()), + labify_sort2(x0.sort()) + ) + val rst = JSONlablist(lst) + (* val jsrt = jsonize(x0.sort()) *) + end + implement jsonize_tyrec (knd) = +node("tyrec", res) where +val res = ( case+ knd of // @@ -160,7 +242,7 @@ case+ knd of jsonify("TYRECflt2", "nam", jsonize(nam)) // ) (* end of [jsonize_tyrec] *) - +end @@ -178,6 +260,8 @@ in (* in-of-local *) implement jsonize_s2exp (s2e0) = +node("s2exp", res) where +val res = ( case+ s2e0.node() of @@ -252,7 +336,7 @@ s2e0.node() of ), ( jsonize(fc2), - jsonize(npf), + jsonval_labval1("npf", jsonize(npf)), //jsonize(npf), jsonize_list(arg), jsonize(res) ) @@ -364,7 +448,7 @@ s2e0.node() of ), ( jsonize(knd), - jsonize(npf), + jsonval_labval1("npf", jsonize(npf)), // jsonize(npf), jsonize_list(ls2es) ) ) @@ -388,6 +472,7 @@ s2e0.node() of | S2Enone1(s1esrc) => jsonify("S2Enone1", "s1esrc", jsonize(s1esrc)) ) (* end of [jsonize_s2exp] *) +end end // end of [local] @@ -395,6 +480,8 @@ end // end of [local] implement jsonize_labs2exp (ls2e) = +node("labs2exp", res) where +val res = ( case+ ls2e of | SLABELED(l0, s2e) => @@ -403,6 +490,7 @@ case+ ls2e of jsonize(s2e)) ) ) (* end of [jsonize_labs2exp] *) +end local implement jsonize_val = jsonize_s2cst in @@ -410,6 +498,8 @@ local implement jsonize_val = jsonize_s2cst in implement jsonize_s2itm (x0) = +node("s2itm", res) where +val res = ( case+ x0 of // @@ -424,10 +514,14 @@ case+ x0 of ) end +end + implement jsonize_effs2expopt (x0) = +node("effs2expopt", res) where +val res = ( case+ x0 of | EFFS2EXPnone() => @@ -439,3 +533,4 @@ case+ x0 of jsonify("EFFS2EXPsome", ("s2f", "s2e"), (jsonize(s2f), jsonize(s2e))) *) ) (* end of [jsonize_effs2expopt] *) +end diff --git a/contrib/sparverius/xjsonize/SATS/json.sats b/contrib/sparverius/xjsonize/SATS/json.sats index b3e4efc3b..1626ab51d 100644 --- a/contrib/sparverius/xjsonize/SATS/json.sats +++ b/contrib/sparverius/xjsonize/SATS/json.sats @@ -115,6 +115,35 @@ jsonval_labval8 , l8: string, x8: jsonval ) : jsonval // end of [jsonval_labval8] // +fun +jsonval_labval9 +( + l1: string, x1: jsonval +, l2: string, x2: jsonval +, l3: string, x3: jsonval +, l4: string, x4: jsonval +, l5: string, x5: jsonval +, l6: string, x6: jsonval +, l7: string, x7: jsonval +, l8: string, x8: jsonval +, l9: string, x9: jsonval +) : jsonval // end of [jsonval_labval8] +// +fun +jsonval_labval10 +( + l1: string, x1: jsonval +, l2: string, x2: jsonval +, l3: string, x3: jsonval +, l4: string, x4: jsonval +, l5: string, x5: jsonval +, l6: string, x6: jsonval +, l7: string, x7: jsonval +, l8: string, x8: jsonval +, l9: string, x9: jsonval +, l10: string, x10: jsonval +) : jsonval // end of [jsonval_labval8] +// (* ****** ****** *) // fun @@ -160,6 +189,14 @@ fun fprint_labjsonvalist overload fprint with fprint_jsonval overload fprint with fprint_jsonvalist overload fprint with fprint_labjsonvalist + + +fun print_jsonval(x: jsonval): void +fun prerr_jsonval(x: jsonval): void + +overload print with print_jsonval +overload prerr with prerr_jsonval + // (* fun print_jsonval(x: jsonval): void @@ -244,6 +281,8 @@ fun listj2(x: jsonval, y: jsonval): jsonval fun labval2(x: jsonval, y: jsonval): jsonval +fun node(x: string, y: jsonval): jsonval +fun node2(x: string, y: jsonval, z: jsonval): jsonval fun fprintf {ts:types} ( diff --git a/contrib/sparverius/xjsonize/SATS/locinfo.sats b/contrib/sparverius/xjsonize/SATS/locinfo.sats index e45102ad5..7133b083a 100644 --- a/contrib/sparverius/xjsonize/SATS/locinfo.sats +++ b/contrib/sparverius/xjsonize/SATS/locinfo.sats @@ -3,6 +3,20 @@ #staload "./json.sats" + + fun jsonize_location : jsonize_type(location) overload jsonize with jsonize_location + +fun +jsonize_loc_t : jsonize_type(loc_t) +overload jsonize with jsonize_loc_t of 1 + +fun +labify_loc_t : labify_type(loc_t) +overload labify with labify_loc_t + +fun +jsonize_locrange : jsonize_type(location) +(* overload jsonize with jsonize_locrange *) diff --git a/contrib/sparverius/xjsonize/SATS/staexp1.sats b/contrib/sparverius/xjsonize/SATS/staexp1.sats index f396d455c..e8f1b3e2b 100644 --- a/contrib/sparverius/xjsonize/SATS/staexp1.sats +++ b/contrib/sparverius/xjsonize/SATS/staexp1.sats @@ -3,7 +3,7 @@ #staload "./json.sats" -(* + fun jsonize_g1exp : jsonize_type(g1exp) overload jsonize with jsonize_g1exp @@ -11,13 +11,11 @@ overload jsonize with jsonize_g1exp fun jsonize_g1marg : jsonize_type(g1marg) overload jsonize with jsonize_g1marg -*) fun jsonize_sort1 : jsonize_type(sort1) overload jsonize with jsonize_sort1 -(* fun jsonize_s1rtcon : jsonize_type(s1rtcon) overload jsonize with jsonize_s1rtcon @@ -53,13 +51,12 @@ overload jsonize with jsonize_s1qua fun jsonize_s1uni : jsonize_type(s1uni) overload jsonize with jsonize_s1uni -*) fun jsonize_s1exp : jsonize_type(s1exp) overload jsonize with jsonize_s1exp -(* + fun jsonize_effs1expopt : jsonize_type(effs1expopt) overload jsonize with jsonize_effs1expopt @@ -71,4 +68,3 @@ overload jsonize with jsonize_d1atcon fun jsonize_d1atype : jsonize_type(d1atype) overload jsonize with jsonize_d1atype -*) diff --git a/contrib/sparverius/xjsonize/SATS/staexp2.sats b/contrib/sparverius/xjsonize/SATS/staexp2.sats index 0cd29cc12..a7e650650 100644 --- a/contrib/sparverius/xjsonize/SATS/staexp2.sats +++ b/contrib/sparverius/xjsonize/SATS/staexp2.sats @@ -6,6 +6,9 @@ fun jsonize_sort2: jsonize_type(sort2) overload jsonize with jsonize_sort2 +fun +labify_sort2: labify_type(sort2) +overload labify with labify_sort2 fun jsonize_t2bas: jsonize_type(t2bas) From 49a6fc74ab1d96858adacc37105f0f4d03472f35 Mon Sep 17 00:00:00 2001 From: Richard Date: Sat, 14 Dec 2019 01:51:34 -0500 Subject: [PATCH 10/16] updating --- contrib/sparverius/xjsonize/.depend | 16 +- contrib/sparverius/xjsonize/DATS/dynexp0.dats | 159 +++++++++++++++--- contrib/sparverius/xjsonize/DATS/dynexp1.dats | 33 +++- contrib/sparverius/xjsonize/DATS/dynexp2.dats | 44 +++-- contrib/sparverius/xjsonize/DATS/filpath.dats | 2 +- contrib/sparverius/xjsonize/DATS/interp0.dats | 6 +- contrib/sparverius/xjsonize/DATS/intrep0.dats | 48 ++++-- contrib/sparverius/xjsonize/DATS/staexp0.dats | 132 +++++++-------- contrib/sparverius/xjsonize/DATS/staexp1.dats | 70 ++++++-- contrib/sparverius/xjsonize/DATS/staexp2.dats | 69 ++++++-- contrib/sparverius/xjsonize/DATS/stamp0.dats | 13 +- contrib/sparverius/xjsonize/DATS/statyp2.dats | 6 + contrib/sparverius/xjsonize/DATS/symbol.dats | 3 +- .../sparverius/xjsonize/DATS/xjsonize.dats | 3 + contrib/sparverius/xjsonize/Makefile | 2 + 15 files changed, 429 insertions(+), 177 deletions(-) diff --git a/contrib/sparverius/xjsonize/.depend b/contrib/sparverius/xjsonize/.depend index a5e6e9b25..0c5b78a90 100644 --- a/contrib/sparverius/xjsonize/.depend +++ b/contrib/sparverius/xjsonize/.depend @@ -5,6 +5,7 @@ BUILD/symbol_sats.o : SATS/json.sats BUILD/label0_sats.o : SATS/json.sats BUILD/locinfo_sats.o : SATS/json.sats BUILD/lexing_sats.o : SATS/json.sats +BUILD/filpath_sats.o : SATS/json.sats BUILD/dynexp0_sats.o : SATS/json.sats BUILD/staexp0_sats.o : SATS/json.sats BUILD/dynexp1_sats.o : SATS/json.sats @@ -22,15 +23,16 @@ BUILD/stamp0_dats.o : SATS/stamp0.sats SATS/json.sats DATS/json.dats BUILD/symbol_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/symbol.sats BUILD/label0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/statyp2.sats SATS/staexp2.sats SATS/intrep0.sats SATS/label0.sats SATS/symbol.sats BUILD/locinfo_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/locinfo.sats -BUILD/lexing_token_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/symbol.sats +BUILD/lexing_token_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/locinfo.sats SATS/basics.sats SATS/symbol.sats +BUILD/filpath_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/filpath.sats BUILD/staexp0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats BUILD/dynexp0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats BUILD/staexp1_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats SATS/staexp1.sats SATS/symbol.sats -BUILD/dynexp1_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats +BUILD/dynexp1_dats.o : SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/label0.sats SATS/lexing.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats BUILD/statyp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/staexp2.sats SATS/statyp2.sats SATS/symbol.sats SATS/locinfo.sats SATS/stamp0.sats SATS/label0.sats BUILD/staexp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/basics.sats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats SATS/staexp1.sats SATS/staexp2.sats SATS/symbol.sats SATS/locinfo.sats SATS/stamp0.sats SATS/label0.sats -BUILD/dynexp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats SATS/dynexp2.sats SATS/staexp2.sats SATS/symbol.sats SATS/stamp0.sats -BUILD/dynexp3_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/statyp2.sats SATS/staexp2.sats -BUILD/intrep0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/statyp2.sats SATS/staexp2.sats SATS/intrep0.sats -BUILD/interp0_dats.o : HATS/libxatsopt.hats SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/intrep0.sats DATS/json.dats DATS/basics.dats DATS/label0.dats DATS/locinfo.dats DATS/lexing_token.dats DATS/staexp0.dats DATS/dynexp0.dats DATS/stamp0.dats DATS/symbol.dats DATS/staexp1.dats DATS/dynexp1.dats DATS/statyp2.dats DATS/staexp2.dats DATS/dynexp2.dats DATS/dynexp3.dats DATS/intrep0.dats DATS/json.dats SATS/interp0.sats -BUILD/xjsonize_dats.o : SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/intrep0.sats SATS/interp0.sats +BUILD/dynexp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/locinfo.sats SATS/label0.sats SATS/dynexp0.sats SATS/staexp0.sats SATS/dynexp1.sats SATS/dynexp2.sats SATS/staexp2.sats SATS/symbol.sats SATS/stamp0.sats +BUILD/dynexp3_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/label0.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats +BUILD/intrep0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/label0.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/intrep0.sats +BUILD/interp0_dats.o : HATS/libxatsopt.hats SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/intrep0.sats DATS/json.dats DATS/basics.dats DATS/label0.dats DATS/locinfo.dats DATS/lexing_token.dats DATS/stamp0.dats DATS/symbol.dats DATS/filpath.dats DATS/staexp0.dats DATS/dynexp0.dats DATS/staexp1.dats DATS/dynexp1.dats DATS/statyp2.dats DATS/staexp2.dats DATS/dynexp2.dats DATS/dynexp3.dats DATS/intrep0.dats DATS/json.dats SATS/interp0.sats +BUILD/xjsonize_dats.o : SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/intrep0.sats SATS/interp0.sats diff --git a/contrib/sparverius/xjsonize/DATS/dynexp0.dats b/contrib/sparverius/xjsonize/DATS/dynexp0.dats index b390a9c5a..02286f2b5 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp0.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp0.dats @@ -203,7 +203,7 @@ x0.node() of ) (* end of [jsonize_ti0arg] *) -(* + implement {a}(*tmp*) jsonize_dl0abeled @@ -212,11 +212,16 @@ jsonize_dl0abeled val+DL0ABELED(l0, t0, x1) = x0 // in - jsonify("SL0ABELED("); - jsonify(l0, ", ", t0, ", "); - jsonize_val(x1); jsonify(")") +node("dl0abeled", res) where +val res = + jsonify("SL0ABELED", ("l0", "t0", "x1"), + (jsonize(l0), jsonize(t0), jsonize_val(x1)) + ) +end + end // end of [jsonize_dl0abeled] -*) + +implement(a:type) jsonize_val = jsonize_dl0abeled local @@ -224,6 +229,10 @@ local implement jsonize_val = jsonize_d0pat +implement +jsonize_val = jsonize_dl0abeled + + in (* in-of-local *) implement @@ -273,7 +282,12 @@ case+ x0.node() of (tbeg, topt, ld0ps, tend) => jsonify( "D0Precord", ("tbeg", "topt", "ld0ps", "tend"), - (jsonize(tbeg), jsonize_option(topt), jsonize("..."), jsonize(tend)) + ( + jsonize(tbeg), + jsonize_option(topt), + jsonize_list(ld0ps), + jsonize(tend) + ) ) // | D0Panno @@ -332,7 +346,11 @@ case+ x0 of | labd0pat_RBRACE_cons1(tok1, ld0ps, tok2) => jsonify( "labd0pat_RBRACE_cons1", ("tok1", "ld0ps", "tok2"), - (jsonize(tok1), jsonize("..."), jsonize(tok2)) + ( + jsonize(tok1), + jsonize_list(ld0ps), + jsonize(tok2) + ) ) ) (* end of [jsonize_labd0pat_RBRACE] *) @@ -343,6 +361,10 @@ local implement jsonize_val = jsonize_d0exp +(* +implement +jsonize_val = jsonize_d0clau +*) implement jsonize_val = jsonize_s0exp implement @@ -350,6 +372,10 @@ jsonize_val = jsonize_d0ecl implement jsonize_val = jsonize_f0arg +implement +jsonize_val = jsonize_dl0abeled + + in (* in-of-local *) implement @@ -397,32 +423,48 @@ case+ x0.node() of (tbeg, topt, d0es, tend) => jsonify( "D0Etuple", ("tbeg", "topt", "d0es", "tend"), - (jsonize(tbeg), jsonize_option(topt), jsonize_list(d0es), jsonize(tend)) + ( + jsonize(tbeg), + jsonize_option(topt), + jsonize_list(d0es), + jsonize(tend) + ) ) | D0Erecord (tbeg, topt, ld0es, tend) => jsonify( "D0Erecord", ("tbeg", "topt", "ld0es", "tend"), - (jsonize(tbeg), jsonize_option(topt), jsonize("..."), jsonize(tend)) + ( + jsonize(tbeg), + jsonize_option(topt), + jsonize_list(ld0es), + jsonize(tend) + ) ) // | D0Eif0 (tif0, d0e1, d0e2, d0e3, tend) => jsonify( "D0Eif0", ("tif0", "d0e1", "d0e2", "d0e3", "tend"), - (jsonize(tif0), jsonize(d0e1), jsonize(d0e2), jsonize(d0e3), jsonize_option(tend)) + ( + jsonize(tif0), + jsonize(d0e1), + jsonize(d0e2), + jsonize(d0e3), + jsonize_option(tend) + ) ) // | D0Ecase (tok0, d0e1, tof2, tbar, d0cs, tend) => jsonify( - "D0Ecase", ("tok0", "d0e1", "tof2", "tbar", "d0cs"(*...*), "tend"), + "D0Ecase", ("tok0", "d0e1", "tof2", "tbar", "d0cs", "tend"), ( jsonize(tok0), jsonize(d0e1), jsonize(tof2), jsonize_option(tbar), - jsonize("..."), + jsonize("..."), (* jsonize_list(d0cs), *) jsonize_option(tend) ) ) @@ -461,13 +503,29 @@ case+ x0.node() of (tok0, arg1, res2, farrw, fbody, tend) => jsonify( "D0Elam", ("tok0", "arg1", "res2", "farrw", "fbody", "tend"), - (jsonize(tok0), jsonize_list(arg1), jsonize(res2), jsonize(farrw), jsonize(fbody), jsonize_option(tend)) + ( + jsonize(tok0), + jsonize_list(arg1), + jsonize(res2), + jsonize(farrw), + jsonize(fbody), + jsonize_option(tend) + ) ) | D0Efix (tok0, fid0, arg1, res2, farrw, fbody, tend) => jsonify( "D0Efix", ("tok0", "fid0", "arg1", "res2", "farrw", "fbody", "tend"), - (jsonize(tok0), jsonize(fid0), jsonize_list(arg1), jsonize(res2), jsonize(farrw), jsonize(fbody), jsonize_option(tend))) + ( + jsonize(tok0), + jsonize(fid0), + jsonize_list(arg1), + jsonize(res2), + jsonize(farrw), + jsonize(fbody), + jsonize_option(tend) + ) + ) // | D0Eanno (d0e, ann) => @@ -515,6 +573,9 @@ local implement jsonize_val = jsonize_d0exp +implement +jsonize_val = jsonize_dl0abeled + in (* in-of-local *) @@ -528,7 +589,11 @@ case+ x0 of | labd0exp_RBRACE_cons1(tok1, ld0es, tok2) => jsonify( "labd0exp_RBRACE_cons1", ("tok1", "ld0es", "tok2"), - (jsonize(tok1), jsonize("..."), jsonize(tok2)) + ( + jsonize(tok1), + jsonize_list(ld0es), + jsonize(tok2) + ) ) ) (* end of [jsonize_labd0exp_RBRACE] *) @@ -562,7 +627,9 @@ case+ x0 of | endwhere_cons1(tok) => jsonify("endwhere_cons1", "tok", jsonize(tok)) | endwhere_cons2(tok1, opt2) => - jsonify("endwhere_cons2", ("tok1", "opt2"), (jsonize(tok1), jsonize_option(opt2))) + jsonify("endwhere_cons2", ("tok1", "opt2"), + (jsonize(tok1), jsonize_option(opt2)) + ) ) implement jsonize_val = jsonize_d0ecl @@ -576,7 +643,12 @@ case+ x0 of (tok0, opt1, d0cs, opt2) => jsonify( "d0eclseq_WHERE", ("tok0", "opt1", "d0cs", "opt2"), - (jsonize(tok0), jsonize_option(opt1), jsonize_list(d0cs), jsonize(opt2)) + ( + jsonize(tok0), + jsonize_option(opt1), + jsonize_list(d0cs), + jsonize(opt2) + ) ) ) (* end of [jsonize_d0eclseq_WHERE] *) @@ -751,14 +823,27 @@ case+ x0.node() of (tok, sid, arg, res, tok1, tdef) => jsonify( "D0Csexpdef", ("tok", "sid", "arg", "res", "tok1", "tdef"), - (jsonize(tok), jsonize(sid), jsonize_list(arg), jsonize_option(res), jsonize(tok1), jsonize(tdef)) + ( + jsonize(tok), + jsonize(sid), + jsonize_list(arg), + jsonize_option(res), + jsonize(tok1), + jsonize(tdef) + ) ) // | D0Cabstype (tok, sid, arg, res, tdef) => jsonify( "D0Cabstype", ("tok", "sid", "arg", "res", "tdef"), - (jsonize(tok), jsonize(sid), jsonize_list(arg), jsonize_option(res), jsonize(tdef)) + ( + jsonize(tok), + jsonize(sid), + jsonize_list(arg), + jsonize_option(res), + jsonize(tdef) + ) ) // | D0Cabsimpl @@ -842,7 +927,13 @@ case+ x0.node() of (tbeg, d0cs0, topt, d0cs1, tend) => jsonify( "D0Clocal", ("tbeg", "d0cs0", "topt", "d0cs1", "tend"), - (jsonize(tbeg), jsonize_list(d0cs0), jsonize_option(topt), jsonize_list(d0cs1), jsonize(tend)) + ( + jsonize(tbeg), + jsonize_list(d0cs0), + jsonize_option(topt), + jsonize_list(d0cs1), + jsonize(tend) + ) ) // (* @@ -940,7 +1031,14 @@ case+ x0 of | WD0CSnone() => jsonify("WD0CSnone") | WD0CSsome(tbeg, topt, d0cs, tend) => - jsonify("WD0CSsome", ("tbeg", "topt", "d0cs", "tend"), (jsonize(tbeg), jsonize_option(topt), jsonize_list(d0cs), jsonize(tend))) + jsonify("WD0CSsome", ("tbeg", "topt", "d0cs", "tend"), + ( + jsonize(tbeg), + jsonize_option(topt), + jsonize_list(d0cs), + jsonize(tend) + ) + ) ) (* end of [jsonize_wd0eclseq] *) @@ -953,7 +1051,6 @@ jsonize_v0aldecl val+V0ALDECL(rcd) = x0 // in - (* jsonify("V0ALDECL@{", "pat=", rcd.pat, ", teq=", rcd.teq, ", def=", rcd.def, ", wtp=", rcd.wtp, "}") *) jsonify("V0ALDECL@{", ("pat", "teq", "def", "wtp"), (jsonize(rcd.pat), jsonize_option(rcd.teq), jsonize_option(rcd.def), jsonize(rcd.wtp))) end // end of [jsonize_v0aldecl] @@ -970,7 +1067,13 @@ val+V0ARDECL(rcd) = x0 // in jsonify("V0ARDECL", ("nam", "wth", "res", "ini"), - (jsonize(rcd.nam), jsonize_option(rcd.wth), jsonize_option(rcd.res), jsonize(rcd.ini))) + ( + jsonize(rcd.nam), + jsonize_option(rcd.wth), + jsonize_option(rcd.res), + jsonize(rcd.ini) + ) + ) end // end of [jsonize_v0ardecl] @@ -984,7 +1087,15 @@ val+F0UNDECL(rcd) = x0 // in jsonify("F0UNDECL", ("nam", "arg", "res", "teq", "def", "wtp"), - (jsonize(rcd.nam), jsonize_list(rcd.arg), jsonize(rcd.res), jsonize_option(rcd.teq), jsonize_option(rcd.def), jsonize(rcd.wtp))) + ( + jsonize(rcd.nam), + jsonize_list(rcd.arg), + jsonize(rcd.res), + jsonize_option(rcd.teq), + jsonize_option(rcd.def), + jsonize(rcd.wtp) + ) + ) end // end of [jsonize_f0undecl] diff --git a/contrib/sparverius/xjsonize/DATS/dynexp1.dats b/contrib/sparverius/xjsonize/DATS/dynexp1.dats index bf4668076..d8671a70b 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp1.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp1.dats @@ -21,6 +21,7 @@ #staload "./../SATS/label0.sats" #staload "./../SATS/lexing.sats" +#staload "./../SATS/filpath.sats" #staload "./../SATS/staexp0.sats" #staload "./../SATS/dynexp0.sats" @@ -28,12 +29,20 @@ #staload "./../SATS/staexp1.sats" #staload "./../SATS/dynexp1.sats" +#staload _ = "./dynexp0.dats" implement jsonize_val = jsonize_token implement jsonize_val = jsonize_sort1 +implement +jsonize_val = jsonize_filpath +implement +jsonize_val = jsonize_d1exp + +implement +jsonize_val = jsonize_dl0abeled implement jsonize_q1arg @@ -220,6 +229,7 @@ implement jsonize_val = jsonize_d1exp implement jsonize_val = jsonize_d1ecl implement jsonize_val = jsonize_f1arg implement jsonize_val = jsonize_s1exp +implement jsonize_val = jsonize_d1clau implement jsonize_d1exp @@ -305,7 +315,7 @@ case+ x0.node() of // | D1Ecase(knd, d1e1, dcls) => jsonify("D1Ecase", ("knd", "d1e1", "dcls"), - (jsonize(knd), jsonize(d1e1), jsonize("...")) + (jsonize(knd), jsonize(d1e1), jsonize_list(dcls)) ) // | D1Elam @@ -336,12 +346,19 @@ case+ x0.node() of | D1Erecord(tok, ld1es) => jsonify ( "D1Erecord", ("tok", "ld1es"), - (jsonize(tok), jsonize("...")) // jsonize_list(ld1es) + ( + jsonize(tok), + jsonize_list(ld1es) + ) ) | D1Erecord(tok, ld1es1, ld1es2) => jsonify ( "D1Erecord", ("tok", "ld1es1", "ld1es2"), - (jsonize(tok), jsonize("..."), jsonize("...")) + ( + jsonize(tok), + jsonize_list(ld1es1), + jsonize_list(ld1es2) + ) ) | D1Eanno(d1e1, s1e2) => jsonify("D1Eanno", ("d1e1", "s1e2"), (jsonize(d1e1), jsonize(s1e2))) @@ -425,7 +442,7 @@ case+ x0.node() of jsonize(tok), jsonize(src), jsonize(knd), - jsonize("..."), + jsonize_option(opt), jsonize(body) ) ) @@ -447,7 +464,7 @@ case+ x0.node() of jsonize(tok), jsonize(src), jsonize(knd), - jsonize("..."), + jsonize_option(opt), jsonize(flag), jsonize(body) ) @@ -682,14 +699,14 @@ x0.node() of // | D1Precord(tok, ld1ps) => jsonify("D1Precord1", ("tok", "ld1ps"), - (jsonize(tok), jsonize("...")) + (jsonize(tok), jsonize_list(ld1ps)) ) | D1Precord(tok, ld1ps1, ld1ps2) => jsonify("D1Precord2", ("tok", "ld1ps1", "ld1ps2"), ( jsonize(tok), - jsonize("..."), - jsonize("...") + jsonize_list(ld1ps1), + jsonize_list(ld1ps2) ) ) // diff --git a/contrib/sparverius/xjsonize/DATS/dynexp2.dats b/contrib/sparverius/xjsonize/DATS/dynexp2.dats index 95be888a1..43e6ddb5e 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp2.dats @@ -22,6 +22,7 @@ #staload "./../SATS/locinfo.sats" #staload "./../SATS/label0.sats" +#staload "./../SATS/filpath.sats" #staload "./../SATS/dynexp0.sats" #staload "./../SATS/staexp0.sats" @@ -44,6 +45,8 @@ overload jsonize with $STM_J.jsonize_stamp implement jsonize_val = jsonize_s2exp +implement +jsonize_val = jsonize_filpath implement @@ -440,7 +443,7 @@ case- x0.node() of jsonize(tok), jsonize(src), jsonize(knd), - jsonize("..."), (* jsonize_option(fopt), *) + jsonize_option(fopt), jsonize(body) ) where @@ -465,7 +468,7 @@ case- x0.node() of jsonize(tok), jsonize(src), jsonize(knd), - jsonize("..."), + jsonize_option(fopt), jsonize(flag), jsonize(body) ) where @@ -479,7 +482,12 @@ case- x0.node() of ) // | D2Clocal(head, body) => - jsonify("D2Clocal", ("head", "body"), (jsonize("..."), jsonize("..."))) + jsonify("D2Clocal", ("head", "body"), + ( + jsonize_list(head), + jsonize_list(body) + ) + ) // | D2Cabssort(d1c) => jsonify("D2Cabssort", "d1c", jsonize("...")) @@ -488,13 +496,15 @@ case- x0.node() of jsonify("D2Cstacst0", ("s2c", "s2t"), (jsonize(s2c), jsonize(s2t))) // | D2Csortdef(sym, s2tx) => - jsonify("D2Csortdef", ("sym", "s2tx"), (jsonize(sym), jsonize("..."))) + jsonify("D2Csortdef", ("sym", "s2tx"), + (jsonize(sym), jsonize(s2tx)) + ) // | D2Csexpdef(s2c, s2e) => jsonify("D2Csexpdef", ("s2c", "s2e"), (jsonize(s2c), jsonize(s2e))) // | D2Cabstype(s2c, df2) => - jsonify("D2Cabstype", ("s2c", "df2"), (jsonize(s2c), jsonize("..."))) + jsonify("D2Cabstype", ("s2c", "df2"), (jsonize(s2c), jsonize(df2))) // | D2Cabsimpl (knd, sqid, def0) => @@ -521,7 +531,7 @@ case- x0.node() of ( jsonize(tok), jsonize(sym0), - jsonize(dpi1) (* jsonize("...") *) + jsonize(dpi1) ) ) // @@ -535,7 +545,7 @@ case- x0.node() of ( jsonize(knd), jsonize(mopt), - jsonize_list(v2ds) (* jsonize("...") *) + jsonize_list(v2ds) ) ) @@ -558,7 +568,11 @@ case- x0.node() of | D2Cvardecl(knd, mopt, v2ds) => jsonify( "D2Cvardecl", ("knd", "mopt", "v2ds"), - (jsonize(knd), jsonize(mopt), jsonize("...")) + ( + jsonize(knd), + jsonize(mopt), + jsonize_list(v2ds) + ) ) // | D2Cimpdecl1 @@ -704,7 +718,6 @@ implement jsonize_ti2arg (x0) = ( - (* jsonify("ti2arg", "s2es", jsonize("...")) *) (* jsonval_labval1("ti2arg", jsonize_list(x0.s2es())) *) node("ti2arg", jsonize_list(x0.s2es())) ) (* end of [jsonize_ti2arg] *) @@ -740,6 +753,9 @@ IMPLD2CST2(dqid, d2cs, opt2) => ) // end of [jsonize_impld2cst] end +implement +jsonize_val = jsonize_s2cst + implement jsonize_impls2cst (x0) = @@ -748,10 +764,16 @@ val res = ( case+ x0 of | IMPLS2CST1(sqid, s2cs) => - jsonify("IMPLS2CST1", ("sqid", "s2cs"), (jsonize("..."), jsonize("..."))) + jsonify("IMPLS2CST1", ("sqid", "s2cs"), + (jsonize(sqid), jsonize_list(s2cs)) + ) | IMPLS2CST2(sqid, s2cs, opt2) => jsonify("IMPLS2CST2", ("sqid", "s2cs", "opt2"), - (jsonize("..."), jsonize("..."), jsonize("...")) + ( + jsonize(sqid), + jsonize_list(s2cs), + jsonize_option(opt2) + ) ) ) // end of [jsonize_impls2cst] end diff --git a/contrib/sparverius/xjsonize/DATS/filpath.dats b/contrib/sparverius/xjsonize/DATS/filpath.dats index 22bc4c93b..772194d45 100644 --- a/contrib/sparverius/xjsonize/DATS/filpath.dats +++ b/contrib/sparverius/xjsonize/DATS/filpath.dats @@ -16,7 +16,7 @@ implement jsonize_filpath (x) = - jsonval_labval1("fpath", jsonize(full1)) + node("filpath", jsonize(full1)) where val full1 = filpath_get_full1(x) end diff --git a/contrib/sparverius/xjsonize/DATS/interp0.dats b/contrib/sparverius/xjsonize/DATS/interp0.dats index 6bd509e31..adf17c750 100644 --- a/contrib/sparverius/xjsonize/DATS/interp0.dats +++ b/contrib/sparverius/xjsonize/DATS/interp0.dats @@ -70,6 +70,7 @@ UN = "prelude/SATS/unsafe.sats" #staload "./../SATS/lexing.sats" #staload "./../SATS/stamp0.sats" #staload "./../SATS/symbol.sats" +#staload "./../SATS/filpath.sats" #staload "./../SATS/staexp0.sats" #staload "./../SATS/dynexp0.sats" #staload "./../SATS/staexp1.sats" @@ -87,10 +88,11 @@ UN = "prelude/SATS/unsafe.sats" #staload _ = "./label0.dats" #staload _ = "./locinfo.dats" #staload _ = "./lexing_token.dats" -#staload _ = "./staexp0.dats" -#staload _ = "./dynexp0.dats" #staload _ = "./stamp0.dats" #staload _ = "./symbol.dats" +#staload _ = "./filpath.dats" +#staload _ = "./staexp0.dats" +#staload _ = "./dynexp0.dats" #staload _ = "./staexp1.dats" #staload _ = "./dynexp1.dats" #staload _ = "./statyp2.dats" diff --git a/contrib/sparverius/xjsonize/DATS/intrep0.dats b/contrib/sparverius/xjsonize/DATS/intrep0.dats index 844d90cc4..adbb718b7 100644 --- a/contrib/sparverius/xjsonize/DATS/intrep0.dats +++ b/contrib/sparverius/xjsonize/DATS/intrep0.dats @@ -15,6 +15,7 @@ #staload "./../SATS/lexing.sats" #staload "./../SATS/label0.sats" +#staload "./../SATS/filpath.sats" #staload "./../SATS/staexp0.sats" #staload "./../SATS/dynexp0.sats" @@ -31,6 +32,13 @@ #staload "./../SATS/intrep0.sats" +implement +jsonize_val = jsonize_filpath + + +implement +jsonize_val = jsonize_ir0pat + implement jsonize_ir0pat (x0) = @@ -52,10 +60,12 @@ case+ x0.node() of jsonify("IR0Pvar", "d2v", jsonize(d2v)) // | IR0Pcapp(d2c0, irps) => - jsonify("IR0Pcapp", ("d2c0", "irps"), (jsonize(d2c0), jsonize("..."))) + jsonify("IR0Pcapp", ("d2c0", "irps"), (jsonize(d2c0), jsonize_list(irps))) // | IR0Ptuple(knd, irps) => - jsonify("IR0Ptuple", ("knd", "irps"), (jsonize(knd), jsonize("..."))) + jsonify("IR0Ptuple", ("knd", "irps"), + (jsonize(knd), jsonize_list(irps)) + ) // | IR0Pnone0() => jsonify("IR0Pnone0") @@ -83,6 +93,7 @@ end // end of [jsonize_ir0arg] local implement jsonize_val = jsonize_ir0exp +implement jsonize_val = jsonize_ir0clau implement jsonize_val = jsonize_ir0dcl implement jsonize_val = jsonize_t2ype implement jsonize_val = jsonize_ir0arg @@ -172,7 +183,7 @@ x0.node() of (knd0, npf1, ires) => jsonify( "IR0Etuple", ("knd0", "npf1", "ires"), - (jsonize("..."), jsonize(npf1), jsonize_list(ires)) + (jsonize(knd0), jsonize(npf1), jsonize_list(ires)) ) | IR0Eassgn(irel, irer) => jsonify("IR0Eassgn", ("irel", "irer"), (jsonize(irel), jsonize(irer))) @@ -181,13 +192,13 @@ x0.node() of (ire1, ire2, opt3) => jsonify("IR0Eif0", ("ire1", "ire2", "opt3"), - (jsonize(ire1), jsonize(ire2), jsonize("...")) + (jsonize(ire1), jsonize(ire2), jsonize_option(opt3)) ) // | IR0Ecase (knd0, ire1, ircls) => jsonify("IR0Ecase", ("knd0", "ire1", "ircls"), - (jsonize("..."), jsonize("..."), jsonize("...")) + (jsonize(knd0), jsonize(ire1), jsonize_list(ircls)) ) // | IR0Elam @@ -199,7 +210,12 @@ x0.node() of | IR0Efix (knd0, d2v0, farg, body) => jsonify("IR0Efix", ("knd0", "d2v0", "farg", "body"), - (jsonize("..."), jsonize("..."), jsonize("..."), jsonize("...")) + ( + jsonize(knd0), + jsonize(d2v0), + jsonize_list(farg), + jsonize(body) + ) ) // | IR0Eaddr(ire1) => @@ -257,7 +273,9 @@ x0.node() of jsonify("IR0CLAUpat", "ir0gp", jsonize(ir0gp)) // | IR0CLAUexp(ir0gp, d0e0) => - jsonify("IR0CLAUpat", ("ir0gp", "d0e0"), (jsonize("..."), jsonize("..."))) + jsonify("IR0CLAUpat", ("ir0gp", "d0e0"), + (jsonize(ir0gp), jsonize(d0e0)) + ) // ) (* end of [jsonize_ir0clau] *) end @@ -312,7 +330,13 @@ case+ x0.node() of | IR0Cinclude (tok, src, knd, fopt, body) => jsonify("IR0Cinclude", ("tok", "src", "knd", "fopt", "body"), - (jsonize(tok), jsonize(src), jsonize(knd), jsonize("..."), jbody) + ( + jsonize(tok), + jsonize(src), + jsonize(knd), + jsonize_option(fopt), + jbody + ) ) where val jbody = ( case+ body of @@ -323,17 +347,19 @@ case+ x0.node() of // | IR0Clocal (head, body) => - jsonify("IR0Clocal", ("head", "body"), (jsonize("..."), jsonize("..."))) + jsonify("IR0Clocal", ("head", "body"), + (jsonize_list(head), jsonize_list(body)) + ) // | IR0Cvardecl (knd, mopt, irds) => jsonify("IR0Cvardecl", ("knd", "mopt", "irds"), - (jsonize(knd), jsonize("..."), jsonize_list(irds)) + (jsonize(knd), jsonize(mopt), jsonize_list(irds)) ) | IR0Cvaldecl (knd, mopt, irds) => jsonify("IR0Cvaldecl", ("knd", "mopt", "irds"), - (jsonize(knd), jsonize("..."), jsonize_list(irds)) + (jsonize(knd), jsonize(mopt), jsonize_list(irds)) ) // | IR0Cfundecl diff --git a/contrib/sparverius/xjsonize/DATS/staexp0.dats b/contrib/sparverius/xjsonize/DATS/staexp0.dats index ca1643a40..1c0322606 100644 --- a/contrib/sparverius/xjsonize/DATS/staexp0.dats +++ b/contrib/sparverius/xjsonize/DATS/staexp0.dats @@ -19,6 +19,9 @@ #staload "./../SATS/lexing.sats" +implement +jsonize_val = jsonize_token + implement jsonize_t0int (x0) = @@ -72,10 +75,8 @@ jsonize_i0dnt ( case+ x0.node() of | I0DNTnone(tok) => - (* fprint!(out, "I0DNTnone(", tok, ")") *) jsonify("I0DNTnone", "tok", jsonize(tok)) | I0DNTsome(tok) => - (* fprint!(out, "I0DNTsome(", tok, ")") *) jsonify("I0DNTsome", "tok", jsonize(tok)) ) @@ -157,29 +158,17 @@ case+ x0.node() of jsonify("GOEint", "int", jsonize(int)) // | G0Eapps(s0ts) => - (* fprint!(out, "G0Eapps(", s0ts, ")") *) - jsonify("GOEapps", "s0ts", rst) where - (* val rst = jsonize_list<() *) - (* val rst = jnul() where val _ = $showtype(s0ts) end *) - val rst = jsonize_list(s0ts) - end + jsonify("GOEapps", "s0ts", jsonize_list(s0ts)) // | G0Elist(t0, g0es, t1) => - (* fprint! *) - (* (out, "G0Elist(", t0, "; ", g0es, "; ", t1, ")") *) - jsonify("GOElist", ("t0", "g0es", "t1"), rst) where - val jt0 = jsonize(t0) - val jg0es = jsonize_list(g0es) - val jt1 = jsonize(t1) - val rst = (jt0, jg0es, jt1) - end + jsonify("GOElist", ("t0", "g0es", "t1"), + (jsonize(t0), jsonize_list(g0es), jsonize(t1)) + ) // | G0Enone(tok) => - (* fprint!( out, "G0Enone(", tok, ")" ) *) jsonify("G0Enone", "tok", jsonize(tok)) - // end of [G0Enone] // -) (* end of [fprint_g0exp] *) +) (* end of [jsonize_g0exp] *) end @@ -250,7 +239,8 @@ case+ x0.node() of end // end of [local] - +implement +jsonize_val = jsonize_sort0 implement jsonize_s0rtcon @@ -258,9 +248,10 @@ jsonize_s0rtcon ( case+ x0.node() of | S0RTCON(sid, opt) => - (* fprint!(out, "S0RTCON(", sid, ", ", opt, ")") *) - jsonify("S0RTCON", ("sid", "opt"), (jsonize(sid), jsonize("..."))) -) (* end of [fprint_s0rtcon] *) + jsonify("S0RTCON", ("sid", "opt"), + (jsonize(sid), jsonize_option(opt)) + ) +) (* end of [jsonize_s0rtcon] *) local @@ -275,8 +266,6 @@ jsonize_d0tsort ( case+ x0.node() of | D0TSORT(tid, tok, s0cs) => - (* fprint! *) - (* (out, "D0TSORT(", tid, "; ", tok, "; ", s0cs, ")") *) jsonify("D0RTCON", ("tid", "tok", "s0cs"), ( jsonize(tid), jsonize(tok), @@ -288,6 +277,9 @@ case+ x0.node() of end +implement +jsonize_val = jsonize_s0exp + implement jsonize_s0rtdef @@ -303,7 +295,7 @@ case+ x0.node() of jsonize(tbeg), jsonize(s0a0), jsonize(tbar), - jstr("..."), + jsonize_list(s0es), jsonize(tend) ) end @@ -319,9 +311,15 @@ x0.node() of | S0ARGnone(tok) => jsonify("S0ARGnone", "tok", jsonize(tok)) | S0ARGsome(sid, opt) => - jsonify("S0ARGsome", ("sid", "opt"), (jsonize(sid), jsonize("..."))) + jsonify("S0ARGsome", ("sid", "opt"), + (jsonize(sid), jsonize_option(opt)) + ) ) (* jsonize_s0arg *) + +implement +jsonize_val = jsonize_s0arg + implement jsonize_s0marg (x0) = @@ -336,7 +334,7 @@ x0.node() of jsonify("S0MARGlist", ("tbeg", "s0as", "tend"), ( jsonize(tbeg), - jstr("..."), + jsonize_list(s0as), jsonize(tend) ) ) @@ -350,9 +348,15 @@ jsonize_t0arg case+ x0.node() of | T0ARGsome(tid, opt) => - jsonify("T0ARGsome", ("sid", "opt"), (jsonize(tid), jsonize("..."))) + jsonify("T0ARGsome", ("sid", "opt"), + (jsonize(tid), jsonize_option(opt)) + ) ) (* jsonize_t0arg *) + +implement +jsonize_val = jsonize_t0arg + implement jsonize_t0marg (x0) = @@ -362,16 +366,17 @@ x0.node() of | T0MARGnone(tok) => jsonify("T0MARGnone", "tok", jsonize(tok)) | T0MARGlist(tbeg, t0as, tend) => - jsonify("T0MARGlist", ("tbeg", "s0as", "tend"), + jsonify("T0MARGlist", ("tbeg", "t0as", "tend"), ( jsonize(tbeg), - jstr("..."), + jsonize_list(t0as), jsonize(tend) ) ) ) (* jsonize_t0marg *) - +implement +jsonize_val = jsonize_i0dnt implement jsonize_s0qua @@ -381,9 +386,14 @@ case+ x0.node() of | S0QUAprop(s0e) => jsonify("S0QUAprop", "s0e", jsonize(s0e)) | S0QUAvars(ids, opt) => - jsonify("S0QUAprop", ("ids", "opt"), (jstr("..."),jstr("..."))) + jsonify("S0QUAprop", ("ids", "opt"), + (jsonize_list(ids), jsonize_option(opt)) + ) ) +implement +jsonize_val = jsonize_s0qua + implement jsonize_s0uni @@ -395,12 +405,15 @@ case+ x0.node() of | S0UNIsome(tbeg, s0qs, tend) => jsonify("S0UNIsome", ("tbeg", "s0qs", "tend"), ( jsonize(tbeg), - jstr("..."), + jsonize_list(s0qs), jsonize(tend) ) ) ) +implement +jsonize_val = jsonize_sl0abled + implement {a}(*tmp*) @@ -410,6 +423,8 @@ jsonize_sl0abled val+SL0ABLED(l0, t0, x1) = x0 // in +node("sl0abled", res) where +val res = jsonify("SL0ABLED", ("l0", "t0", "x1"), rst) where val rst = ( jsonize(l0), @@ -417,7 +432,9 @@ in jsonize_val(x1) ) end -end // end of [fprint_sl0abled] +end + +end // end of [jsonize_sl0abled] @@ -457,21 +474,18 @@ case+ x0.node() of ) // | S0Eint(i0) => - (* fprint!(out, "S0Eint(", i0, ")") *) jsonify("S0Eint", "i0", jsonize(i0)) | S0Echr(c0) => jsonify("S0Echr", "c0", jsonize(c0)) | S0Eflt(f0) => jsonify("S0Eflt", "f0", jsonize(f0)) | S0Estr(s0) => - (* fprint!(out, "S0Estr(", s0, ")") *) jsonify("S0Estr", "s0", jsonize(s0)) // | S0Eapps(s0es) => jsonify("S0Eapps", "s0es", jsonize_list(s0es)) // | S0Eimp(tbeg, s0es, tend) => - (* jsonify("S0Eimp", "s0es", jsonize_list(s0es))// *) jsonify( "S0Eimp", ( "tbeg", @@ -485,9 +499,6 @@ case+ x0.node() of ) | S0Eparen (tbeg, s0es, tend) => - (* fprint! *) - (* ( out *) - (* , "S0Eparen(", tbeg, "; ", s0es, "; ", tend, ")") *) jsonify( "S0Eparen", ( "tbeg", @@ -502,9 +513,6 @@ case+ x0.node() of // | S0Eforall(tbeg, s0qs, tend) => - (* fprint! *) - (* ( out *) - (* , "S0Eforall(", tbeg, "; ", s0qs, "; ", tend, ")") *) jsonify( "S0Eforall", ( "tbeg", @@ -512,7 +520,7 @@ case+ x0.node() of "tend" ), ( jsonize(tbeg), - jsonize("..."), //jsonize_list(s0es), + jsonize_list(s0qs), jsonize(tend) ) ) @@ -525,7 +533,7 @@ case+ x0.node() of "tend" ), ( jsonize(tbeg), - jsonize("..."), //jsonize_list(s0es), + jsonize_list(s0qs), jsonize(tend) ) ) @@ -540,7 +548,7 @@ case+ x0.node() of "tend" ), ( jsonize(tbeg), - jsonize("..."), + jsonize_option(topt), jsonize_list(s0es), jsonize(tend) ) @@ -555,8 +563,8 @@ case+ x0.node() of "tend" ), ( jsonize(tbeg), - jsonize("..."), - jsonize("..."), (* jsonize_list(s0es) *) + jsonize_option(topt), + jsonize_list(s0es), jsonize(tend) ) ) @@ -576,16 +584,12 @@ case+ x0.node() of ), ( jsonize(tbeg), jsonize_list(arg0), - jsonize("..."), //jsonize(res1), + jsonize_option(res1), jsonize(tok1), jsonize(s0e0), - jsonize("...") //jsonize(tend) + jsonize_option(tend) ) ) - where - (* val _ = showtype(res1) *) - (* val _ = showtype(tend) *) - end // | S0Eanno (s0e, ann) => @@ -672,7 +676,7 @@ case+ x0 of "tok2" ), ( jsonize(tok1), - jsonize("..."), (* jsonize_list(ls0es) *) + jsonize_list(ls0es), jsonize(tok2) ) ) @@ -693,16 +697,15 @@ case+ x0 of jsonify("EFFS0EXPsome", "s0e", jsonize(s0e)) (* | EFFS0EXPsome(s0f, s0e) => - fprint! - ( out - , "EFFS0EXPsome(", s0f, "; ", s0e, ")") + jsonify("EFFS0EXPsome", ("s0f", "s0e"), (jsonize(s0f), jsonize(s0e))) *) -) (* end of [fprint_effs0expopt] *) +) (* end of [jsonize_effs0expopt] *) implement jsonize_val = jsonize_t0marg implement jsonize_val = jsonize_d0atcon +implement jsonize_val = jsonize_sort0 implement jsonize_d0atype @@ -721,8 +724,8 @@ case+ x0.node() of ), ( jsonize(tid), - jsonize_list(arg), //jsonize(arg), - jsonize("..."), // jsonize(res), + jsonize_list(arg), + jsonize_option(res), jsonize(teq), jsonize_list(d0cs) ) @@ -755,13 +758,10 @@ case+ x0.node() of jsonize_list(s0us), jsonize(dcon), jsonize_list(s0is), - jsonize("...") + jsonize_option(argopt) ) ) where - (* val _ = $showtype(s0us) *) - (* val _ = $showtype(s0is) *) - (* val _ = $showtype(argopt) *) val jargopt = ( case+ argopt of | None() => jsonify("None") diff --git a/contrib/sparverius/xjsonize/DATS/staexp1.dats b/contrib/sparverius/xjsonize/DATS/staexp1.dats index 609ae6431..d65412d1a 100644 --- a/contrib/sparverius/xjsonize/DATS/staexp1.dats +++ b/contrib/sparverius/xjsonize/DATS/staexp1.dats @@ -18,8 +18,10 @@ #staload "./../SATS/staexp0.sats" #staload "./../SATS/label0.sats" #staload "./../SATS/lexing.sats" +#staload "./../SATS/locinfo.sats" #staload "./../SATS/staexp1.sats" +#staload _ = "./staexp0.dats" #staload SYM_J = "./../SATS/symbol.sats" overload jsonize with $SYM_J.jsonize_symbol @@ -27,6 +29,9 @@ overload jsonize with $SYM_J.jsonize_symbol implement jsonize_val = jsonize_s1exp +implement +jsonize_val = jsonize_sl0abled + implement jsonize_val = jsonize_token @@ -214,7 +219,9 @@ case+ x0.node() of | S1RTDEFsort(s1t) => jsonify("S1RTDEFsort", "s1t", jsonize(s1t)) | S1RTDEFsbst(s1a0, s1es) => - jsonify("S1RTDEFsbst(", ("s1a0", "s1es"), (jsonize(s1a0), jsonize_list(s1es))) + jsonify("S1RTDEFsbst(", ("s1a0", "s1es"), + (jsonize(s1a0), jsonize_list(s1es)) + ) ) (* end of [jsonize_s1rtdef] *) end @@ -231,7 +238,9 @@ x0.node() of jsonify("S1ARGnone()") *) | S1ARGsome(tok, opt) => - jsonify("S1ARGsome(", ("tok", "opt"), (jsonize(tok), jsonize_option(opt))) + jsonify("S1ARGsome(", ("tok", "opt"), + (jsonize(tok), jsonize_option(opt)) + ) ) (* jsonize_s1arg *) end @@ -277,7 +286,9 @@ x0.node() of jsonify("T1ARGnone") *) | T1ARGsome(tok, opt) => - jsonify("T1ARGsome", ("tok", "opt"), (jsonize(tok), jsonize_option(opt))) + jsonify("T1ARGsome", ("tok", "opt"), + (jsonize(tok), jsonize_option(opt)) + ) ) (* jsonize_t1arg *) end @@ -317,7 +328,9 @@ case+ x0.node() of | S1QUAprop(s1e) => jsonify("S1QUAprop(", "s1e", jsonize(s1e)) | S1QUAvars(ids, opt) => - jsonify("S1QUAvars(", ("ids", "opt"), (jsonize_list(ids), jsonize_option(opt))) + jsonify("S1QUAvars(", ("ids", "opt"), + (jsonize_list(ids), jsonize_option(opt)) + ) ) end @@ -341,6 +354,10 @@ local implement jsonize_val = jsonize_s1exp +implement +jsonize_val = jsonize_s1marg +implement +jsonize_val = jsonize_s1qua in (* in-of-local *) @@ -372,7 +389,9 @@ case+ x0.node() of jsonify("S1Eapp1", ("s1e0", "s1e1"), (jsonize(s1e0), jsonize(s1e1))) | S1Eapp2 (s1e0, s1e1, s1e2) => - jsonify("S1Eapp2", ("s1e0", "s1e1", "s1e2"), (jsonize(s1e0), jsonize(s1e1), jsonize(s1e2))) + jsonify("S1Eapp2", ("s1e0", "s1e1", "s1e2"), + (jsonize(s1e0), jsonize(s1e1), jsonize(s1e2)) + ) // | S1Ebs0() => jsonify("S1Ebs0") @@ -380,7 +399,7 @@ case+ x0.node() of jsonify("S1Ebs1", "s1e", jsonize(s1e)) // | S1Eimp(s1es) => - jsonify("S1Eimp", "s1es", jsonize("...")) + jsonify("S1Eimp", "s1es", jsonize_list(s1es)) // (* | S1Eapp(s1e0, s1es) => @@ -388,31 +407,46 @@ case+ x0.node() of *) // | S1Elist(s1es) => - jsonify("S1Elist", "s1es", jsonize("...")) + jsonify("S1Elist", "s1es", jsonize_list(s1es)) | S1Elist(s1es1, s1es2) => - jsonify("S1Elist", ("s1es1", "s1es2"), (jsonize("..."), jsonize("..."))) + jsonify("S1Elist", ("s1es1", "s1es2"), + (jsonize_list(s1es1), jsonize_list(s1es2)) + ) // | S1Etuple(k0, s1es) => - jsonify("S1Etuple", ("k0", "s1es"), (jsonize(k0), jsonize("..."))) + jsonify("S1Etuple", ("k0", "s1es"), + (jsonize(k0), jsonize_list(s1es)) + ) | S1Etuple(k0, s1es1, s1es2) => - jsonify("S1Etuple", ("k0", "s1es1", "s1es2"), (jsonize(k0), jsonize("..."), jsonize("...") - )) + jsonify("S1Etuple", ("k0", "s1es1", "s1es2"), + (jsonize(k0), jsonize_list(s1es1), jsonize_list(s1es2)) + ) // | S1Erecord(k0, ls1es) => - jsonify("S1Erecord", ("k0", "ls1es"), (jsonize(k0), jsonize("..."))) + jsonify("S1Erecord", ("k0", "ls1es"), + (jsonize(k0), jsonize_list(ls1es)) + ) | S1Erecord(k0, ls1es1, ls1es2) => - jsonify("S1Erecord", ("k0", "ls1es1", "ls1es2"), (jsonize(k0), jsonize("..."), jsonize("..."))) + jsonify("S1Erecord", ("k0", "ls1es1", "ls1es2"), + ( + jsonize(k0), + jsonize_list(ls1es1), + jsonize_list(ls1es2) + ) + ) // | S1Eforall(s1qs) => - jsonify("S1Eforall", "s1qs", jsonize("...")) + jsonify("S1Eforall", "s1qs", jsonize_list(s1qs)) | S1Eexists(k0, s1qs) => - jsonify("S1Eexists", ("k0", "s1qs"), (jsonize(k0), jsonize("..."))) + jsonify("S1Eexists", ("k0", "s1qs"), + (jsonize(k0), jsonize_list(s1qs)) + ) // | S1Elam(arg, res, s1e) => jsonify("S1Elam", ("arg", "res", "s1e"), ( - jsonize("..."), //jsonize(arg), - jsonize("..."), //jsonize(res), + jsonize_list(arg), + jsonize_option(res), jsonize(s1e) ) ) @@ -424,7 +458,7 @@ case+ x0.node() of jsonify("S1Equal", ("tok", "s1e"), (jsonize(tok), jsonize(s1e))) // | S1Enone(loc) => - jsonify("S1Enone", "loc", jsonize("...")) + jsonify("S1Enone", "loc", jsonize(loc)) // ) (* jsonize_s0exp *) end diff --git a/contrib/sparverius/xjsonize/DATS/staexp2.dats b/contrib/sparverius/xjsonize/DATS/staexp2.dats index 911989839..b27b25f66 100644 --- a/contrib/sparverius/xjsonize/DATS/staexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/staexp2.dats @@ -197,16 +197,6 @@ jsonize_s2cst implement jsonize_s2var (x0) = -(* -jsonval_labval2("s2var", rst, "sort", jsrt) where - val lst = $list{labjsonval}( - $SYM.labify_symbol(x0.sym()), - $STM.labify_stamp(x0.stamp()) - ) - val rst = JSONlablist(lst) - val jsrt = jsonize(x0.sort()) - end -*) node("s2var", rst) where val lst = $list{labjsonval}( $SYM.labify_symbol(x0.sym()), @@ -219,6 +209,36 @@ node("s2var", rst) where +local + +implement +jsonize_val = jsonize_s2txt +implement +jsonize_val = jsonize_s2exp + +in (* in-of-local *) + +implement +jsonize_s2txt + (s2tx) = +( +case+ s2tx of +| S2TXTsrt(s2t) => + jsonify("S2TXTsrt", "s2t", jsonize(s2t)) +| S2TXTsub(s2v, s2ps) => + jsonify("S2TXTsub", ("s2v", "s2ps"), + (jsonize(s2v), jsonize_list(s2ps)) + ) +// +(* +| S2TXTerr(loc0) => jsonify("S2TXTerr(...)") +*) +// +) (* end of [jsonize_s2txt] *) + +end // end of [local] + + implement jsonize_tyrec (knd) = @@ -301,15 +321,10 @@ s2e0.node() of ) | S2Elam (s2vs, body) => - jsonify ( - "S2Elam", - ( - "s2vs", - "body" - ), + jsonify ("S2Elam", ("s2vs", "body"), ( - jsonize("..."), - jsonize("...") + jsonize_list(s2vs), + jsonize(body) ) ) // @@ -517,6 +532,24 @@ end end +implement +jsonize_abstdf2 + (x0) = +node("abstdf2", res) where +val res = +( +case+ x0 of +| ABSTDF2none() => + jsonify("ABSTDF2none") +| ABSTDF2some() => + jsonify("ABSTDF2some") +| ABSTDF2lteq(s2e) => + jsonify("ABSTDF2lteq", "s2e", jsonize(s2e)) +| ABSTDF2eqeq(s2e) => + jsonify("ABSTDF2eqeq", "s2e", jsonize(s2e)) +) +end + implement jsonize_effs2expopt (x0) = diff --git a/contrib/sparverius/xjsonize/DATS/stamp0.dats b/contrib/sparverius/xjsonize/DATS/stamp0.dats index c906f28da..5e8159e44 100644 --- a/contrib/sparverius/xjsonize/DATS/stamp0.dats +++ b/contrib/sparverius/xjsonize/DATS/stamp0.dats @@ -21,16 +21,9 @@ implement jsonize_stamp(x0) = -( -(* - jsonval_labval2("node", nd, "val", vl) where - { - val nd = jstr("stamp") - val vl = jsonize(tostring_uint(stamp2uint(x0))) - } -*) -jsonval_labval1("stamp", jsonize(tostring_uint(stamp2uint(x0)))) -) +node("stamp", jsonize(tostring_uint(stamp2uint(x0)))) +(* jsonval_labval1("stamp", jsonize(tostring_uint(stamp2uint(x0)))) *) + implement labify_stamp(x0) = ("stamp", jsonize(tostring_uint(stamp2uint(x0)))) diff --git a/contrib/sparverius/xjsonize/DATS/statyp2.dats b/contrib/sparverius/xjsonize/DATS/statyp2.dats index 33baa6aa5..362896206 100644 --- a/contrib/sparverius/xjsonize/DATS/statyp2.dats +++ b/contrib/sparverius/xjsonize/DATS/statyp2.dats @@ -41,6 +41,8 @@ in (* in-of-local *) implement jsonize_t2ype (x0) = +node("t2ype", res) where +val res = ( case+ x0.node() of @@ -140,6 +142,7 @@ x0.node() of // ) +end end @@ -147,8 +150,11 @@ end implement jsonize_labt2ype (lt2p) = +node("labt2ype", res) where +val res = ( case+ lt2p of | TLABELED(l0, t2p) => jsonify("TLABELED", ("l0", "t2p"), (jsonize(l0), jsonize(t2p))) ) (* end of [jsonize_labt2ype] *) +end diff --git a/contrib/sparverius/xjsonize/DATS/symbol.dats b/contrib/sparverius/xjsonize/DATS/symbol.dats index 2f1cd1f63..9cf543971 100644 --- a/contrib/sparverius/xjsonize/DATS/symbol.dats +++ b/contrib/sparverius/xjsonize/DATS/symbol.dats @@ -14,7 +14,8 @@ implement jsonize_symbol(x0) = -jsonval_labval1("symbol", jsonize(x0.name())) + node("symbol", jsonize(x0.name())) +(* jsonval_labval1("symbol", jsonize(x0.name())) *) implement labify_symbol(x0) = ("symbol", jsonize(x0.name())) diff --git a/contrib/sparverius/xjsonize/DATS/xjsonize.dats b/contrib/sparverius/xjsonize/DATS/xjsonize.dats index 11d6a778c..c1363915a 100644 --- a/contrib/sparverius/xjsonize/DATS/xjsonize.dats +++ b/contrib/sparverius/xjsonize/DATS/xjsonize.dats @@ -49,6 +49,7 @@ UN = "prelude/SATS/unsafe.sats" #staload "./../SATS/lexing.sats" #staload "./../SATS/stamp0.sats" #staload "./../SATS/symbol.sats" +#staload "./../SATS/filpath.sats" #staload "./../SATS/staexp0.sats" #staload "./../SATS/dynexp0.sats" #staload "./../SATS/staexp1.sats" @@ -66,6 +67,7 @@ UN = "prelude/SATS/unsafe.sats" (* #staload _ = "./label0.dats" *) (* #staload _ = "./locinfo.dats" *) (* #staload _ = "./lexing_token.dats" *) +(* #staload _ = "./filpath.dats" *) (* #staload _ = "./staexp0.dats" *) (* #staload _ = "./dynexp0.dats" *) (* #staload _ = "./stamp0.dats" *) @@ -86,6 +88,7 @@ UN = "prelude/SATS/unsafe.sats" #dynload "./label0.dats" #dynload "./locinfo.dats" #dynload "./lexing_token.dats" +#dynload "./filpath.dats" #dynload "./staexp0.dats" #dynload "./dynexp0.dats" #dynload "./staexp1.dats" diff --git a/contrib/sparverius/xjsonize/Makefile b/contrib/sparverius/xjsonize/Makefile index 9f51562de..5a308c636 100644 --- a/contrib/sparverius/xjsonize/Makefile +++ b/contrib/sparverius/xjsonize/Makefile @@ -38,6 +38,7 @@ symbol.sats \ label0.sats \ locinfo.sats \ lexing.sats \ +filpath.sats \ dynexp0.sats \ staexp0.sats \ dynexp1.sats \ @@ -58,6 +59,7 @@ symbol.dats \ label0.dats \ locinfo.dats \ lexing_token.dats \ +filpath.dats \ staexp0.dats \ dynexp0.dats \ staexp1.dats \ From 367c94885706d2d97b395d8675f4807a991362e3 Mon Sep 17 00:00:00 2001 From: Richard Date: Sat, 14 Dec 2019 02:09:22 -0500 Subject: [PATCH 11/16] adding libxjsonize --- contrib/sparverius/xjsonize/CATS/lexbuf.cats | 89 +++++++++++++++++++ contrib/sparverius/xjsonize/CATS/locinfo.cats | 56 ++++++++++++ contrib/sparverius/xjsonize/CATS/parsing.cats | 70 +++++++++++++++ contrib/sparverius/xjsonize/Makefile | 10 +++ 4 files changed, 225 insertions(+) create mode 100644 contrib/sparverius/xjsonize/CATS/lexbuf.cats create mode 100644 contrib/sparverius/xjsonize/CATS/locinfo.cats create mode 100644 contrib/sparverius/xjsonize/CATS/parsing.cats diff --git a/contrib/sparverius/xjsonize/CATS/lexbuf.cats b/contrib/sparverius/xjsonize/CATS/lexbuf.cats new file mode 100644 index 000000000..bf9eae13a --- /dev/null +++ b/contrib/sparverius/xjsonize/CATS/lexbuf.cats @@ -0,0 +1,89 @@ +/***********************************************************************/ +/* */ +/* Applied Type System */ +/* */ +/***********************************************************************/ + +/* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*/ + +/* ****** ****** */ +// +// Author: Hongwei Xi +// Start Time: May, 2018 +// Authoremail: gmhwxi@gmail.com +// +/* ****** ****** */ + +#ifndef XANADU_SRCGEN_CATS_LEXBUF +#define XANADU_SRCGEN_CATS_LEXBUF + +/* ****** ****** */ + +/* +typedef +lexbuf_tflat = +$extype_struct +"xats_lexbuf_struct" of +{ + base_ntot= int +, base_nrow= int +, base_ncol= int +(* +, char= int +*) +, cbuf= string +// +, begp= ptr +, endp= ptr, curp= ptr +// +, cbhead= cblist, cbtail= cblist +// +} (* end of [lexbuf] *) +*/ + +typedef struct { +// + atstype_int ntot ; // char number + atstype_int nrow ; // line number + atstype_int ncol ; // line offset +// +/* + atstype_int char ; // ungetc +*/ + atstype_ptr cbuf ; // prefix +// + atstype_ptr begp ; // start + atstype_ptr endp ; // finish + atstype_ptr curp ; // current +// + atstype_ptr cbhead ; // 1st cblock + atstype_ptr cbtail ; // rest of cblocks +// +} xats_lexbuf_struct ; + +/* ****** ****** */ + +#endif // end of [XANADU_SRCGEN_CATS_LEXBUF] + +/* ****** ****** */ + +/* end of [xats_lexbuf.cats] */ diff --git a/contrib/sparverius/xjsonize/CATS/locinfo.cats b/contrib/sparverius/xjsonize/CATS/locinfo.cats new file mode 100644 index 000000000..002db0e9d --- /dev/null +++ b/contrib/sparverius/xjsonize/CATS/locinfo.cats @@ -0,0 +1,56 @@ +/***********************************************************************/ +/* */ +/* Applied Type System */ +/* */ +/***********************************************************************/ + +/* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*/ + +/* ****** ****** */ +// +// Author: Hongwei Xi +// Start Time: May, 2018 +// Authoremail: gmhwxi@gmail.com +// +/* ****** ****** */ + +#ifndef \ +ATS3_SRCGEN_CATS_XATS_LOCINFO +#define \ +ATS3_SRCGEN_CATS_XATS_LOCINFO + +/* ****** ****** */ + +typedef struct { + atstype_int ntot ; // char number + atstype_int nrow ; // line number + atstype_int ncol ; // line offset +} xats_position_struct ; + +/* ****** ****** */ +// +#endif // end if [ifndef] +// [ATS3_SRCGEN_CATS_XATS_LOCINFO] +// +/* ****** ****** */ + +/* end of [xats_locinfo.cats] */ diff --git a/contrib/sparverius/xjsonize/CATS/parsing.cats b/contrib/sparverius/xjsonize/CATS/parsing.cats new file mode 100644 index 000000000..4b4d1bd30 --- /dev/null +++ b/contrib/sparverius/xjsonize/CATS/parsing.cats @@ -0,0 +1,70 @@ +/***********************************************************************/ +/* */ +/* Applied Type System */ +/* */ +/***********************************************************************/ + +/* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*/ + +/* ****** ****** */ +// +// Author: Hongwei Xi +// Start Time: June, 2018 +// Authoremail: gmhwxi@gmail.com +// +/* ****** ****** */ +// +#ifndef \ +ATS3_SRCGEN_CATS_XATS_PARSING +#define \ +ATS3_SRCGEN_CATS_XATS_PARSING +// +/* ****** ****** */ + +/* +typedef +tokbuf_tflat = +$extype_struct +"xats_tokbuf_struct" of +{ + token *begp; + token *endp; + token *curp; +} (* end of [tokbuf] *) +*/ + +typedef struct { +// + atstype_ptr begp ; // start + atstype_ptr endp ; // finish + atstype_ptr curp ; // current +// +} xats_tokbuf_struct ; + +/* ****** ****** */ +// +#endif // end if [ifndef] +// [ATS3_SRCGEN_CATS_XATS_PARSING] +// +/* ****** ****** */ + +/* end of [xats_parsing.cats] */ diff --git a/contrib/sparverius/xjsonize/Makefile b/contrib/sparverius/xjsonize/Makefile index 5a308c636..89c541d49 100644 --- a/contrib/sparverius/xjsonize/Makefile +++ b/contrib/sparverius/xjsonize/Makefile @@ -6,6 +6,7 @@ CC=gcc SED=sed +CP=cp RMF=rm -f ###### @@ -105,6 +106,15 @@ $(INCLUDE) $(CFLAGS) $(GCFLAG) $^ $(LIBGC) $(LIBRARY) # ###### +libxjsonize: \ +$(OBJSATS) $(OBJDATS) \ +BUILD/libxjsonize_dats.o ; \ +($(AR) -r $@.a $^ && $(CP) -f $@.a ./../../../lib) +BUILD/libxjsonize_dats.o: \ +DATS/xjsonize.dats; $(PATSCC) -DATS _LIBXJSONIZE_ -o $@ -c $< + +###### + BUILD/%_sats.c: \ ./SATS/%.sats ; $(PATSOPT) -o $@ --static $< BUILD/%_dats.c: \ From 3446a6a17ec0d884c80e0f2cf0665ad0e8b10851 Mon Sep 17 00:00:00 2001 From: Richard Date: Sat, 14 Dec 2019 03:07:17 -0500 Subject: [PATCH 12/16] updating libxjsonize --- contrib/sparverius/xjsonize/DATS/xjsonize.dats | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/contrib/sparverius/xjsonize/DATS/xjsonize.dats b/contrib/sparverius/xjsonize/DATS/xjsonize.dats index c1363915a..0760f3827 100644 --- a/contrib/sparverius/xjsonize/DATS/xjsonize.dats +++ b/contrib/sparverius/xjsonize/DATS/xjsonize.dats @@ -80,6 +80,16 @@ UN = "prelude/SATS/unsafe.sats" (* #staload _ = "./dynexp3.dats" *) (* #staload _ = "./intrep0.dats" *) +#ifdef +_LIBXJSONIZE_ +#then +#define +ATS_MAINATSFLAG 1 +#define +ATS_DYNLOADNAME "libxjsonize_dynloadall" +#endif // #ifdef + + #dynload "./json.dats" #dynload "./basics.dats" @@ -102,6 +112,10 @@ UN = "prelude/SATS/unsafe.sats" // (* ****** ****** *) // +#ifdef +_LIBXJSONIZE_ +#then +#else implement main0(argc, argv) = ( @@ -112,6 +126,7 @@ then interp0_main0(argc, argv) else prerrln! ("Hello from ATS3(xinterp)!") // end of [if] ) (* end of [main] *) +#endif // ifdef(_LIBXJSONIZE_) // (* ****** ****** *) From 4f894b0fa05483dc7b5a1eb855269b8aef003106 Mon Sep 17 00:00:00 2001 From: Richard Date: Sun, 15 Dec 2019 02:42:29 -0500 Subject: [PATCH 13/16] updating dynexp3 --- contrib/sparverius/xjsonize/DATS/dynexp2.dats | 14 +- contrib/sparverius/xjsonize/DATS/dynexp3.dats | 692 ++++++++++++++++++ contrib/sparverius/xjsonize/DATS/intrep0.dats | 9 + contrib/sparverius/xjsonize/SATS/dynexp3.sats | 7 +- 4 files changed, 719 insertions(+), 3 deletions(-) diff --git a/contrib/sparverius/xjsonize/DATS/dynexp2.dats b/contrib/sparverius/xjsonize/DATS/dynexp2.dats index 43e6ddb5e..6f4481726 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp2.dats @@ -247,7 +247,7 @@ jsonize_d2exp node("d2exp", res) where val res = ( -case- x0.node() of +case+ x0.node() of // | D2Eint(tok) => jsonify("D2Eint", "tok", jsonize(tok)) @@ -364,11 +364,23 @@ case- x0.node() of ) ) // +(* +| D2Eflat(d2e1) => + fprint!(out, "D2Eflat(", d2e1, ")") +*) +// | D2Eaddr(d2e1) => jsonify("D2Eaddr", "d2e1", jsonize(d2e1)) +| D2Eeval(d2e1) => + jsonify("D2Eeval", "d2e1", jsonize(d2e1)) | D2Efold(d2e1) => jsonify("D2Efold", "d2e1", jsonize(d2e1)) // +| D2Elazy(d2e1) => + jsonify("D2Elazy", "d2e1", jsonize(d2e1)) +| D2Ellazy(d2e1, opt2) => + jsonify("D2Ellazy", ("d2e1", "opt2"), (jsonize(d2e1), jsonize_option(opt2))) +// | D2Eanno(d2e1, s2e2) => jsonify("D2Eanno", ("d2e1", "s2e2"), (jsonize(d2e1), jsonize(s2e2))) // diff --git a/contrib/sparverius/xjsonize/DATS/dynexp3.dats b/contrib/sparverius/xjsonize/DATS/dynexp3.dats index 7a2de5ecf..30a1626c8 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp3.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp3.dats @@ -17,6 +17,7 @@ #staload "./../SATS/lexing.sats" #staload "./../SATS/label0.sats" +#staload "./../SATS/filpath.sats" #staload "./../SATS/staexp0.sats" #staload "./../SATS/dynexp0.sats" @@ -32,6 +33,478 @@ #staload "./../SATS/dynexp3.sats" +implement +jsonize_val = jsonize_filpath + + +implement +jsonize_val = jsonize_s2exp +implement +jsonize_val = jsonize_d2exp +implement +jsonize_val = jsonize_d3pat + +implement +jsonize_val = jsonize_d2pitm +implement +jsonize_val = jsonize_s2var +implement +jsonize_val = jsonize_d2var +implement +jsonize_val = jsonize_d2cst +implement +jsonize_val = jsonize_d2con +implement +jsonize_val = jsonize_ti2arg +implement +jsonize_val = jsonize_tq2arg +implement +jsonize_val = jsonize_sq2arg +implement +jsonize_val = jsonize_f2arg + +implement +jsonize_val = jsonize_t2ype + +implement +jsonize_val = jsonize_d3ecl +implement +jsonize_val = jsonize_d3clau +implement +jsonize_val = jsonize_f3arg +implement +jsonize_val = jsonize_d3gua +implement +jsonize_val = jsonize_v3aldecl +implement +jsonize_val = jsonize_v3ardecl +implement +jsonize_val = jsonize_f3undecl +implement +jsonize_val = jsonize_d3exp + + +implement +jsonize_d3pat + (x0) = +( +case- x0.node() of +// +| D3Pnil() => + jsonify("D3Pnil") +| D3Pany() => + jsonify("D3Pany") +// +| D3Pint(tok) => + jsonify("D3Pint", "tok", jsonize(tok)) +| D3Pbtf(tok) => + jsonify("D3Pbtf", "tok", jsonize(tok)) +| D3Pchr(tok) => + jsonify("D3Pchr", "tok", jsonize(tok)) +| D3Pflt(tok) => + jsonify("D3Pflt", "tok", jsonize(tok)) +| D3Pstr(tok) => + jsonify("D3Pstr", "tok", jsonize(tok)) +// +| D3Pvar(d2v) => + jsonify("D3Pvar", "d2v", jsonize(d2v)) +// +| D3Pcon1(d2c0) => + jsonify("D3Pcon1", "d2c0", jsonize(d2c0)) +| D3Pcon2(d2cs) => + jsonify("D3Pcon2", "d2cs", jsonize_list(d2cs)) +// +| D3Psym0(sym0, d2pis) => + jsonify("D3Psym0", ("sym0", "d2pis"), + (jsonize(sym0), jsonize_list(d2pis)) + ) +// +| D3Pdapp + (d3f0, npf0, d3ps) => + jsonify("D3Pdapp", ("d3f0", "npf0", "d3ps"), + (jsonize(d3f0), jsonize(npf0), jsonize_list(d3ps)) + ) +// +| D3Ptuple + (knd1, npf2, ldps) => + jsonify("D3Ptuple", ("knd1", "npf2", "ldps"), + (jsonize(knd1), jsonize(npf2), jsonize_list(ldps)) + ) +// +| D3Panno(d3p1, s2e2) => + jsonify("D3Panno", ("d3p1", "s2e2"), (jsonize(d3p1), jsonize(s2e2))) +// +| D3Pcast(d3p1, t2p2) => + jsonify("D3Pcast", ("d3p1", "t2p2"), (jsonize(d3p1), jsonize(t2p2))) +// +| D3Pnone0() => + jsonify("D3Pnone0") +| D3Pnone1(d1psrc) => + jsonify("D3Pnone1", "d1psrc", jsonize(d1psrc)) +| D3Pnone2(d2psrc) => + jsonify("D3Pnone2", "d2psrc", jsonize(d2psrc)) +// +) (* end of [jsonize_d3pat] *) + + +implement +jsonize_f3arg + (x0) = +( +// +case+ +x0.node() of +// +| F3ARGnone2(f2a) => + jsonify("F3ARGnone2", "f2a", jsonize(f2a)) +| F3ARGnone3(f3a) => + jsonify("F3ARGnone2", "f3a", jsonize(f3a)) +// +| F3ARGsome_met(s2es) => + jsonify("F3ARGsome_met", "s2es", jsonize_list(s2es)) +// +| F3ARGsome_dyn(npf, d3ps) => + jsonify("F3ARGsome_dyn", ("npf", "d3ps"), + ( + jsonize(npf), + jsonize_list(d3ps) + ) + ) +| F3ARGsome_sta(s2vs, s2ps) => + jsonify("F3ARGsome_sta", ("s2vs", "s2ps"), + ( + jsonize_list(s2vs), + jsonize_list(s2ps) + ) + ) +// +) (* end of [jsonize_f3arg] *) + + +implement +jsonize_d3exp + (x0) = +( +case+ +x0.node() of +// +| D3Eint(tok) => + jsonify("D3Eint", "tok", jsonize(tok)) +| D3Ebtf(tok) => + jsonify("D3Ebtf", "tok", jsonize(tok)) +| D3Echr(tok) => + jsonify("D3Echr", "tok", jsonize(tok)) +| D3Eflt(tok) => + jsonify("D3Eflt", "tok", jsonize(tok)) +| D3Estr(tok) => + jsonify("D3Estr", "tok", jsonize(tok)) +// +| D3Etop(tok) => + jsonify("D3Etop", "tok", jsonize(tok)) +// +| D3Evar(d2v1) => + jsonify("D3Evar", "d2v1", jsonize(d2v1)) +// +| D3Econ1(d2c1) => + jsonify("D3Econ1", "d2c1", jsonize(d2c1)) +| D3Ecst1(d2c1) => + jsonify("D3Ecst1", "d2c1", jsonize(d2c1)) +// +| D3Econ2(d2cs) => + jsonify("D3Econ2", "d2cs", jsonize_list(d2cs)) +| D3Ecst2(d2cs) => + jsonify("D3Ecst2", "d2cs", jsonize_list(d2cs)) +// +| D3Esym0 + (d1e1, dpis) => +(* + jsonify("D3Esym0", d1e1) +*) +(* + jsonify("D3Esym0", d1e1, dpis) +*) +// (* + let + val t2p0 = x0.type() + in + jsonify("D3Esym0", ("d1e1", "t2p0"), (jsonize(d1e1), jsonize(t2p0))) + end +// *) +// +| D3Efcst(d2c1) => + jsonify("D3Efcst", "d2c1", jsonize(d2c1)) +// +| D3Etcst + (d2c1, ti3a, ti2s) => + jsonify("D3Etcst", ("d2c1", "ti3a", "ti2s"), + (jsonize(d2c1), jsonize(ti3a), jsonize_list(ti2s)) + ) +// +| D3Etimp + (d2e1, tsub1, d2c2, tsub2) => + jsonify("D3Etimp", ("d2e1", "tsub1", "d2c2", "tsub2"), + ( + jsonize(d2e1), + jsonize_list(tsub1), + jsonize(d2c2), + jsonize_list(tsub2) + ) + ) +// +| D3Esap0 + (d3e1, s2es) => + jsonify("D3Esap0", ("d3e1", "s2es"), + ( + jsonize(d3e1), + jsonize_list(s2es) + ) + ) +| D3Esap1 + (d3e1, s2es) => + jsonify("D3Esap1", ("d3e1", "s2es"), + ( + jsonize(d3e1), + jsonize_list(s2es) + ) + ) +// +| D3Etapp + (d2f0, s2es) => + jsonify("D3Etapp", ("d2f0", "s2es"), + ( + jsonize(d2f0), + jsonize_list(s2es) + ) + ) +// +| D3Edapp + (d3e1, npf2, d3es) => + jsonify("D3Edapp", ("d3e1", "npf2", "d3es"), + ( + jsonize(d3e1), + jsonize(npf2), + jsonize_list(d3es) + ) + ) +// +| D3Eproj + (d3e1, lab2, idx2) => + jsonify("D3Eproj", ("d3e1", "lab2", "idx2"), + ( + jsonize(d3e1), + jsonize(lab2), + jsonize(idx2) + ) + ) +// +| D3Elet(d3cs, d3e2) => + jsonify("D3Elet", ("d3cs", "d3e2"), + ( + jsonize_list(d3cs), + jsonize(d3e2) + ) + ) +| D3Ewhere(d3e1, d3cs) => + jsonify("D3Ewhere", ("d3e1", "d3cs"), + ( + jsonize(d3e1), + jsonize_list(d3cs) + ) + ) +// +| D3Eseqn(d3es, d3e2) => + jsonify("D3Eseqn", ("d3es", "d3e2"), + ( + jsonize_list(d3es), + jsonize(d3e2) + ) + ) +// +| D3Etuple + (knd1, npf2, d3es) => + jsonify("D3Etuple", ("knd1", "npf2", "d3es"), + ( + jsonize(knd1), + jsonize(npf2), + jsonize_list(d3es) + ) + ) +// +| D3Eassgn + (d3e1, d3e2) => + jsonify("D3Eassgn", ("d3e1", "d3e2"), (jsonize(d3e1), jsonize(d3e2))) +// +| D3Edtsel + (lab0, dpis, npf2, arg3) => + ( + case+ + arg3 of + | + None() => + jsonify("D2Edtsel", ("lab0", "dpis"), + ( + jsonize(lab0), + jsonize_list(dpis) + ) + ) + | + Some(d3es) => + jsonify("D2Edtsel", ("lab0", "dpis", "npf2", "d3es"), + ( + jsonize(lab0), + jsonize_list(dpis), + jsonize(npf2), + jsonize_list(d3es) + ) + ) + ) +// +| D3Eif0 + (d3e1, d3e2, opt3) => + jsonify("D3Eif0", ("d3e1", "d3e2", "opt3"), + ( + jsonize(d3e1), + jsonize(d3e2), + jsonize_option(opt3) + ) + ) +// +| D3Ecase + (knd0, d3e1, dcls) => + jsonify("D3Ecase", ("knd0", "d3e1", "dcls"), + ( + jsonize(knd0), + jsonize(d3e1), + jsonize_list(dcls) + ) + ) +// +| D3Elam + (knd, f3as, tres, arrw, body) => + jsonify("D3Elam", ("knd", "f3as", "tres", "arrw", "body"), + ( + jsonize(knd), + jsonize_list(f3as), + jsonize(tres), + jsonize(arrw), + jsonize(body) + ) + ) +| D3Efix + (knd, fid, f3as, tres, arrw, body) => + jsonify("D3Efix", ("knd", "fid", "f3as", "tres", "arrw", "body"), + ( + jsonize(knd), + jsonize(fid), + jsonize_list(f3as), + jsonize(tres), + jsonize(arrw), + jsonize(body) + ) + ) +// +| D3Eaddr(d3e1) => + ( + jsonify("D3Eaddr", "d3e1", jsonize(d3e1)) + ) +| D3Efold(d3e1) => + ( + jsonify("D3Efold", "d3e1", jsonize(d3e1)) + ) +// +| D3Eeval + (knd, d3e1) => + jsonify("D3Eeval", ("knd", "d3e1"), (jsonize(knd), jsonize(d3e1))) +// +| D3Elazy(d3e1) => + ( + jsonify("D3Elazy", "d3e1", jsonize(d3e1)) + ) +| D3Ellazy(d3e1, opt2) => + jsonify("D3Ellazy", ("d3e1", "opt2"), + ( + jsonize(d3e1), + jsonize_option(opt2) + ) + ) +// +| D3Eanno(d3e1, s2e2) => + jsonify("D3Eanno", ("d3e1", "s2e2"), (jsonize(d3e1), jsonize(s2e2))) +// +| D3Eflat(d3e1) => + ( + jsonify("D3Eflat", "d3e1", jsonize(d3e1)) + ) +| D3Etalf(d3e1) => + ( + jsonify("D3Etalf", "d3e1", jsonize(d3e1)) + ) +// +| D3Elcast(d3e1, lab2) => + jsonify("D3Elcast", ("d3e1", "lab2"), (jsonize(d3e1), jsonize(lab2))) +| D3Etcast(d3e1, t2p2) => + jsonify("D3Etcast", ("d3e1", "t2p2"), (jsonize(d3e1), jsonize(t2p2))) +// +| D3Enone0() => + jsonify("D3Enone0") +| D3Enone1(d2esrc) => + jsonify("D3Enone1", "d2esrc", jsonize(d2esrc)) +| D3Enone2(d3esrc) => + jsonify("D3Enone2", "d3esrc", jsonize(d3esrc)) +// +) + + +implement +jsonize_d3gua + (x0) = +( +case+ +x0.node() of +| D3GUAexp(d3e) => + jsonify("D3GUAexp", "d3e", jsonize(d3e)) +| D3GUAmat(d3e, d3p) => + jsonify("D3GUAmat", ("d3e", "d3p"), (jsonize(d3e), jsonize(d3p))) +) (* end of [jsonize_d3gua] *) + + +implement +jsonize_d3clau + (x0) = +( +case+ +x0.node() of +// +| D3CLAUpat(d3gp) => + jsonify("D3CLAUpat", "d3gp", jsonize(d3gp)) +// +| D3CLAUexp(d3gp, d0e0) => + jsonify("D3CLAUexp", ("d3gp", "d0e0"), (jsonize(d3gp), jsonize(d0e0))) +// +) (* end of [jsonize_d3clau] *) + + +implement +jsonize_d3gpat + (x0) = +( +case+ +x0.node() of +// +| D3GPATpat(d3p) => + jsonify("D3GPATpat", "d3p", jsonize(d3p)) +// +| D3GPATgua(d3p, d3gs) => + jsonify("D3GPATgua", ("d3p", "d3gs"), + ( + jsonize(d3p), + jsonize_list(d3gs) + ) + ) +// +) (* end of [jsonize_d3gpat] *) + + local implement jsonize_val = jsonize_t2ype @@ -50,3 +523,222 @@ case+ x0 of ) end + + +local + +implement +jsonize_val = jsonize_d3ecl +implement +jsonize_val = jsonize_v3aldecl +implement +jsonize_val = jsonize_v3ardecl +implement +jsonize_val = jsonize_f3undecl + +in(*in-of-local*) + +implement +jsonize_d3ecl + (x0) = +( +// +case+ +x0.node() of +// +| D3Cd2ecl(d2c) => + jsonify("D3Cd2ecl", "d2c", jsonize(d2c)) +// +| D3Cstatic + (tok, d3c) => + jsonify("D3Cstatic", "d3c", jsonize(d3c)) +| D3Cextern + (tok, d3c) => + jsonify("D3Cextern", "d3c", jsonize(d3c)) +// +| D3Cinclude + (tok, src, knd, fopt, body) => + ( + jsonify("D3Cinclude", ("tok", "src", "knd", "fopt", "body"), + ( + jsonize(tok), + jsonize(src), + jsonize(knd), + jsonize_option(fopt), + jsonize(body) + ) + ) + ) where + { + val body = + ( + case+ body of + | None _ => "None()" + | Some _ => "Some()"): string + } +// +| D3Clocal(head, body) => + jsonify("D3Clocal", ("head", "body"), + ( + jsonize_list(head), + jsonize_list(body) + ) + ) +// +| D3Cvaldecl + (knd, mopt, v3ds) => + jsonify("D3Cvaldecl", ("knd", "mopt", "v3ds"), + ( + jsonize(knd), + jsonize(mopt), + jsonize_list(v3ds) + ) + ) +| D3Cvardecl + (knd, mopt, v3ds) => + jsonify("D3Cvardecl", ("knd", "mopt", "v3ds"), + ( + jsonize(knd), + jsonize(mopt), + jsonize_list(v3ds) + ) + ) +// +| D3Cfundecl + (knd, mopt, tqas, f3ds) => + jsonify("D3Cfundecl", ("knd", "mopt", "tqas", "f3ds"), + ( + jsonize(knd), + jsonize(mopt), + jsonize_list(tqas), + jsonize_list(f3ds) + ) + ) +// +| D3Cimpdecl1 + ( knd, mopt, sqas, tqas, id2c, ti3a, ti2s, f3as, res0, d3e0) => + jsonify("D3Cimpdecl1", + ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "f3as", "res0", "d3e0"), + ( + jsonize(knd), + jsonize(mopt), + jsonize_list(sqas), + jsonize_list(tqas), + jsonize(id2c), + jsonize(ti3a), + jsonize_list(ti2s), + jsonize_list(f3as), + jsonize(res0), + jsonize(d3e0) + ) + ) +| D3Cimpdecl2 + ( knd, mopt, sqas, tqas, id2c, ti3a, ti2s, f3as, res0, d3e0) => + jsonify("D3Cimpdecl2", + ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "f3as", "res0", "d3e0"), + ( + jsonize(knd), + jsonize(mopt), + jsonize_list(sqas), + jsonize_list(tqas), + jsonize(id2c), + jsonize(ti3a), + jsonize_list(ti2s), + jsonize_list(f3as), + jsonize(res0), + jsonize(d3e0) + ) + ) +| D3Cimpdecl3 + ( knd, mopt, sqas, tqas, id2c, ti3a, ti2s, f3as, res0, d3e0) => + jsonify("D3Cimpdecl3", + ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "f3as", "res0", "d3e0"), + ( + jsonize(knd), + jsonize(mopt), + jsonize_list(sqas), + jsonize_list(tqas), + jsonize(id2c), + jsonize(ti3a), + jsonize_list(ti2s), + jsonize_list(f3as), + jsonize(res0), + jsonize(d3e0) + ) + ) +// +| D3Cnone0() => + jsonify("D3Cnone0") +| D3Cnone1(d3csrc) => + jsonify("D3Cnone1", "d3csrc", jsonize(d3csrc)) +) +// +end // end of [local] + + +implement +jsonize_t2pcast + (x0) = +( +case+ x0 of +| T2PCASTnone() => + jsonify("T2PCASTnone") +| T2PCASTsome(t2p1, t2p2) => + jsonify("T2PCASTsome", ("t2p1", "t2p2"), (jsonize(t2p1), jsonize(t2p2))) +) (* end of [jsonize_t2pcast] *) + + +implement +jsonize_v3aldecl + (x0) = let +// +val+V3ALDECL(rcd) = x0 +// +in + jsonify("V3ALDECL@{", ("pat", "def", "wtp"), + ( + jsonize(rcd.pat), + jsonize_option(rcd.def), + jsonize_option(rcd.wtp) + ) + ) +end // end of [jsonize_v3aldecl] + + +implement +jsonize_v3ardecl + (x0) = let +// +val+V3ARDECL(rcd) = x0 +// +in + jsonify("V3ARDECL", ("d2v", "wth", "res", "ini"), + ( + jsonize(rcd.d2v), + jsonize_option(rcd.wth), + jsonize_option(rcd.res), + jsonize_option(rcd.ini) + ) + ) +end // end of [jsonize_v3ardecl] + + +implement +jsonize_f3undecl + (x0) = let +// +val+F3UNDECL(rcd) = x0 +// +in + jsonify("F3UNDECL@{", ("nam", "d2c", "arg", "res", "def", "ctp", "wtp"), + ( + jsonize(rcd.nam), + jsonize(rcd.d2c), + jsonize_list(rcd.a2g), + jsonize(rcd.res), + jsonize_option(rcd.def), + jsonize(rcd.ctp), + jsonize_option(rcd.wtp) + ) + ) +end // end of [jsonize_f3undecl] diff --git a/contrib/sparverius/xjsonize/DATS/intrep0.dats b/contrib/sparverius/xjsonize/DATS/intrep0.dats index adbb718b7..f2a3aa8e9 100644 --- a/contrib/sparverius/xjsonize/DATS/intrep0.dats +++ b/contrib/sparverius/xjsonize/DATS/intrep0.dats @@ -220,6 +220,15 @@ x0.node() of // | IR0Eaddr(ire1) => jsonify("IR0Eaddr", "ire1", jsonize(ire1)) +| IR0Efold(ire1) => + jsonify("IR0Efold", "ire1", jsonize(ire1)) +// +| IR0Eeval + (knd0, ire1) => + jsonify("IR0Eeval", ("knd0", "ire1"), (jsonize(knd0), jsonize(ire1))) +// +| IR0Elazy(ire1) => + jsonify("IR0Elazy", "ire1", jsonize(ire1)) | IR0Eflat(ire1) => jsonify("IR0Eflat", "ire1", jsonize(ire1)) | IR0Etalf(ire1) => diff --git a/contrib/sparverius/xjsonize/SATS/dynexp3.sats b/contrib/sparverius/xjsonize/SATS/dynexp3.sats index 64812543c..b10446747 100644 --- a/contrib/sparverius/xjsonize/SATS/dynexp3.sats +++ b/contrib/sparverius/xjsonize/SATS/dynexp3.sats @@ -7,7 +7,11 @@ fun jsonize_ti3arg : jsonize_type(ti3arg) overload jsonize with jsonize_ti3arg -(* +fun +jsonize_d3pat : jsonize_type(d3pat) +overload jsonize with jsonize_d3pat + + fun jsonize_f3arg : jsonize_type(f3arg) overload jsonize with jsonize_f3arg @@ -47,4 +51,3 @@ overload jsonize with jsonize_f3undecl fun jsonize_d3ecl : jsonize_type(d3ecl) overload jsonize with jsonize_d3ecl -*) From 0d0af3e20c4972a3bd62e40ae85a1f2baacf3c9f Mon Sep 17 00:00:00 2001 From: Richard Date: Sun, 15 Dec 2019 02:49:30 -0500 Subject: [PATCH 14/16] updating --- contrib/sparverius/xjsonize/DATS/dynexp3.dats | 42 ++++++++++++++++--- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/contrib/sparverius/xjsonize/DATS/dynexp3.dats b/contrib/sparverius/xjsonize/DATS/dynexp3.dats index 30a1626c8..c8f1d2919 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp3.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp3.dats @@ -87,6 +87,8 @@ jsonize_val = jsonize_d3exp implement jsonize_d3pat (x0) = +node("d3pat", res) where +val res = ( case- x0.node() of // @@ -145,11 +147,14 @@ case- x0.node() of jsonify("D3Pnone2", "d2psrc", jsonize(d2psrc)) // ) (* end of [jsonize_d3pat] *) +end implement jsonize_f3arg (x0) = +node("f3arg", res) where +val res = ( // case+ @@ -179,11 +184,13 @@ x0.node() of ) // ) (* end of [jsonize_f3arg] *) - +end implement jsonize_d3exp (x0) = +node("d3exp", res) where +val res = ( case+ x0.node() of @@ -453,11 +460,13 @@ x0.node() of jsonify("D3Enone2", "d3esrc", jsonize(d3esrc)) // ) - +end implement jsonize_d3gua (x0) = +node("d3gua", res) where +val res = ( case+ x0.node() of @@ -466,11 +475,13 @@ x0.node() of | D3GUAmat(d3e, d3p) => jsonify("D3GUAmat", ("d3e", "d3p"), (jsonize(d3e), jsonize(d3p))) ) (* end of [jsonize_d3gua] *) - +end implement jsonize_d3clau (x0) = +node("d3clau", res) where +val res = ( case+ x0.node() of @@ -482,11 +493,13 @@ x0.node() of jsonify("D3CLAUexp", ("d3gp", "d0e0"), (jsonize(d3gp), jsonize(d0e0))) // ) (* end of [jsonize_d3clau] *) - +end implement jsonize_d3gpat (x0) = +node("d3gpat", res) where +val res = ( case+ x0.node() of @@ -503,7 +516,7 @@ x0.node() of ) // ) (* end of [jsonize_d3gpat] *) - +end local @@ -514,6 +527,8 @@ in implement jsonize_ti3arg (x0) = +node("ti3arg", res) where +val res = ( case+ x0 of | TI3ARGnone() => @@ -521,6 +536,7 @@ case+ x0 of | TI3ARGsome(t2ps) => jsonify("TI3ARGnone", "t2ps", jsonize_list(t2ps)) ) +end end @@ -541,6 +557,8 @@ in(*in-of-local*) implement jsonize_d3ecl (x0) = +node("d3ecl", res) where +val res = ( // case+ @@ -672,6 +690,7 @@ x0.node() of | D3Cnone1(d3csrc) => jsonify("D3Cnone1", "d3csrc", jsonize(d3csrc)) ) +end // end // end of [local] @@ -679,6 +698,8 @@ end // end of [local] implement jsonize_t2pcast (x0) = +node("t2pcats", res) where +val res = ( case+ x0 of | T2PCASTnone() => @@ -686,7 +707,7 @@ case+ x0 of | T2PCASTsome(t2p1, t2p2) => jsonify("T2PCASTsome", ("t2p1", "t2p2"), (jsonize(t2p1), jsonize(t2p2))) ) (* end of [jsonize_t2pcast] *) - +end implement jsonize_v3aldecl @@ -695,6 +716,8 @@ jsonize_v3aldecl val+V3ALDECL(rcd) = x0 // in +node("v3aldecl", res) where +val res = jsonify("V3ALDECL@{", ("pat", "def", "wtp"), ( jsonize(rcd.pat), @@ -702,6 +725,7 @@ in jsonize_option(rcd.wtp) ) ) +end end // end of [jsonize_v3aldecl] @@ -712,6 +736,8 @@ jsonize_v3ardecl val+V3ARDECL(rcd) = x0 // in +node("v3ardecl", res) where +val res = jsonify("V3ARDECL", ("d2v", "wth", "res", "ini"), ( jsonize(rcd.d2v), @@ -720,6 +746,7 @@ in jsonize_option(rcd.ini) ) ) +end end // end of [jsonize_v3ardecl] @@ -730,6 +757,8 @@ jsonize_f3undecl val+F3UNDECL(rcd) = x0 // in +node("f3undecl", res) where +val res = jsonify("F3UNDECL@{", ("nam", "d2c", "arg", "res", "def", "ctp", "wtp"), ( jsonize(rcd.nam), @@ -741,4 +770,5 @@ in jsonize_option(rcd.wtp) ) ) +end end // end of [jsonize_f3undecl] From 6a5e63c96e48699fd2266443a848a2f4c8c4995a Mon Sep 17 00:00:00 2001 From: Richard Date: Sun, 15 Dec 2019 21:56:23 -0500 Subject: [PATCH 15/16] updating --- contrib/sparverius/xjsonize/.depend | 18 +- contrib/sparverius/xjsonize/DATS/dynexp3.dats | 196 +++++----- .../DATS/{interp0.dats => jsonize0.dats} | 62 ++- contrib/sparverius/xjsonize/DATS/label0.dats | 40 +- .../sparverius/xjsonize/DATS/xjsonize.dats | 11 +- .../sparverius/xjsonize/HATS/libxatsopt.hats | 19 - contrib/sparverius/xjsonize/Makefile | 14 +- contrib/sparverius/xjsonize/SATS/interp0.sats | 361 ------------------ contrib/sparverius/xjsonize/SATS/intrep0.sats | 44 --- .../sparverius/xjsonize/SATS/jsonize0.sats | 46 +++ 10 files changed, 184 insertions(+), 627 deletions(-) rename contrib/sparverius/xjsonize/DATS/{interp0.dats => jsonize0.dats} (95%) delete mode 100644 contrib/sparverius/xjsonize/SATS/interp0.sats delete mode 100644 contrib/sparverius/xjsonize/SATS/intrep0.sats create mode 100644 contrib/sparverius/xjsonize/SATS/jsonize0.sats diff --git a/contrib/sparverius/xjsonize/.depend b/contrib/sparverius/xjsonize/.depend index 0c5b78a90..0da4e82e7 100644 --- a/contrib/sparverius/xjsonize/.depend +++ b/contrib/sparverius/xjsonize/.depend @@ -15,24 +15,22 @@ BUILD/staexp2_sats.o : SATS/json.sats BUILD/dynexp2_sats.o : SATS/json.sats BUILD/dynexp3_sats.o : SATS/json.sats BUILD/fixity_sats.o : SATS/json.sats -BUILD/intrep0_sats.o : SATS/json.sats -BUILD/interp0_sats.o : +BUILD/jsonize0_sats.o : BUILD/json_dats.o : SATS/json.sats BUILD/basics_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/basics.sats BUILD/stamp0_dats.o : SATS/stamp0.sats SATS/json.sats DATS/json.dats BUILD/symbol_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/symbol.sats -BUILD/label0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats SATS/dynexp1.sats SATS/label0.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/statyp2.sats SATS/staexp2.sats SATS/intrep0.sats SATS/label0.sats SATS/symbol.sats +BUILD/label0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/label0.sats SATS/symbol.sats BUILD/locinfo_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/locinfo.sats BUILD/lexing_token_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/locinfo.sats SATS/basics.sats SATS/symbol.sats BUILD/filpath_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/filpath.sats BUILD/staexp0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats BUILD/dynexp0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/lexing.sats -BUILD/staexp1_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats SATS/staexp1.sats SATS/symbol.sats -BUILD/dynexp1_dats.o : SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/label0.sats SATS/lexing.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats +BUILD/staexp1_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats SATS/locinfo.sats SATS/staexp1.sats DATS/staexp0.dats SATS/symbol.sats +BUILD/dynexp1_dats.o : SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/label0.sats SATS/lexing.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats DATS/dynexp0.dats BUILD/statyp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/staexp2.sats SATS/statyp2.sats SATS/symbol.sats SATS/locinfo.sats SATS/stamp0.sats SATS/label0.sats BUILD/staexp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/basics.sats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats SATS/staexp1.sats SATS/staexp2.sats SATS/symbol.sats SATS/locinfo.sats SATS/stamp0.sats SATS/label0.sats -BUILD/dynexp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/locinfo.sats SATS/label0.sats SATS/dynexp0.sats SATS/staexp0.sats SATS/dynexp1.sats SATS/dynexp2.sats SATS/staexp2.sats SATS/symbol.sats SATS/stamp0.sats -BUILD/dynexp3_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/label0.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats -BUILD/intrep0_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/label0.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/intrep0.sats -BUILD/interp0_dats.o : HATS/libxatsopt.hats SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/intrep0.sats DATS/json.dats DATS/basics.dats DATS/label0.dats DATS/locinfo.dats DATS/lexing_token.dats DATS/stamp0.dats DATS/symbol.dats DATS/filpath.dats DATS/staexp0.dats DATS/dynexp0.dats DATS/staexp1.dats DATS/dynexp1.dats DATS/statyp2.dats DATS/staexp2.dats DATS/dynexp2.dats DATS/dynexp3.dats DATS/intrep0.dats DATS/json.dats SATS/interp0.sats -BUILD/xjsonize_dats.o : SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/intrep0.sats SATS/interp0.sats +BUILD/dynexp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/locinfo.sats SATS/label0.sats SATS/filpath.sats SATS/dynexp0.sats SATS/staexp0.sats SATS/dynexp1.sats SATS/dynexp2.sats SATS/staexp2.sats SATS/symbol.sats SATS/stamp0.sats +BUILD/dynexp3_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/label0.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats +BUILD/jsonize0_dats.o : HATS/libxatsopt.hats SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats DATS/json.dats DATS/basics.dats DATS/label0.dats DATS/locinfo.dats DATS/lexing_token.dats DATS/stamp0.dats DATS/symbol.dats DATS/filpath.dats DATS/staexp0.dats DATS/dynexp0.dats DATS/staexp1.dats DATS/dynexp1.dats DATS/statyp2.dats DATS/staexp2.dats DATS/dynexp2.dats DATS/dynexp3.dats DATS/json.dats +BUILD/xjsonize_dats.o : SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/jsonize0.sats diff --git a/contrib/sparverius/xjsonize/DATS/dynexp3.dats b/contrib/sparverius/xjsonize/DATS/dynexp3.dats index c8f1d2919..2573ee90a 100644 --- a/contrib/sparverius/xjsonize/DATS/dynexp3.dats +++ b/contrib/sparverius/xjsonize/DATS/dynexp3.dats @@ -88,7 +88,7 @@ implement jsonize_d3pat (x0) = node("d3pat", res) where -val res = +val res = ( case- x0.node() of // @@ -117,33 +117,33 @@ case- x0.node() of jsonify("D3Pcon2", "d2cs", jsonize_list(d2cs)) // | D3Psym0(sym0, d2pis) => - jsonify("D3Psym0", ("sym0", "d2pis"), + jsonify("D3Psym0", ("sym0", "d2pis"), (jsonize(sym0), jsonize_list(d2pis)) ) // | D3Pdapp (d3f0, npf0, d3ps) => - jsonify("D3Pdapp", ("d3f0", "npf0", "d3ps"), + jsonify("D3Pdapp", ("d3f0", "npf0", "d3ps"), (jsonize(d3f0), jsonize(npf0), jsonize_list(d3ps)) ) // | D3Ptuple (knd1, npf2, ldps) => - jsonify("D3Ptuple", ("knd1", "npf2", "ldps"), + jsonify("D3Ptuple", ("knd1", "npf2", "ldps"), (jsonize(knd1), jsonize(npf2), jsonize_list(ldps)) ) // | D3Panno(d3p1, s2e2) => jsonify("D3Panno", ("d3p1", "s2e2"), (jsonize(d3p1), jsonize(s2e2))) // -| D3Pcast(d3p1, t2p2) => - jsonify("D3Pcast", ("d3p1", "t2p2"), (jsonize(d3p1), jsonize(t2p2))) +| D3Ptcast(d3p1, t2p2) => + jsonify("D3Ptcast", ("d3p1", "t2p2"), (jsonize(d3p1), jsonize(t2p2))) // -| D3Pnone0() => +| D3Pnone0() => jsonify("D3Pnone0") -| D3Pnone1(d1psrc) => +| D3Pnone1(d1psrc) => jsonify("D3Pnone1", "d1psrc", jsonize(d1psrc)) -| D3Pnone2(d2psrc) => +| D3Pnone2(d2psrc) => jsonify("D3Pnone2", "d2psrc", jsonize(d2psrc)) // ) (* end of [jsonize_d3pat] *) @@ -154,7 +154,7 @@ implement jsonize_f3arg (x0) = node("f3arg", res) where -val res = +val res = ( // case+ @@ -176,9 +176,9 @@ x0.node() of ) ) | F3ARGsome_sta(s2vs, s2ps) => - jsonify("F3ARGsome_sta", ("s2vs", "s2ps"), + jsonify("F3ARGsome_sta", ("s2vs", "s2ps"), ( - jsonize_list(s2vs), + jsonize_list(s2vs), jsonize_list(s2ps) ) ) @@ -190,7 +190,7 @@ implement jsonize_d3exp (x0) = node("d3exp", res) where -val res = +val res = ( case+ x0.node() of @@ -243,84 +243,84 @@ x0.node() of // | D3Etcst (d2c1, ti3a, ti2s) => - jsonify("D3Etcst", ("d2c1", "ti3a", "ti2s"), + jsonify("D3Etcst", ("d2c1", "ti3a", "ti2s"), (jsonize(d2c1), jsonize(ti3a), jsonize_list(ti2s)) ) // | D3Etimp (d2e1, tsub1, d2c2, tsub2) => - jsonify("D3Etimp", ("d2e1", "tsub1", "d2c2", "tsub2"), + jsonify("D3Etimp", ("d2e1", "tsub1", "d2c2", "tsub2"), ( - jsonize(d2e1), - jsonize_list(tsub1), - jsonize(d2c2), + jsonize(d2e1), + jsonize_list(tsub1), + jsonize(d2c2), jsonize_list(tsub2) ) ) // | D3Esap0 (d3e1, s2es) => - jsonify("D3Esap0", ("d3e1", "s2es"), + jsonify("D3Esap0", ("d3e1", "s2es"), ( - jsonize(d3e1), + jsonize(d3e1), jsonize_list(s2es) ) ) | D3Esap1 (d3e1, s2es) => - jsonify("D3Esap1", ("d3e1", "s2es"), + jsonify("D3Esap1", ("d3e1", "s2es"), ( - jsonize(d3e1), + jsonize(d3e1), jsonize_list(s2es) ) ) // | D3Etapp (d2f0, s2es) => - jsonify("D3Etapp", ("d2f0", "s2es"), + jsonify("D3Etapp", ("d2f0", "s2es"), ( - jsonize(d2f0), + jsonize(d2f0), jsonize_list(s2es) ) ) // | D3Edapp (d3e1, npf2, d3es) => - jsonify("D3Edapp", ("d3e1", "npf2", "d3es"), + jsonify("D3Edapp", ("d3e1", "npf2", "d3es"), ( - jsonize(d3e1), - jsonize(npf2), + jsonize(d3e1), + jsonize(npf2), jsonize_list(d3es) ) ) // | D3Eproj (d3e1, lab2, idx2) => - jsonify("D3Eproj", ("d3e1", "lab2", "idx2"), + jsonify("D3Eproj", ("d3e1", "lab2", "idx2"), ( - jsonize(d3e1), - jsonize(lab2), + jsonize(d3e1), + jsonize(lab2), jsonize(idx2) ) ) // | D3Elet(d3cs, d3e2) => - jsonify("D3Elet", ("d3cs", "d3e2"), + jsonify("D3Elet", ("d3cs", "d3e2"), ( - jsonize_list(d3cs), + jsonize_list(d3cs), jsonize(d3e2) ) ) | D3Ewhere(d3e1, d3cs) => - jsonify("D3Ewhere", ("d3e1", "d3cs"), + jsonify("D3Ewhere", ("d3e1", "d3cs"), ( - jsonize(d3e1), + jsonize(d3e1), jsonize_list(d3cs) ) ) // | D3Eseqn(d3es, d3e2) => - jsonify("D3Eseqn", ("d3es", "d3e2"), + jsonify("D3Eseqn", ("d3es", "d3e2"), ( jsonize_list(d3es), jsonize(d3e2) @@ -329,10 +329,10 @@ x0.node() of // | D3Etuple (knd1, npf2, d3es) => - jsonify("D3Etuple", ("knd1", "npf2", "d3es"), + jsonify("D3Etuple", ("knd1", "npf2", "d3es"), ( - jsonize(knd1), - jsonize(npf2), + jsonize(knd1), + jsonize(npf2), jsonize_list(d3es) ) ) @@ -348,19 +348,19 @@ x0.node() of arg3 of | None() => - jsonify("D2Edtsel", ("lab0", "dpis"), + jsonify("D2Edtsel", ("lab0", "dpis"), ( - jsonize(lab0), + jsonize(lab0), jsonize_list(dpis) ) ) | Some(d3es) => - jsonify("D2Edtsel", ("lab0", "dpis", "npf2", "d3es"), + jsonify("D2Edtsel", ("lab0", "dpis", "npf2", "d3es"), ( - jsonize(lab0), + jsonize(lab0), jsonize_list(dpis), - jsonize(npf2), + jsonize(npf2), jsonize_list(d3es) ) ) @@ -368,44 +368,44 @@ x0.node() of // | D3Eif0 (d3e1, d3e2, opt3) => - jsonify("D3Eif0", ("d3e1", "d3e2", "opt3"), + jsonify("D3Eif0", ("d3e1", "d3e2", "opt3"), ( - jsonize(d3e1), - jsonize(d3e2), + jsonize(d3e1), + jsonize(d3e2), jsonize_option(opt3) ) ) // | D3Ecase (knd0, d3e1, dcls) => - jsonify("D3Ecase", ("knd0", "d3e1", "dcls"), + jsonify("D3Ecase", ("knd0", "d3e1", "dcls"), ( - jsonize(knd0), - jsonize(d3e1), + jsonize(knd0), + jsonize(d3e1), jsonize_list(dcls) ) ) // | D3Elam (knd, f3as, tres, arrw, body) => - jsonify("D3Elam", ("knd", "f3as", "tres", "arrw", "body"), + jsonify("D3Elam", ("knd", "f3as", "tres", "arrw", "body"), ( - jsonize(knd), + jsonize(knd), jsonize_list(f3as), jsonize(tres), - jsonize(arrw), + jsonize(arrw), jsonize(body) ) ) | D3Efix (knd, fid, f3as, tres, arrw, body) => - jsonify("D3Efix", ("knd", "fid", "f3as", "tres", "arrw", "body"), + jsonify("D3Efix", ("knd", "fid", "f3as", "tres", "arrw", "body"), ( - jsonize(knd), - jsonize(fid), + jsonize(knd), + jsonize(fid), jsonize_list(f3as), jsonize(tres), - jsonize(arrw), + jsonize(arrw), jsonize(body) ) ) @@ -428,9 +428,9 @@ x0.node() of jsonify("D3Elazy", "d3e1", jsonize(d3e1)) ) | D3Ellazy(d3e1, opt2) => - jsonify("D3Ellazy", ("d3e1", "opt2"), + jsonify("D3Ellazy", ("d3e1", "opt2"), ( - jsonize(d3e1), + jsonize(d3e1), jsonize_option(opt2) ) ) @@ -466,7 +466,7 @@ implement jsonize_d3gua (x0) = node("d3gua", res) where -val res = +val res = ( case+ x0.node() of @@ -481,7 +481,7 @@ implement jsonize_d3clau (x0) = node("d3clau", res) where -val res = +val res = ( case+ x0.node() of @@ -499,7 +499,7 @@ implement jsonize_d3gpat (x0) = node("d3gpat", res) where -val res = +val res = ( case+ x0.node() of @@ -508,9 +508,9 @@ x0.node() of jsonify("D3GPATpat", "d3p", jsonize(d3p)) // | D3GPATgua(d3p, d3gs) => - jsonify("D3GPATgua", ("d3p", "d3gs"), + jsonify("D3GPATgua", ("d3p", "d3gs"), ( - jsonize(d3p), + jsonize(d3p), jsonize_list(d3gs) ) ) @@ -528,7 +528,7 @@ implement jsonize_ti3arg (x0) = node("ti3arg", res) where -val res = +val res = ( case+ x0 of | TI3ARGnone() => @@ -558,7 +558,7 @@ implement jsonize_d3ecl (x0) = node("d3ecl", res) where -val res = +val res = ( // case+ @@ -579,10 +579,10 @@ x0.node() of ( jsonify("D3Cinclude", ("tok", "src", "knd", "fopt", "body"), ( - jsonize(tok), - jsonize(src), - jsonize(knd), - jsonize_option(fopt), + jsonize(tok), + jsonize(src), + jsonize(knd), + jsonize_option(fopt), jsonize(body) ) ) @@ -596,9 +596,9 @@ x0.node() of } // | D3Clocal(head, body) => - jsonify("D3Clocal", ("head", "body"), + jsonify("D3Clocal", ("head", "body"), ( - jsonize_list(head), + jsonize_list(head), jsonize_list(body) ) ) @@ -635,7 +635,7 @@ x0.node() of // | D3Cimpdecl1 ( knd, mopt, sqas, tqas, id2c, ti3a, ti2s, f3as, res0, d3e0) => - jsonify("D3Cimpdecl1", + jsonify("D3Cimpdecl1", ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "f3as", "res0", "d3e0"), ( jsonize(knd), @@ -648,12 +648,12 @@ x0.node() of jsonize_list(f3as), jsonize(res0), jsonize(d3e0) - ) + ) ) | D3Cimpdecl2 ( knd, mopt, sqas, tqas, id2c, ti3a, ti2s, f3as, res0, d3e0) => - jsonify("D3Cimpdecl2", - ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "f3as", "res0", "d3e0"), + jsonify("D3Cimpdecl2", + ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "f3as", "res0", "d3e0"), ( jsonize(knd), jsonize(mopt), @@ -665,12 +665,12 @@ x0.node() of jsonize_list(f3as), jsonize(res0), jsonize(d3e0) - ) + ) ) | D3Cimpdecl3 ( knd, mopt, sqas, tqas, id2c, ti3a, ti2s, f3as, res0, d3e0) => - jsonify("D3Cimpdecl3", - ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "f3as", "res0", "d3e0"), + jsonify("D3Cimpdecl3", + ("knd", "mopt", "sqas", "tqas", "id2c", "ti3a", "ti2s", "f3as", "res0", "d3e0"), ( jsonize(knd), jsonize(mopt), @@ -682,7 +682,7 @@ x0.node() of jsonize_list(f3as), jsonize(res0), jsonize(d3e0) - ) + ) ) // | D3Cnone0() => @@ -699,7 +699,7 @@ implement jsonize_t2pcast (x0) = node("t2pcats", res) where -val res = +val res = ( case+ x0 of | T2PCASTnone() => @@ -717,11 +717,11 @@ val+V3ALDECL(rcd) = x0 // in node("v3aldecl", res) where -val res = - jsonify("V3ALDECL@{", ("pat", "def", "wtp"), +val res = + jsonify("V3ALDECL", ("pat", "def", "wtp"), ( - jsonize(rcd.pat), - jsonize_option(rcd.def), + jsonize(rcd.pat), + jsonize_option(rcd.def), jsonize_option(rcd.wtp) ) ) @@ -737,12 +737,12 @@ val+V3ARDECL(rcd) = x0 // in node("v3ardecl", res) where -val res = - jsonify("V3ARDECL", ("d2v", "wth", "res", "ini"), +val res = + jsonify("V3ARDECL", ("d2v", "wth", "res", "ini"), ( - jsonize(rcd.d2v), - jsonize_option(rcd.wth), - jsonize_option(rcd.res), + jsonize(rcd.d2v), + jsonize_option(rcd.wth), + jsonize_option(rcd.res), jsonize_option(rcd.ini) ) ) @@ -758,15 +758,15 @@ val+F3UNDECL(rcd) = x0 // in node("f3undecl", res) where -val res = - jsonify("F3UNDECL@{", ("nam", "d2c", "arg", "res", "def", "ctp", "wtp"), - ( - jsonize(rcd.nam), - jsonize(rcd.d2c), - jsonize_list(rcd.a2g), - jsonize(rcd.res), - jsonize_option(rcd.def), - jsonize(rcd.ctp), +val res = + jsonify("F3UNDECL", ("nam", "d2c", "arg", "res", "def", "ctp", "wtp"), + ( + jsonize(rcd.nam), + jsonize(rcd.d2c), + jsonize_list(rcd.a2g), + jsonize(rcd.res), + jsonize_option(rcd.def), + jsonize(rcd.ctp), jsonize_option(rcd.wtp) ) ) diff --git a/contrib/sparverius/xjsonize/DATS/interp0.dats b/contrib/sparverius/xjsonize/DATS/jsonize0.dats similarity index 95% rename from contrib/sparverius/xjsonize/DATS/interp0.dats rename to contrib/sparverius/xjsonize/DATS/jsonize0.dats index adf17c750..73be5feef 100644 --- a/contrib/sparverius/xjsonize/DATS/interp0.dats +++ b/contrib/sparverius/xjsonize/DATS/jsonize0.dats @@ -33,10 +33,6 @@ // (* ****** ****** *) // -// HX-2019-11-02: level-1 interpreter -// -(* ****** ****** *) -// %{^ // extern @@ -79,7 +75,6 @@ UN = "prelude/SATS/unsafe.sats" #staload "./../SATS/staexp2.sats" #staload "./../SATS/dynexp2.sats" #staload "./../SATS/dynexp3.sats" -#staload "./../SATS/intrep0.sats" (* #staload "./../SATS/trans01.sats" *) @@ -99,33 +94,15 @@ UN = "prelude/SATS/unsafe.sats" #staload _ = "./staexp2.dats" #staload _ = "./dynexp2.dats" #staload _ = "./dynexp3.dats" -#staload _ = "./intrep0.dats" #staload _ = "./json.dats" +#staload "./../SATS/jsonize0.sats" + + implement jsonize_val = jsonize_d0ecl implement jsonize_val = jsonize_d1ecl implement jsonize_val = jsonize_d2ecl - - -(* #dynload "./json.dats" *) -(* #dynload "./basics.dats" *) -(* #dynload "./stamp0.dats" *) -(* #dynload "./symbol.dats" *) -(* #dynload "./label0.dats" *) -(* #dynload "./locinfo.dats" *) -(* #dynload "./lexing_token.dats" *) -(* #dynload "./staexp0.dats" *) -(* #dynload "./dynexp0.dats" *) -(* #dynload "./staexp1.dats" *) -(* #dynload "./dynexp1.dats" *) -(* #dynload "./statyp2.dats" *) -(* #dynload "./staexp2.dats" *) -(* #dynload "./dynexp2.dats" *) -(* #dynload "./dynexp3.dats" *) -(* #dynload "./intrep0.dats" *) - -#staload "./../SATS/interp0.sats" // (* ****** ****** *) @@ -806,7 +783,7 @@ val () = println!("\n\n", "JSONIZED", "\n\n") val json = jsonize_list(d2cs) val () = fprint_jsonval(stdout_ref, json) val () = println!() -(* + (* val () = println! @@ -817,6 +794,15 @@ val () = t2xread_main(d2cs) // val d3cs = trans23_declist(d2cs) + + + +val () = println!("\n\n", "JSONIZED", "\n\n") +val json = jsonize_list(d3cs) +val () = fprint_jsonval(stdout_ref, json) +val () = println!() + + (* val () = println! @@ -833,6 +819,13 @@ val () = t3xread_main(d3cs) // val d3cs = trans3t_program(d3cs) + +val () = println!("\n\n", "JSONIZED", "\n\n") +val json = jsonize_list(d3cs) +val () = fprint_jsonval(stdout_ref, json) +val () = println!() + +(* (* val () = println! @@ -871,17 +864,6 @@ println! ("process_fpath: irdcls = ", irdcls) *) // -(* val () = *) -(* interp0_program(irdcls) *) - -(* val () = println!("process_fpath: jsonized d2varmap = ") *) -(* val xys = interp0_jsonize_d2varmap() *) -(* val () = fprint_jsonval(stdout_ref, xys) *) - -(* val () = fprint_newline(stdout_ref) *) - -(* val () = *) -(* interp0_fprint_d2varmap(stdout_ref) *) *) @@ -1291,7 +1273,7 @@ end // end of [process_cmdline2] in (* in-of-local *) implement -interp0_main0 +jsonize0_main0 (argc, argv) = let // val @@ -1347,4 +1329,4 @@ end // end of [local] (* ****** ****** *) -(* end of [xint_interp0.dats] *) +(* end of [jsonize0.dats] *) diff --git a/contrib/sparverius/xjsonize/DATS/label0.dats b/contrib/sparverius/xjsonize/DATS/label0.dats index a110c67c8..71c784c86 100644 --- a/contrib/sparverius/xjsonize/DATS/label0.dats +++ b/contrib/sparverius/xjsonize/DATS/label0.dats @@ -7,53 +7,21 @@ #staload _ = "./json.dats" #define XATS_targetloc "./../../../../srcgen/xats" -(* -#staload "{$XATS}/SATS/dynexp0.sats" -#staload "{$XATS}/SATS/staexp0.sats" -*) + #staload "{$XATS}/SATS/label0.sats" #staload "{$XATS}/DATS/label0.dats" -(* -#staload _ = "{$XATS}/DATS/label0.dats" -*) -(* -#staload "{$XATS}/SATS/dynexp1.sats" -#staload "{$XATS}/SATS/dynexp2.sats" -#staload "{$XATS}/SATS/dynexp3.sats" -*) - -#staload "{$XATS}/SATS/staexp2.sats" #staload "./../SATS/json.sats" #staload _ = "./json.dats" -#staload "./../SATS/dynexp0.sats" -#staload "./../SATS/staexp0.sats" -#staload "./../SATS/lexing.sats" -#staload "./../SATS/dynexp1.sats" -#staload "./../SATS/label0.sats" -#staload "./../SATS/dynexp2.sats" -#staload "./../SATS/dynexp3.sats" -#staload "./../SATS/statyp2.sats" - -#staload "./../SATS/staexp2.sats" -#staload "./../SATS/intrep0.sats" #staload "./../SATS/label0.sats" +#staload "./../SATS/symbol.sats" -#staload SYM_J = "./../SATS/symbol.sats" - -overload jsonize with $SYM_J.jsonize_symbol - -(* -case+ l0 of -| LABint(i0) => -| LABsym(s0) => -*) implement jsonize_label - (l0) = //labval2(jsonize("label"), rst) where - jsonval_labval1("label", rst) where + (l0) = +node("label", rst) where val rst = ( case+ label_get_int(l0) of diff --git a/contrib/sparverius/xjsonize/DATS/xjsonize.dats b/contrib/sparverius/xjsonize/DATS/xjsonize.dats index 0760f3827..42cd6312b 100644 --- a/contrib/sparverius/xjsonize/DATS/xjsonize.dats +++ b/contrib/sparverius/xjsonize/DATS/xjsonize.dats @@ -58,8 +58,7 @@ UN = "prelude/SATS/unsafe.sats" #staload "./../SATS/staexp2.sats" #staload "./../SATS/dynexp2.sats" #staload "./../SATS/dynexp3.sats" -#staload "./../SATS/intrep0.sats" -#staload "./../SATS/interp0.sats" +#staload "./../SATS/jsonize0.sats" (* #staload "./../SATS/trans01.sats" *) (* #staload _ = "./json.dats" *) @@ -78,7 +77,6 @@ UN = "prelude/SATS/unsafe.sats" (* #staload _ = "./staexp2.dats" *) (* #staload _ = "./dynexp2.dats" *) (* #staload _ = "./dynexp3.dats" *) -(* #staload _ = "./intrep0.dats" *) #ifdef _LIBXJSONIZE_ @@ -107,8 +105,7 @@ ATS_DYNLOADNAME "libxjsonize_dynloadall" #dynload "./staexp2.dats" #dynload "./dynexp2.dats" #dynload "./dynexp3.dats" -#dynload "./intrep0.dats" -#dynload "./interp0.dats" +#dynload "./jsonize0.dats" // (* ****** ****** *) // @@ -122,8 +119,8 @@ main0(argc, argv) = // if (argc >= 2) -then interp0_main0(argc, argv) -else prerrln! ("Hello from ATS3(xinterp)!") +then jsonize0_main0(argc, argv) +else prerrln! ("Hello from ATS3(xjsonize)!") // end of [if] ) (* end of [main] *) #endif // ifdef(_LIBXJSONIZE_) diff --git a/contrib/sparverius/xjsonize/HATS/libxatsopt.hats b/contrib/sparverius/xjsonize/HATS/libxatsopt.hats index 3d5ccbd61..7a838e200 100644 --- a/contrib/sparverius/xjsonize/HATS/libxatsopt.hats +++ b/contrib/sparverius/xjsonize/HATS/libxatsopt.hats @@ -72,9 +72,6 @@ FS0 = #staload "./../../../../srcgen/xats/SATS/trans3t.sats" // -#staload -"./../../../../srcgen/xats/SATS/intrep0.sats" -// (* ****** ****** *) // #staload S2E = @@ -84,16 +81,6 @@ FS0 = // (* ****** ****** *) // -#staload IR0 = -"./../../../../srcgen/xats/SATS/intrep0.sats" -// -(* ****** ****** *) -// -(* -#staload -_(*TMP*) = -"./../../../../srcgen/xats/DATS/json.dats" -*) #staload _(*TMP*) = "./../../../../srcgen/xats/DATS/staexp0_print.dats" @@ -126,12 +113,6 @@ _(*TMP*) = // #staload _(*TMP*) = -"./../../../../srcgen/xats/DATS/intrep0_print.dats" -// -(* ****** ****** *) -// -#staload -_(*TMP*) = "./../../../../srcgen/xats/DATS/trans12_envmap.dats" // (* ****** ****** *) diff --git a/contrib/sparverius/xjsonize/Makefile b/contrib/sparverius/xjsonize/Makefile index 89c541d49..a3f16e456 100644 --- a/contrib/sparverius/xjsonize/Makefile +++ b/contrib/sparverius/xjsonize/Makefile @@ -49,8 +49,7 @@ staexp2.sats \ dynexp2.sats \ dynexp3.sats \ fixity.sats \ -intrep0.sats \ -interp0.sats \ +jsonize0.sats \ SRCDATS := \ json.dats \ @@ -69,16 +68,7 @@ statyp2.dats \ staexp2.dats \ dynexp2.dats \ dynexp3.dats \ -intrep0.dats \ -interp0.dats \ - -# SRCSATS := \ -# interp0.sats -# SRCDATS := \ -# interp0.dats \ -# interp0_print.dats \ -# interp0_envmap.dats \ -# interp0_dynexp.dats \ +jsonize0.dats \ ###### diff --git a/contrib/sparverius/xjsonize/SATS/interp0.sats b/contrib/sparverius/xjsonize/SATS/interp0.sats deleted file mode 100644 index 64b471b37..000000000 --- a/contrib/sparverius/xjsonize/SATS/interp0.sats +++ /dev/null @@ -1,361 +0,0 @@ -(***********************************************************************) -(* *) -(* Applied Type System *) -(* *) -(***********************************************************************) - -(* -** ATS/Xanadu - Unleashing the Potential of Types! -** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. -** All rights reserved -** -** ATS is free software; you can redistribute it and/or modify it under -** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the -** Free Software Foundation; either version 3, or (at your option) any -** later version. -** -** ATS is distributed in the hope that it will be useful, but WITHOUT ANY -** WARRANTY; without even the implied warranty of MERCHANTABILITY or -** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -** for more details. -** -** You should have received a copy of the GNU General Public License -** along with ATS; see the file COPYING. If not, please write to the -** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA -** 02110-1301, USA. -*) - -(* ****** ****** *) -// -// Author: Hongwei Xi -// Start Time: November, 2019 -// Authoremail: gmhwxiATgmailDOTcom -// -(* ****** ****** *) -// -// HX-2019-11-02: level-1 interpreter -// -(* ****** ****** *) - -#define XATS_targetloc "./../../../../srcgen/xats" - -(* ****** ****** *) - -#staload -D2E = "{$XATS}/SATS/dynexp2.sats" - -(* ****** ****** *) - -typedef d2var = $D2E.d2var -typedef d2con = $D2E.d2con -typedef d2cst = $D2E.d2cst - -(* ****** ****** *) - -#staload -INT = "{$XATS}/SATS/intrep0.sats" - -(* ****** ****** *) - -typedef ir0pat = $INT.ir0pat -typedef ir0arg = $INT.ir0arg -typedef ir0exp = $INT.ir0exp -typedef ir0dcl = $INT.ir0dcl - -typedef ir0gua = $INT.ir0gua -typedef ir0gpat = $INT.ir0gpat -typedef ir0clau = $INT.ir0clau - -typedef ir0patlst = $INT.ir0patlst -typedef ir0arglst = $INT.ir0arglst -typedef ir0explst = $INT.ir0explst -typedef ir0expopt = $INT.ir0expopt -typedef ir0dclist = $INT.ir0dclist - -typedef ir0gualst = $INT.ir0gualst -typedef ir0claulst = $INT.ir0claulst - -typedef ir0valdecl = $INT.ir0valdecl -typedef ir0fundecl = $INT.ir0fundecl -typedef ir0valdeclist = $INT.ir0valdeclist -typedef ir0fundeclist = $INT.ir0fundeclist - -(* ****** ****** *) - -(* -abstype ir0env_tbox = ptr -typedef ir0env = ir0env_tbox - -fun jsonize_ir0env: jsonize_type(ir0env) -overload jsonize with jsonize_ir0env - -(* ****** ****** *) -// -datatype -ir0val = -// -| IR0Vnil of () -// -| IR0Vint of int -| IR0Vbtf of bool -| IR0Vchr of char -| IR0Vflt of double -| IR0Vstr of string -// -(* -| IR0Vvar of d2var -| IR0Vcon of d2con -| IR0Vcst of d2cst -*) -// -| IR0Vcon of - (d2con, ir0valist) -// -| IR0Vfun of ir0valfun -// -| IR0Vtuple of - (int(*knd*), ir0valist) -// -| IR0Vlam of - (ir0env, ir0arglst, ir0exp) -| IR0Vfix of - (ir0env, d2var, ir0arglst, ir0exp) -(* -| IR0Vfix2 of - (ir0env, d2var, ir0arglst, ir0exp, ir0exp) -*) -| IR0Vfixs of - (ir0env, d2var, ir0arglst, ir0exp, ir0explst) -// -| IR0Vnone0 of () | IR0Vnone1 of (ir0exp) -// -where -// -ir0valist = List0(ir0val) -and -ir0valopt = Option(ir0val) -and -ir0valfun = (ir0valist - ir0val) -// -(* ****** ****** *) -// -fun -print_ir0val: print_type(ir0val) -fun -prerr_ir0val: prerr_type(ir0val) -overload print with print_ir0val -overload prerr with prerr_ir0val -// -fun -fprint_ir0val: fprint_type(ir0val) -overload fprint with fprint_ir0val -// -fun -jsonize_ir0val: jsonize_type(ir0val) -overload jsonize with jsonize_ir0val -// -(* ****** ****** *) - -absvtype intpenv_vtbox = ptr -vtypedef intpenv = intpenv_vtbox - -(* ****** ****** *) -// -fun -ir0env_make_nil(): ir0env -// -fun -intpenv_make_nil(): intpenv -fun -intpenv_make_fun(ir0env): intpenv -// -(* ****** ****** *) -// -fun -intpenv_take_env(!intpenv): ir0env -// -(* ****** ****** *) -// -fun -intpenv_bind_fix(!intpenv, ir0val): void -fun -intpenv_bind_fixs(!intpenv, ir0val): void -// -(* ****** ****** *) -// -fun -intpenv_pop0_let1(!intpenv): void -fun -intpenv_push_let1(!intpenv): void -// -(* ****** ****** *) -// -fun -intpenv_free_nil(env: intpenv): void -fun -intpenv_free_fun(env: intpenv): void -// -(* ****** ****** *) - -fun -interp0_search_d2cst -(d2c: d2cst): Option_vt(ir0val) -fun -interp0_search_d2var -( env -: !intpenv -, d2v: d2var): Option_vt(ir0val) - -(* ****** ****** *) -// -fun -interp0_insert_d2cst -(d2c: d2cst, irv: ir0val): void -// -fun -interp0_insert_d2var -( env -: !intpenv -, d2v: d2var, irv: ir0val): void -// -(* ****** ****** *) -// -fun -interp0_irdcl -(env: !intpenv, irc: ir0dcl): void -fun -interp0_irdclist -(env: !intpenv, ircs: ir0dclist): void -// -fun -interp0_irexp -(env: !intpenv, ire: ir0exp): ir0val -fun -interp0_irexplst -(env: !intpenv, ires: ir0explst): ir0valist -fun -interp0_irexpopt -(env: !intpenv, opt0: ir0expopt): ir0valopt -// -(* ****** ****** *) -// -fun -interp0_fcall_lam -(irf0: ir0val, irvs: ir0valist): ir0val -fun -interp0_fcall_fix -(irf0: ir0val, irvs: ir0valist): ir0val -fun -interp0_fcall_fixs -(irf0: ir0val, irvs: ir0valist): ir0val -// -(* ****** ****** *) -// -fun -interp0_irpat_ck0 -(irp0: ir0pat, irv0: ir0val): bool -fun -interp0_irpatlst_ck0 -(irps: ir0patlst, irvs: ir0valist): bool -// -fun -interp0_irpat_ck1 -( env -: !intpenv -, irp0: ir0pat, irv0: ir0val): void -fun -interp0_irpatlst_ck1 -( env -: !intpenv -, irps: ir0patlst, irvs: ir0valist): void -// -(* ****** ****** *) -// -fun -interp0_irgpat_ck2 -( env -: !intpenv -, irgp: ir0gpat, irv0: ir0val): bool -// -fun -interp0_irgua_ck2 -(env: !intpenv, irg0: ir0gua): bool -fun -interp0_irgualst_ck2 -(env: !intpenv, irgs: ir0gualst): bool -// -(* ****** ****** *) -// -fun -interp0_irclau -( env -: !intpenv -, irv0: ir0val -, ircl: ir0clau): Option_vt(ir0val) -fun -interp0_irclaulst -( env -: !intpenv -, irv0: ir0val -, ircls: ir0claulst): Option_vt(ir0val) -// -(* ****** ****** *) - -fun -interp0_ir0valdecl -(env: !intpenv, irvd: ir0valdecl): void -fun -interp0_ir0valdeclist -(env: !intpenv, irvds: ir0valdeclist): void - -(* ****** ****** *) - -fun -interp0_ir0fundecl -(env: !intpenv, irfd: ir0fundecl): void -fun -interp0_ir0fundeclist -(env: !intpenv, irfds: ir0fundeclist): void - -(* ****** ****** *) -// -fun -interp0_ir0impdecl3 -(env: !intpenv, irdcl: ir0dcl(*impdecl3*)): void -// -(* ****** ****** *) - -// -fun -interp0_initize(): void -// -fun -interp0_initize_gint(): void -// -(* ****** ****** *) - -fun -interp0_program(xs: ir0dclist): void - -(* ****** ****** *) -// -fun -interp0_fprint_d2cstmap(FILEref): void -fun -interp0_fprint_d2varmap(FILEref): void -// -fun -interp0_jsonize_d2cstmap(): jsonval -fun -interp0_jsonize_d2varmap(): jsonval -*) -// -(* ****** ****** *) -// -fun -interp0_main0 -{n:int | n >= 1}(int(n), !argv(n)): void -// -(* ****** ****** *) - -(* end of [xint_interp0.sats] *) diff --git a/contrib/sparverius/xjsonize/SATS/intrep0.sats b/contrib/sparverius/xjsonize/SATS/intrep0.sats deleted file mode 100644 index 43b091387..000000000 --- a/contrib/sparverius/xjsonize/SATS/intrep0.sats +++ /dev/null @@ -1,44 +0,0 @@ -#define XATS_targetloc "./../../../../srcgen/xats" -#staload "{$XATS}/SATS/intrep0.sats" - -#staload "./json.sats" - -fun -jsonize_ir0pat : jsonize_type(ir0pat) -overload jsonize with jsonize_ir0pat - -fun -jsonize_ir0arg : jsonize_type(ir0arg) -overload jsonize with jsonize_ir0arg - -fun -jsonize_ir0exp : jsonize_type(ir0exp) -overload jsonize with jsonize_ir0exp - -fun -jsonize_ir0gua : jsonize_type(ir0gua) -overload jsonize with jsonize_ir0gua - -fun -jsonize_ir0clau : jsonize_type(ir0clau) -overload jsonize with jsonize_ir0clau - -fun -jsonize_ir0gpat : jsonize_type(ir0gpat) -overload jsonize with jsonize_ir0gpat - -fun -jsonize_ir0vardecl : jsonize_type(ir0vardecl) -overload jsonize with jsonize_ir0vardecl - -fun -jsonize_ir0valdecl : jsonize_type(ir0valdecl) -overload jsonize with jsonize_ir0valdecl - -fun -jsonize_ir0fundecl : jsonize_type(ir0fundecl) -overload jsonize with jsonize_ir0fundecl - -fun -jsonize_ir0dcl : jsonize_type(ir0dcl) -overload jsonize with jsonize_ir0dcl diff --git a/contrib/sparverius/xjsonize/SATS/jsonize0.sats b/contrib/sparverius/xjsonize/SATS/jsonize0.sats new file mode 100644 index 000000000..8d71df0eb --- /dev/null +++ b/contrib/sparverius/xjsonize/SATS/jsonize0.sats @@ -0,0 +1,46 @@ +(***********************************************************************) +(* *) +(* Applied Type System *) +(* *) +(***********************************************************************) + +(* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2018 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*) + +(* ****** ****** *) +// +// Author: Hongwei Xi +// Start Time: November, 2019 +// Authoremail: gmhwxiATgmailDOTcom +// +(* ****** ****** *) + +#define XATS_targetloc "./../../../../srcgen/xats" + +(* ****** ****** *) + +fun +jsonize0_main0 +{n:int | n >= 1}(int(n), !argv(n)): void +// +(* ****** ****** *) + +(* end of [xint_interp0.sats] *) From cd6ba996abc9ce326d7f4582e1d8233cd22f2bb5 Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 16 Dec 2019 01:09:51 -0500 Subject: [PATCH 16/16] show type --- contrib/sparverius/xjsonize/.depend | 2 +- contrib/sparverius/xjsonize/DATS/staexp2.dats | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/contrib/sparverius/xjsonize/.depend b/contrib/sparverius/xjsonize/.depend index 0da4e82e7..9aa4c6a0c 100644 --- a/contrib/sparverius/xjsonize/.depend +++ b/contrib/sparverius/xjsonize/.depend @@ -32,5 +32,5 @@ BUILD/statyp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/s BUILD/staexp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/basics.sats SATS/dynexp0.sats SATS/staexp0.sats SATS/label0.sats SATS/lexing.sats SATS/staexp1.sats SATS/staexp2.sats SATS/symbol.sats SATS/locinfo.sats SATS/stamp0.sats SATS/label0.sats BUILD/dynexp2_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/locinfo.sats SATS/label0.sats SATS/filpath.sats SATS/dynexp0.sats SATS/staexp0.sats SATS/dynexp1.sats SATS/dynexp2.sats SATS/staexp2.sats SATS/symbol.sats SATS/stamp0.sats BUILD/dynexp3_dats.o : HATS/libxatsopt.hats SATS/json.sats DATS/json.dats SATS/json.sats DATS/json.dats SATS/lexing.sats SATS/label0.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats -BUILD/jsonize0_dats.o : HATS/libxatsopt.hats SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats DATS/json.dats DATS/basics.dats DATS/label0.dats DATS/locinfo.dats DATS/lexing_token.dats DATS/stamp0.dats DATS/symbol.dats DATS/filpath.dats DATS/staexp0.dats DATS/dynexp0.dats DATS/staexp1.dats DATS/dynexp1.dats DATS/statyp2.dats DATS/staexp2.dats DATS/dynexp2.dats DATS/dynexp3.dats DATS/json.dats +BUILD/jsonize0_dats.o : HATS/libxatsopt.hats SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats DATS/json.dats DATS/basics.dats DATS/label0.dats DATS/locinfo.dats DATS/lexing_token.dats DATS/stamp0.dats DATS/symbol.dats DATS/filpath.dats DATS/staexp0.dats DATS/dynexp0.dats DATS/staexp1.dats DATS/dynexp1.dats DATS/statyp2.dats DATS/staexp2.dats DATS/dynexp2.dats DATS/dynexp3.dats DATS/json.dats SATS/jsonize0.sats BUILD/xjsonize_dats.o : SATS/json.sats SATS/basics.sats SATS/fixity.sats SATS/label0.sats SATS/locinfo.sats SATS/lexing.sats SATS/stamp0.sats SATS/symbol.sats SATS/filpath.sats SATS/staexp0.sats SATS/dynexp0.sats SATS/staexp1.sats SATS/dynexp1.sats SATS/statyp2.sats SATS/staexp2.sats SATS/dynexp2.sats SATS/dynexp3.sats SATS/jsonize0.sats diff --git a/contrib/sparverius/xjsonize/DATS/staexp2.dats b/contrib/sparverius/xjsonize/DATS/staexp2.dats index b27b25f66..5e56ef000 100644 --- a/contrib/sparverius/xjsonize/DATS/staexp2.dats +++ b/contrib/sparverius/xjsonize/DATS/staexp2.dats @@ -68,15 +68,16 @@ case+ s2t0 of | S2Tfun() => jsonify("S2Tfun") | S2Tfun(s2ts, s2t1) => - jsonify("S2fun", + jsonify("S2Tfun", ("s2ts", "s2t1"), ( jsonize_list(s2ts), jsonize(s2t1) ) ) + (* where val _ = $showtype(s2t1) end *) | S2Tapp(s2t1, s2ts) => - jsonify("S2app", + jsonify("S2Tapp", ("s2t1", "s2ts"), ( jsonize(s2t1), @@ -295,9 +296,10 @@ s2e0.node() of jsonify("S2Estr", "s0", jsonize(s0)) // | S2Ecst(s2c) => - jsonify("S2Ecst", "s2c", jsonize(s2c.sort())) // s2c + jsonify("S2Ecst", "s2c", jsonize(s2c)) //jsonize(s2c.sort())) // s2c + (* where val _ = $showtype(s2c) end *) | S2Evar(s2v) => - jsonify("S2Evar", "s2v", jsonize(s2v.sort())) + jsonify("S2Evar", "s2v", jsonize(s2v)) // | S2Extv(xtv) => let