JSONization of level-2 syntax

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text can
be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

In ATS, level-2 syntax is used after fixities (infix, prefix and postfix)
and bindings are resolved.

If you ever want to design/implement a language, then you can use this tool
to get going quickly.
This is especially so if you want to play with fancy types as the concrete
syntax of ATS allows
the programmer to readily add type-annotations. I myself intend to use the
tool for teaching PL
and compilers.

Also, this tool can be used for analyzing and documenting ATS code.

{
“s2cstmap”:
[{“s2cst_sym”: “g0int_t0ype”, “s2cst_srt”: {“S2RTfun”: [[{“S2RTbas”: [
“tkind”]}], {“S2RTbas”: [“t@ype”]}]}, “s2cst_stamp”: 200, “s2cst_supcls”:
[]}, {“s2cst_sym”: “int_kind”, “s2cst_srt”: {“S2RTbas”: [“tkind”]},
“s2cst_stamp”: 226, “s2cst_supcls”: []}, {“s2cst_sym”: “int”, “s2cst_srt”: {
“S2RTbas”: [“t@ype”]}, “s2cst_stamp”: 230, “s2cst_supcls”: []}, {“s2cst_sym”
: “atsvoid_t0ype”, “s2cst_srt”: {“S2RTbas”: [“t@ype”]}, “s2cst_stamp”: 421,
"s2cst_supcls
": []}]
,
“s2varmap”:
[]
,
“d2conmap”:
[]
,
“d2cstmap”:
[{“d2cst_sym”: “main_void_0”, “d2cst_type”: {“s2exp_srt”: {“S2RTbas”: [
“type”]}, “s2exp_node”: {“S2Efun”: [-1, [], {“s2exp_srt”: {“S2RTbas”: [
“t@ype”]}, “s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 421}]}}]}},
“d2cst_stamp”: 56}]
,
“d2varmap”:
[{“d2var_sym”: “acker”, “d2var_stamp”: 181}, {“d2var_sym”: “m”,
“d2var_stamp”: 182}, {“d2var_sym”: “n”, “d2var_stamp”: 183}]
,
“d2eclist”:
[{“d2ecl_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
108(line=8, offs=1) – 143(line=8, offs=36)”, “d2ecl_node”: {“D2Cstaload”:
[[], “/home/hwxi/research/Postiats/git/prelude/DATS/integer.dats”]}}, {
“d2ecl_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
166(line=12, offs=1) – 370(line=27, offs=4)”, “d2ecl_node”: {“D2Cfundecs”:
[“FK_fun”, {}, [{“f2undec_loc”: “/home/hwxi/research/Postiats/git/doc/EXA
MPLE/INTRO/acker1.dats: 170(line=12, offs=5) – 370(line=27, offs=4)”,
“f2undec_var”: {“d2var_stamp”: 181}, “f2undec_def”: {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
176(line=13, offs=1) – 370(line=27, offs=4)”, “d2exp_node”: {“D2Elam_dyn”:
[0, -1, [{“p2at_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
180(line=14, offs=3) – 186(line=14, offs=9)”, “p2at_node”: {“P2Tann”: [{
“p2at_loc”: “/h
ome/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 180(line=14,
offs=3) – 181(line=14, offs=4)”, “p2at_node”: {“P2Tvar”: [{“d2var_stamp”:
182}]}}, {“s2exp_srt”: {“S2RTbas”: [“t@ype”]}, “s2exp_node”: {“S2Eapp”: [{
“s2exp_srt”: {“S2RTfun”: [[{“S2RTbas”: [“tkind”]}], {“S2RTbas”: [“t@ype”
]}]}, “s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 200}]}}, [{“s2exp_srt”: {
“S2RTbas”: [“tkind”]}, “s2exp_node”: {“S2Eextkind”: [“atstype_int”
]}}]]}}]}}, {“p2at
_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
188(line=14, offs=11) – 194(line=14, offs=17)”, “p2at_node”: {“P2Tann”: [{
“p2at_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
188(line=14, offs=11) – 189(line=14, offs=12)”, “p2at_node”: {“P2Tvar”: [{
“d2var_stamp”: 183}]}}, {“s2exp_srt”: {“S2RTbas”: [“t@ype”]}, “s2exp_node”:
{“S2Eapp”: [{“s2exp_srt”: {“S2RTfun”: [[{“S2RTbas”: [“tkind”]}], {“S2RTbas”:
[
“t@ype”]}]}, “s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 200}]}}, [{
“s2exp_srt”: {“S2RTbas”: [“tkind”]}, “s2exp_node”: {“S2Eextkind”: [
“atstype_int”]}}]]}}]}}], {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
199(line=15, offs=5) – 370(line=27, offs=4)”, “d2exp_node”: {“D2Eann_seff”:
[{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
199(line=15, offs=5) – 370(line=27, offs=4)”, "d2exp_node
": {“D2Eann_type”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
205(line=15, offs=11) – 370(line=27, offs=4)”, “d2exp_node”: {“D2Elet”:
[[], {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
215(line=18, offs=1) – 346(line=25, offs=4)”, “d2exp_node”: {“D2Eifhead”:
[{}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
218(line=18, offs=4) – 224(line=18, o
ffs=10)”, “d2exp_node”: {“D2Eapplst”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
220(line=18, offs=6) – 222(line=18, offs=8)”, “d2exp_node”: {“D2Esym”: [{
“d2sym_sym”: “<=”}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
218(line=18, offs=4) – 224(line=18, offs=10)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
218(line=18, offs=4) –
219(line=18, offs=5)”, “d2exp_node”: {“D2Evar”: [{“d2var_stamp”: 182}]}}, {
“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
223(line=18, offs=9) – 224(line=18, offs=10)”, “d2exp_node”: {“D2Ei0nt”: [
“0”]}}]]}]]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
232(line=19, offs=8) – 235(line=19, offs=11)”, “d2exp_node”: {“D2Eapplst”:
[{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/E
XAMPLE/INTRO/acker1.dats: 233(line=19, offs=9) – 234(line=19, offs=10)”,
“d2exp_node”: {“D2Esym”: [{“d2sym_sym”: “+”}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
232(line=19, offs=8) – 235(line=19, offs=11)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
232(line=19, offs=8) – 233(line=19, offs=9)”, “d2exp_node”: {“D2Evar”: [{
“d2var_stamp”: 183}]}}, {“d2exp_loc”: “/h
ome/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 234(line=19,
offs=10) – 235(line=19, offs=11)”, “d2exp_node”: {“D2Ei0nt”: [“1”
]}}]]}]]}}, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
249(line=21, offs=5) – 323(line=23, offs=39)”, “d2exp_node”: {“D2Eifhead”:
[{}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
252(line=21, offs=8) – 258(line=21, offs=14)”, “d2exp_node”
: {“D2Eapplst”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
254(line=21, offs=10) – 256(line=21, offs=12)”, “d2exp_node”: {“D2Esym”: [{
“d2sym_sym”: “<=”}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
252(line=21, offs=8) – 258(line=21, offs=14)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
252(line=21, offs=8) – 253(line=21, offs=9
)”, “d2exp_node”: {“D2Evar”: [{“d2var_stamp”: 183}]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
257(line=21, offs=13) – 258(line=21, offs=14)”, “d2exp_node”: {“D2Ei0nt”: [
“0”]}}]]}]]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
270(line=22, offs=12) – 284(line=22, offs=26)”, “d2exp_node”: {“D2Eapplst”:
[{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker
1.dats: 270(line=22, offs=12) – 275(line=22, offs=17)”, “d2exp_node”: {
“D2Evar”: [{“d2var_stamp”: 181}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
276(line=22, offs=18) – 284(line=22, offs=26)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
277(line=22, offs=19) – 280(line=22, offs=22)”, “d2exp_node”: {“D2Eapplst”:
[{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc
/EXAMPLE/INTRO/acker1.dats: 278(line=22, offs=20) – 279(line=22, offs=21)”,
“d2exp_node”: {“D2Esym”: [{“d2sym_sym”: “-”}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
277(line=22, offs=19) – 280(line=22, offs=22)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
277(line=22, offs=19) – 278(line=22, offs=20)”, “d2exp_node”: {“D2Evar”: [{
“d2var_stamp”: 182}]}}, {“d2exp_loc
“: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
279(line=22, offs=21) – 280(line=22, offs=22)”, “d2exp_node”: {“D2Ei0nt”: [
“1”]}}]]}]]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
282(line=22, offs=24) – 283(line=22, offs=25)”, “d2exp_node”: {“D2Ei0nt”: [
“1”]}}]]}]]}}, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
296(line=23, offs=12) – 323(line=23, offs=3
9)”, “d2exp_node”: {“D2Eapplst”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
296(line=23, offs=12) – 301(line=23, offs=17)”, “d2exp_node”: {“D2Evar”: [{
“d2var_stamp”: 181}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
302(line=23, offs=18) – 323(line=23, offs=39)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
303(line=23, offs=19) –
306(line=23, offs=22)”, “d2exp_node”: {“D2Eapplst”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
304(line=23, offs=20) – 305(line=23, offs=21)”, “d2exp_node”: {“D2Esym”: [{
“d2sym_sym”: “-”}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
303(line=23, offs=19) – 306(line=23, offs=22)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
303(li
ne=23, offs=19) – 304(line=23, offs=20)”, “d2exp_node”: {“D2Evar”: [{
“d2var_stamp”: 182}]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
305(line=23, offs=21) – 306(line=23, offs=22)”, “d2exp_node”: {“D2Ei0nt”: [
“1”]}}]]}]]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
308(line=23, offs=24) – 322(line=23, offs=38)”, “d2exp_node”: {“D2Eapplst”:
[{“d2exp_loc”: “/home/hwxi/resear
ch/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 308(line=23, offs=24) –
313(line=23, offs=29)”, “d2exp_node”: {“D2Evar”: [{“d2var_stamp”: 181}]}},
[{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
314(line=23, offs=30) – 322(line=23, offs=38)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
315(line=23, offs=31) – 316(line=23, offs=32)”, “d2exp_node”: {“D2Evar”: [{
“d2var_stamp”:
182}]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
318(line=23, offs=34) – 321(line=23, offs=37)”, “d2exp_node”: {“D2Eapplst”:
[{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
319(line=23, offs=35) – 320(line=23, offs=36)”, “d2exp_node”: {“D2Esym”: [{
“d2sym_sym”: “-”}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
318(line=23, offs=34)
– 321(line=23, offs=37)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
318(line=23, offs=34) – 319(line=23, offs=35)”, “d2exp_node”: {“D2Evar”: [{
“d2var_stamp”: 183}]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
320(line=23, offs=36) – 321(line=23, offs=37)”, “d2exp_node”: {“D2Ei0nt”: [
“1”]}}]]}]]}}]]}]]}}]]}]]}}]]}}]]}}]}}, {“s2exp_srt”: {“S2RTbas”: [“t@ype”
]}, “s2exp_node”:
{“S2Eapp”: [{“s2exp_srt”: {“S2RTfun”: [[{“S2RTbas”: [“tkind”]}], {“S2RTbas”
: [“t@ype”]}]}, “s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 200}]}}, [{
“s2exp_srt”: {“S2RTbas”: [“tkind”]}, “s2exp_node”: {“S2Eextkind”: [
“atstype_int”]}}]]}}]}}, {}]}}]}}, “f2undec_ann”: []}]]}}, {“d2ecl_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
411(line=31, offs=1) – 500(line=38, offs=4)”, “d2ecl_node”: {“D2Cimpdec”: [
0, {“i2mpdec_loc”: “/home/h
wxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 421(line=32,
offs=1) – 500(line=38, offs=4)”, “i2mpdec_locid”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
421(line=32, offs=1) – 426(line=32, offs=6)”, “i2mpdec_cst”: {“d2cst_stamp”
: 56}, “i2mpdec_imparg”: {}, “i2mpdec_tmparg”: {}, “i2mpdec_tmpgua”: {},
“i2mpdec_def”: {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
427(line=32, offs=7) –
500(line=38, offs=4)”, “d2exp_node”: {“D2Elam_dyn”: [0, -1, [], {“d2exp_loc”
: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
432(line=32, offs=12) – 500(line=38, offs=4)”, “d2exp_node”: {
“D2Eann_funclo”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
432(line=32, offs=12) – 500(line=38, offs=4)”, “d2exp_node”: {“D2Eann_seff”
: [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker
1.dats: 432(line=32, offs=12) – 500(line=38, offs=4)”, “d2exp_node”: {
“D2Eann_type”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
432(line=32, offs=12) – 500(line=38, offs=4)”, “d2exp_node”: {“D2Elet”: [[{
“d2ecl_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
439(line=34, offs=1) – 477(line=34, offs=39)”, “d2ecl_node”: {“D2Cvaldecs”:
[“VK_val”, [{“v2aldec_loc”: “/home/hwxi/research/Postiat
s/git/doc/EXAMPLE/INTRO/acker1.dats: 443(line=34, offs=5) – 477(line=34,
offs=39)”, “v2aldec_pat”: {“p2at_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
443(line=34, offs=5) – 445(line=34, offs=7)”, “p2at_node”: {“P2Tempty”:
[]}}, “v2aldec_def”: {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
448(line=34, offs=10) – 476(line=34, offs=38)”, “d2exp_node”: {“D2Eapplst”:
[{“d2exp_loc”: “/home/hwx
i/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 448(line=34,
offs=10) – 457(line=34, offs=19)”, “d2exp_node”: {“D2Eignored”: []}}, [{
“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
459(line=34, offs=21) – 476(line=34, offs=38)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
459(line=34, offs=21) – 476(line=34, offs=38)”, “d2exp_node”: {“D2Eapplst”:
[{“d2exp_loc”: “/home
/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 472(line=34,
offs=34) – 473(line=34, offs=35)”, “d2exp_node”: {“D2Esym”: [{“d2sym_sym”:
“=”}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
459(line=34, offs=21) – 476(line=34, offs=38)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
459(line=34, offs=21) – 471(line=34, offs=33)”, “d2exp_node”: {“D2Eapplst”:
[{”
d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
459(line=34, offs=21) – 464(line=34, offs=26)”, “d2exp_node”: {“D2Evar”: [{
“d2var_stamp”: 181}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
465(line=34, offs=27) – 471(line=34, offs=33)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
466(line=34, offs=28) – 467(line=34, offs=29)”, "d2exp_node
": {“D2Ei0nt”: [“3”]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
469(line=34, offs=31) – 470(line=34, offs=32)”, “d2exp_node”: {“D2Ei0nt”: [
“3”]}}]]}]]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
474(line=34, offs=36) – 476(line=34, offs=38)”, “d2exp_node”: {“D2Ei0nt”: [
“61”]}}]]}]]}}]]}]]}}, “v2aldec_ann”: {}}]]}}], {“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAM
PLE/INTRO/acker1.dats: 481(line=36, offs=1) – 500(line=38, offs=4)”,
“d2exp_node”: {“D2Eempty”: []}}]}}, {“s2exp_srt”: {“S2RTbas”: [“t@ype”]},
“s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 421}]}}]}}, {}]}}, {“funclo_name”:
“FUNCLOfun”, “funclo_arglst”: []}]}}]}}}]}}]
}

Yes.

ATS compiler consists of the following translations:

Trans1: level-0 to level-1: resolving fixity issues
Trans2: level-1 to level-2: handling binding issues
Trans3: level-2 to level-3: typechecking
Trans4: level-3 to level-4: erasing type indices and proofs; preparing for
emitting C codeOn Thursday, February 19, 2015 at 2:47:14 AM UTC-5, Yannick Duchêne wrote:

Le samedi 13 décembre 2014 05:12:15 UTC+1, gmhwxi a écrit :

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

What means the number “2” near to everywhere, like in “p2at_node” instead
of “pat_node”? Is this to remind the syntax level?

Just out of curiosity, why JSON instead of simple XML 1.0?

JSON is more compact. Converting from JSON to XML should be straightforward.

What is “binding” in this context? Some kind of name resolution?

Yes. Namespace handling is included.

Dealing with namespaces is non-trivial in language design and
implementation.
Often, this issue is ignored at the start. See how languages like PHP and
Perl evolve.

Does it mean one can generate ATS source from a constructed JSON
representation?

The “raw” source is referred to as level-0 syntax, which translates into
level-1 syntax after
the fixity issue is dealt with. Often it is not a good idea to handle
fixity using the kind of technique
in the implementation of a simple calculator.

From level-2 syntax, one cannot not recover level-0 syntax. However, you
can implement
pretty-printing on level-2 syntax so as to get “prettified” source :)On Wednesday, December 17, 2014 3:37:52 PM UTC-5, Yannick Duchêne wrote:

Le samedi 13 décembre 2014 05:12:15 UTC+1, gmhwxi a écrit :

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

Just out of curiosity, why JSON instead of simple XML 1.0?

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text can
be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/MEDIUM/UTFPL0

In ATS, level-2 syntax is used after fixities (infix, prefix and postfix)
and bindings are resolved.

What is “binding” in this context? Some kind of name resolution?

If you ever want to design/implement a language, then you can use this
tool to get going quickly.
This is especially so if you want to play with fancy types as the
concrete syntax of ATS allows
the programmer to readily add type-annotations. I myself intend to use
the tool for teaching PL
and compilers.

Does it mean one can generate ATS source from a constructed JSON
representation?

I took a look at the issue.

It seems that the cause is due to List0 being expanded.

Whether a type definition should or should not be expanded depends on what
the the application wants to do. So my fix is to simply output syntax for
unexpanded
types. Changes have been uploaded.On Wednesday, February 11, 2015 at 2:34:09 PM UTC-5, William Blair wrote:

I was working with the --jsonize-2 format when I ran into some unexpected
behaviour. I wanted to export the following datatype to JSON with the goal
of automatically generating a parser for it.

abst@ype prop

datatype constraint =
    | ConstraintProp of (prop)
    | ConstraintConj of (List0(constraint))
    | ConstraintDisj of (List0(constraint))

But when I run patsopt with “–jsonize-2”, some of the information is
missing. For instance, there are several s2vars referenced in the
“d2eclist” in the constructors, but there are no entries in s2varmap. It
looks like a couple of s2csts are missing in s2cstmap as well. For
instance, the s2cst_stamp “45” is referenced two times in s2cstmap, but 45
does not have an entry in the map.

You can see the formatted JSON output here:

{ "s2cstmap": [ { "s2cst_sym": "prop", "s2cst_srt": { - Pastebin.com

Is this the expected output for level-2 syntax?

Thanks,
Will

Am Mittwoch, 11. Februar 2015 12:42:41 UTC-5 schrieb gmhwxi:

Yes, the command-line should be:

patsopt --jsonize-2 -d ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid.

I have fixed this one. Changes are in ATS2-0.1.9 pre-release.

On Wed, Feb 11, 2015 at 10:58 AM, ‘Yannick Duchêne’ via ats-lang-users < ats-l...@googlegroups.com> wrote:

Le samedi 13 décembre 2014 05:12:15 UTC+1, gmhwxi a écrit :

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text
can be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

For me, a -d option has to be added before the file name, otherwise I
get an error about an unrecognised option, ex:

 waring(ATS): unrecognized command line argument [test.dats] is 

ignored.

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid. Ex:

…  "Hello\n" …

is turned into this:

 … "Hello
 " …


You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/55b9c3d5-e83e-4980-abb3-c376efe3bdca%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/55b9c3d5-e83e-4980-abb3-c376efe3bdca%40googlegroups.com?utm_medium=email&utm_source=footer
.

I was working with the --jsonize-2 format when I ran into some unexpected
behaviour. I wanted to export the following datatype to JSON with the goal
of automatically generating a parser for it.

abst@ype prop

datatype constraint =
    | ConstraintProp of (prop)
    | ConstraintConj of (List0(constraint))
    | ConstraintDisj of (List0(constraint))

But when I run patsopt with “–jsonize-2”, some of the information is
missing. For instance, there are several s2vars referenced in the
“d2eclist” in the constructors, but there are no entries in s2varmap. It
looks like a couple of s2csts are missing in s2cstmap as well. For
instance, the s2cst_stamp “45” is referenced two times in s2cstmap, but 45
does not have an entry in the map.

You can see the formatted JSON output here:

Is this the expected output for level-2 syntax?

Thanks,
WillAm Mittwoch, 11. Februar 2015 12:42:41 UTC-5 schrieb gmhwxi:

Yes, the command-line should be:

patsopt --jsonize-2 -d ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid.

I have fixed this one. Changes are in ATS2-0.1.9 pre-release.

On Wed, Feb 11, 2015 at 10:58 AM, ‘Yannick Duchêne’ via ats-lang-users < ats-l...@googlegroups.com <javascript:>> wrote:

Le samedi 13 décembre 2014 05:12:15 UTC+1, gmhwxi a écrit :

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text
can be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

For me, a -d option has to be added before the file name, otherwise I
get an error about an unrecognised option, ex:

 waring(ATS): unrecognized command line argument [test.dats] is 

ignored.

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid. Ex:

…  "Hello\n" …

is turned into this:

 … "Hello
 " …


You received this message because you are subscribed to the Google Groups
“ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ats-lang...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/55b9c3d5-e83e-4980-abb3-c376efe3bdca%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/55b9c3d5-e83e-4980-abb3-c376efe3bdca%40googlegroups.com?utm_medium=email&utm_source=footer
.

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

What means the number “2” near to everywhere, like in “p2at_node” instead
of “pat_node”? Is this to remind the syntax level?

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text can
be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/MEDIUM/UTFPL0

In ATS, level-2 syntax is used after fixities (infix, prefix and postfix)
and bindings are resolved.

If you ever want to design/implement a language, then you can use this
tool to get going quickly.
This is especially so if you want to play with fancy types as the concrete
syntax of ATS allows
the programmer to readily add type-annotations. I myself intend to use the
tool for teaching PL
and compilers.

Thanks for making this possible! Last time I tried to JSONize some simple
ATS2 code I was baffled by the output. I decided to wait until you make
some documentation or code available for learning how to deal with JSONized
ATS syntax trees.

I have not waited so long for these ones, but their seems to hang patsopt --jsonize-2 too:

 lib/ats2-postiats-0.1.9/prelude/SATS/array.sats
 lib/ats2-postiats-0.1.9/prelude/SATS/matrix.sats
 lib/ats2-postiats-0.1.9/prelude/SATS/string.sats
 lib/ats2-postiats-0.1.9/prelude/DATS/filebas.dats
 lib/ats2-postiats-0.1.9/prelude/DATS/strptr.dats
 lib/ats2-postiats-0.1.9/prelude/DATS/string.dats

As said in the prior message, I don’t assert it’s an infinite recursion, I
just wonder if it is.Le mardi 17 février 2015 21:41:53 UTC+1, Yannick Duchêne a écrit :

Le samedi 13 décembre 2014 05:12:15 UTC+1, gmhwxi a écrit :

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

I can’t tell if it’s a bug or not, so I’m reporting this in case it really
is one.

I can’t generate JSON data for
lib/ats2-postiats-0.1.9/prelude/SATS/array.sats. I wondered if it would
terminate or not: patsopt was running since an hour at full CPU speed,
1.83 GHz, when I stopped it. Memory usage was 21MB (stable, the same during
the whole hour), so that was not an issue with memory.

I stopped it because I had no way to know if it was trapped in an infinite
recursion.

Was it?

Using Postiat 0.1.8, investigating the JSON data for basics_dyn.sats,
for the declaration at line 46:

 sortdef t0p = t@ype and vt0p = vt@ype

I find a d2eclist/2/d2ecl_node/D2Cnone, which is empty. Is this on
purpose or is this a issue related to the one solved for Postiat 0.1.9?

In level-2 syntax, all static definitions have been stored in a map. It
would be a bit involved to output this map in JSON format.

A different case, at line 190, is this declaration:

 overload ~ with lazy_vt_free

For this one I get a d2eclist/39/d2ecl_node/D2Cignored, which is more
explicit, and looks to be as it is on purpose. Is there a way to not ignore
this and get a populated node instead?

I will handle this shortly.

I took a look at the issue.

You are welcome.

As I said, parsing level-2 JSONized syntax is entirely straightforward. You
should have no
problem following the code in the following directory:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/MEDIUM/UTFPL0/parsing

If someone is familiar with pretty-printing (e.g., Ocaml has good packages
for doing it), it would
be really nice to build a tool for pretty-printing ATS source code based on
the level-2 JSONized syntax.

Cheers!On Fri, Dec 12, 2014 at 11:45 PM, Artyom Shalkhakov < artyom.s...@gmail.com> wrote:

On Saturday, December 13, 2014 10:12:15 AM UTC+6, gmhwxi wrote:

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text can
be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

https://github.com/githwxi/ATS-Postiats-contrib/tree/
master/projects/MEDIUM/UTFPL0

In ATS, level-2 syntax is used after fixities (infix, prefix and postfix)
and bindings are resolved.

If you ever want to design/implement a language, then you can use this
tool to get going quickly.
This is especially so if you want to play with fancy types as the
concrete syntax of ATS allows
the programmer to readily add type-annotations. I myself intend to use
the tool for teaching PL
and compilers.

Thanks for making this possible! Last time I tried to JSONize some simple
ATS2 code I was baffled by the output. I decided to wait until you make
some documentation or code available for learning how to deal with JSONized
ATS syntax trees.

Also, this tool can be used for analyzing and documenting ATS code.

{
“s2cstmap”:
[{“s2cst_sym”: “g0int_t0ype”, “s2cst_srt”: {“S2RTfun”: [[{“S2RTbas”: [
“tkind”]}], {“S2RTbas”: [“t@ype”]}]}, “s2cst_stamp”: 200, “s2cst_supcls”:
}, {“s2cst_sym”: “int_kind”, “s2cst_srt”: {“S2RTbas”: [“tkind”]},
“s2cst_stamp”: 226, “s2cst_supcls”: }, {“s2cst_sym”: “int”, “s2cst_srt”
: {“S2RTbas”: [“t@ype”]}, “s2cst_stamp”: 230, “s2cst_supcls”: }, {
“s2cst_sym”: “atsvoid_t0ype”, “s2cst_srt”: {“S2RTbas”: [“t@ype”]},
“s2cst_stamp”: 421, "s2cst_supcls
": }]
,
“s2varmap”:

,
“d2conmap”:

,
“d2cstmap”:
[{“d2cst_sym”: “main_void_0”, “d2cst_type”: {“s2exp_srt”: {“S2RTbas”: [
“type”]}, “s2exp_node”: {“S2Efun”: [-1, , {“s2exp_srt”: {“S2RTbas”: [
“t@ype”]}, “s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 421}]}}]}},
“d2cst_stamp”: 56}]
,
“d2varmap”:
[{“d2var_sym”: “acker”, “d2var_stamp”: 181}, {“d2var_sym”: “m”,
“d2var_stamp”: 182}, {“d2var_sym”: “n”, “d2var_stamp”: 183}]
,
“d2eclist”:
[{“d2ecl_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 108(line=8, offs=1) – 143(line=8,
offs=36)”, “d2ecl_node”: {“D2Cstaload”: [,
“/home/hwxi/research/Postiats/git/prelude/DATS/integer.dats”]}}, {
“d2ecl_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
166(line=12, offs=1) – 370(line=27, offs=4)”, “d2ecl_node”: {
“D2Cfundecs”: [“FK_fun”, {}, [{“f2undec_loc”:
“/home/hwxi/research/Postiats/git/doc/EXA
MPLE/INTRO/acker1.dats: 170(line=12, offs=5) – 370(line=27, offs=4)”,
“f2undec_var”: {“d2var_stamp”: 181}, “f2undec_def”: {“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
176(line=13, offs=1) – 370(line=27, offs=4)”, “d2exp_node”: {
“D2Elam_dyn”: [0, -1, [{“p2at_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 180(line=14, offs=3) – 186(line=14,
offs=9)”, “p2at_node”: {“P2Tann”: [{“p2at_loc”: “/h
ome/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
180(line=14, offs=3) – 181(line=14, offs=4)”, “p2at_node”: {“P2Tvar”: [{
“d2var_stamp”: 182}]}}, {“s2exp_srt”: {“S2RTbas”: [“t@ype”]},
“s2exp_node”: {“S2Eapp”: [{“s2exp_srt”: {“S2RTfun”: [[{“S2RTbas”: [
“tkind”]}], {“S2RTbas”: [“t@ype”]}]}, “s2exp_node”: {“S2Ecst”: [{
“s2cst_stamp”: 200}]}}, [{“s2exp_srt”: {“S2RTbas”: [“tkind”]},
“s2exp_node”: {“S2Eextkind”: [“atstype_int”]}}]]}}]}}, {“p2at
_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
188(line=14, offs=11) – 194(line=14, offs=17)”, “p2at_node”: {“P2Tann”:
[{“p2at_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
188(line=14, offs=11) – 189(line=14, offs=12)”, “p2at_node”: {“P2Tvar”:
[{“d2var_stamp”: 183}]}}, {“s2exp_srt”: {“S2RTbas”: [“t@ype”]},
“s2exp_node”: {“S2Eapp”: [{“s2exp_srt”: {“S2RTfun”: [[{“S2RTbas”: [
“tkind”]}], {“S2RTbas”: [
“t@ype”]}]}, “s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 200}]}}, [{
“s2exp_srt”: {“S2RTbas”: [“tkind”]}, “s2exp_node”: {“S2Eextkind”: [
“atstype_int”]}}]]}}]}}], {“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 199(line=15, offs=5) – 370(line=27,
offs=4)”, “d2exp_node”: {“D2Eann_seff”: [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
199(line=15, offs=5) – 370(line=27, offs=4)”, "d2exp_node
": {“D2Eann_type”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 205(line=15, offs=11) – 370(line=27,
offs=4)”, “d2exp_node”: {“D2Elet”: [, {“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
215(line=18, offs=1) – 346(line=25, offs=4)”, “d2exp_node”: {“D2Eifhead”
: [{}, {“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 218(line=18, offs=4) – 224(line=18,
o
ffs=10)”, “d2exp_node”: {“D2Eapplst”: [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
220(line=18, offs=6) – 222(line=18, offs=8)”, “d2exp_node”: {“D2Esym”:
[{“d2sym_sym”: “<=”}]}}, [{“D2EXPARGdyn”: [-1,
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
218(line=18, offs=4) – 224(line=18, offs=10)”, [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
218(line=18, offs=4) –
219(line=18, offs=5)”, “d2exp_node”: {“D2Evar”: [{“d2var_stamp”: 182
}]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 223(line=18, offs=9) – 224(line=18,
offs=10)”, “d2exp_node”: {“D2Ei0nt”: [“0”]}}]]}]]}}, {“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
232(line=19, offs=8) – 235(line=19, offs=11)”, “d2exp_node”: {
“D2Eapplst”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/E
XAMPLE/INTRO/acker1.dats: 233(line=19, offs=9) – 234(line=19, offs=10)”,
“d2exp_node”: {“D2Esym”: [{“d2sym_sym”: “+”}]}}, [{“D2EXPARGdyn”: [-1,
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
232(line=19, offs=8) – 235(line=19, offs=11)”, [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
232(line=19, offs=8) – 233(line=19, offs=9)”, “d2exp_node”: {“D2Evar”:
[{“d2var_stamp”: 183}]}}, {“d2exp_loc”: “/h
ome/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
234(line=19, offs=10) – 235(line=19, offs=11)”, “d2exp_node”: {“D2Ei0nt”
: [“1”]}}]]}]]}}, [{“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 249(line=21, offs=5) – 323(line=23,
offs=39)”, “d2exp_node”: {“D2Eifhead”: [{}, {“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
252(line=21, offs=8) – 258(line=21, offs=14)”, “d2exp_node”
: {“D2Eapplst”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 254(line=21, offs=10) – 256(line=21,
offs=12)”, “d2exp_node”: {“D2Esym”: [{“d2sym_sym”: “<=”}]}}, [{
“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 252(line=21, offs=8) – 258(line=21,
offs=14)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 252(line=21, offs=8) – 253(line=21,
offs=9
)”, “d2exp_node”: {“D2Evar”: [{“d2var_stamp”: 183}]}}, {“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
257(line=21, offs=13) – 258(line=21, offs=14)”, “d2exp_node”: {“D2Ei0nt”
: [“0”]}}]]}]]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 270(line=22, offs=12) – 284(line=22,
offs=26)”, “d2exp_node”: {“D2Eapplst”: [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker
1.dats: 270(line=22, offs=12) – 275(line=22, offs=17)”, “d2exp_node”: {
“D2Evar”: [{“d2var_stamp”: 181}]}}, [{“D2EXPARGdyn”: [-1,
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
276(line=22, offs=18) – 284(line=22, offs=26)”, [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
277(line=22, offs=19) – 280(line=22, offs=22)”, “d2exp_node”: {
“D2Eapplst”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc
/EXAMPLE/INTRO/acker1.dats: 278(line=22, offs=20) – 279(line=22,
offs=21)”, “d2exp_node”: {“D2Esym”: [{“d2sym_sym”: “-”}]}}, [{
“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 277(line=22, offs=19) – 280(line=22,
offs=22)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 277(line=22, offs=19) – 278(line=22,
offs=20)”, “d2exp_node”: {“D2Evar”: [{“d2var_stamp”: 182}]}}, {
“d2exp_loc
“: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
279(line=22, offs=21) – 280(line=22, offs=22)”, “d2exp_node”: {“D2Ei0nt”
: [“1”]}}]]}]]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 282(line=22, offs=24) – 283(line=22,
offs=25)”, “d2exp_node”: {“D2Ei0nt”: [“1”]}}]]}]]}}, [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
296(line=23, offs=12) – 323(line=23, offs=3
9)”, “d2exp_node”: {“D2Eapplst”: [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
296(line=23, offs=12) – 301(line=23, offs=17)”, “d2exp_node”: {“D2Evar”:
[{“d2var_stamp”: 181}]}}, [{“D2EXPARGdyn”: [-1,
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
302(line=23, offs=18) – 323(line=23, offs=39)”, [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
303(line=23, offs=19) –
306(line=23, offs=22)”, “d2exp_node”: {“D2Eapplst”: [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
304(line=23, offs=20) – 305(line=23, offs=21)”, “d2exp_node”: {“D2Esym”:
[{“d2sym_sym”: “-”}]}}, [{“D2EXPARGdyn”: [-1,
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
303(line=23, offs=19) – 306(line=23, offs=22)”, [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 303(li
ne=23, offs=19) – 304(line=23, offs=20)”, “d2exp_node”: {“D2Evar”: [{
“d2var_stamp”: 182}]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 305(line=23, offs=21) – 306(line=23,
offs=22)”, “d2exp_node”: {“D2Ei0nt”: [“1”]}}]]}]]}}, {“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
308(line=23, offs=24) – 322(line=23, offs=38)”, “d2exp_node”: {
“D2Eapplst”: [{“d2exp_loc”: “/home/hwxi/resear
ch/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 308(line=23, offs=24) –
313(line=23, offs=29)”, “d2exp_node”: {“D2Evar”: [{“d2var_stamp”: 181
}]}}, [{“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 314(line=23, offs=30) – 322(line=23,
offs=38)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 315(line=23, offs=31) – 316(line=23,
offs=32)”, “d2exp_node”: {“D2Evar”: [{“d2var_stamp”:
182}]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 318(line=23, offs=34) – 321(line=23,
offs=37)”, “d2exp_node”: {“D2Eapplst”: [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
319(line=23, offs=35) – 320(line=23, offs=36)”, “d2exp_node”: {“D2Esym”:
[{“d2sym_sym”: “-”}]}}, [{“D2EXPARGdyn”: [-1,
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
318(line=23, offs=34)
– 321(line=23, offs=37)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 318(line=23, offs=34) – 319(line=23,
offs=35)”, “d2exp_node”: {“D2Evar”: [{“d2var_stamp”: 183}]}}, {
“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
320(line=23, offs=36) – 321(line=23, offs=37)”, “d2exp_node”: {“D2Ei0nt”
: [“1”]}}]]}]]}}]]}]]}}]]}]]}}]]}}]]}}]}}, {“s2exp_srt”: {“S2RTbas”: [
“t@ype”]}, “s2exp_node”:
{“S2Eapp”: [{“s2exp_srt”: {“S2RTfun”: [[{“S2RTbas”: [“tkind”]}], {
“S2RTbas”: [“t@ype”]}]}, “s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 200
}]}}, [{“s2exp_srt”: {“S2RTbas”: [“tkind”]}, “s2exp_node”: {“S2Eextkind”:
[“atstype_int”]}}]]}}]}}, {}]}}]}}, “f2undec_ann”: }]]}}, {“d2ecl_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
411(line=31, offs=1) – 500(line=38, offs=4)”, “d2ecl_node”: {“D2Cimpdec”
: [0, {“i2mpdec_loc”: “/home/h
wxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 421(line=32,
offs=1) – 500(line=38, offs=4)”, “i2mpdec_locid”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
421(line=32, offs=1) – 426(line=32, offs=6)”, “i2mpdec_cst”: {
“d2cst_stamp”: 56}, “i2mpdec_imparg”: {}, “i2mpdec_tmparg”: {},
“i2mpdec_tmpgua”: {}, “i2mpdec_def”: {“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
427(line=32, offs=7) –
500(line=38, offs=4)”, “d2exp_node”: {“D2Elam_dyn”: [0, -1, , {
“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
432(line=32, offs=12) – 500(line=38, offs=4)”, “d2exp_node”: {
“D2Eann_funclo”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 432(line=32, offs=12) – 500(line=38,
offs=4)”, “d2exp_node”: {“D2Eann_seff”: [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker
1.dats: 432(line=32, offs=12) – 500(line=38, offs=4)”, “d2exp_node”: {
“D2Eann_type”: [{“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 432(line=32, offs=12) – 500(line=38,
offs=4)”, “d2exp_node”: {“D2Elet”: [[{“d2ecl_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
439(line=34, offs=1) – 477(line=34, offs=39)”, “d2ecl_node”: {
“D2Cvaldecs”: [“VK_val”, [{“v2aldec_loc”: “/home/hwxi/research/Postiat
s/git/doc/EXAMPLE/INTRO/acker1.dats: 443(line=34, offs=5) –
477(line=34, offs=39)”, “v2aldec_pat”: {“p2at_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
443(line=34, offs=5) – 445(line=34, offs=7)”, “p2at_node”: {“P2Tempty”:
}}, “v2aldec_def”: {“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 448(line=34, offs=10) – 476(line=34,
offs=38)”, “d2exp_node”: {“D2Eapplst”: [{“d2exp_loc”: “/home/hwx
i/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 448(line=34,
offs=10) – 457(line=34, offs=19)”, “d2exp_node”: {“D2Eignored”: }}, [{
“D2EXPARGdyn”: [-1, “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 459(line=34, offs=21) – 476(line=34,
offs=38)”, [{“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 459(line=34, offs=21) – 476(line=34,
offs=38)”, “d2exp_node”: {“D2Eapplst”: [{“d2exp_loc”: “/home
/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 472(line=34,
offs=34) – 473(line=34, offs=35)”, “d2exp_node”: {“D2Esym”: [{
“d2sym_sym”: “=”}]}}, [{“D2EXPARGdyn”: [-1,
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
459(line=34, offs=21) – 476(line=34, offs=38)”, [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
459(line=34, offs=21) – 471(line=34, offs=33)”, “d2exp_node”: {
“D2Eapplst”: [{”
d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
459(line=34, offs=21) – 464(line=34, offs=26)”, “d2exp_node”: {“D2Evar”:
[{“d2var_stamp”: 181}]}}, [{“D2EXPARGdyn”: [-1,
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
465(line=34, offs=27) – 471(line=34, offs=33)”, [{“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
466(line=34, offs=28) – 467(line=34, offs=29)”, "d2exp_node
": {“D2Ei0nt”: [“3”]}}, {“d2exp_loc”: “/home/hwxi/research/Postiats/
git/doc/EXAMPLE/INTRO/acker1.dats: 469(line=34, offs=31) – 470(line=34,
offs=32)”, “d2exp_node”: {“D2Ei0nt”: [“3”]}}]]}]]}}, {“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
474(line=34, offs=36) – 476(line=34, offs=38)”, “d2exp_node”: {“D2Ei0nt”
: [“61”]}}]]}]]}}]]}]]}}, “v2aldec_ann”: {}}]]}}], {“d2exp_loc”:
“/home/hwxi/research/Postiats/git/doc/EXAM
PLE/INTRO/acker1.dats: 481(line=36, offs=1) – 500(line=38, offs=4)”,
“d2exp_node”: {“D2Eempty”: }}]}}, {“s2exp_srt”: {“S2RTbas”: [“t@ype”]},
“s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 421}]}}]}}, {}]}}, {
“funclo_name”: “FUNCLOfun”, “funclo_arglst”: }]}}]}}}]}}]
}


You received this message because you are subscribed to the Google Groups
“ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/62b8fc91-9171-45d2-836c-7159b30f7c3c%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/62b8fc91-9171-45d2-836c-7159b30f7c3c%40googlegroups.com?utm_medium=email&utm_source=footer
.

Thanks for the fix! Emitting syntax for unexpanded types works fine for my
purpose since List0 gives me all the info I need.Am Mittwoch, 11. Februar 2015 21:43:44 UTC-5 schrieb gmhwxi:

I took a look at the issue.

It seems that the cause is due to List0 being expanded.

Whether a type definition should or should not be expanded depends on what
the the application wants to do. So my fix is to simply output syntax for
unexpanded
types. Changes have been uploaded.

On Wednesday, February 11, 2015 at 2:34:09 PM UTC-5, William Blair wrote:

I was working with the --jsonize-2 format when I ran into some unexpected
behaviour. I wanted to export the following datatype to JSON with the goal
of automatically generating a parser for it.

abst@ype prop

datatype constraint =
    | ConstraintProp of (prop)
    | ConstraintConj of (List0(constraint))
    | ConstraintDisj of (List0(constraint))

But when I run patsopt with “–jsonize-2”, some of the information is
missing. For instance, there are several s2vars referenced in the
“d2eclist” in the constructors, but there are no entries in s2varmap. It
looks like a couple of s2csts are missing in s2cstmap as well. For
instance, the s2cst_stamp “45” is referenced two times in s2cstmap, but 45
does not have an entry in the map.

You can see the formatted JSON output here:

{ "s2cstmap": [ { "s2cst_sym": "prop", "s2cst_srt": { - Pastebin.com

Is this the expected output for level-2 syntax?

Thanks,
Will

Am Mittwoch, 11. Februar 2015 12:42:41 UTC-5 schrieb gmhwxi:

Yes, the command-line should be:

patsopt --jsonize-2 -d ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid.

I have fixed this one. Changes are in ATS2-0.1.9 pre-release.

On Wed, Feb 11, 2015 at 10:58 AM, ‘Yannick Duchêne’ via ats-lang-users < ats-l...@googlegroups.com> wrote:

Le samedi 13 décembre 2014 05:12:15 UTC+1, gmhwxi a écrit :

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text
can be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

For me, a -d option has to be added before the file name, otherwise I
get an error about an unrecognised option, ex:

 waring(ATS): unrecognized command line argument [test.dats] is 

ignored.

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid. Ex:

…  "Hello\n" …

is turned into this:

 … "Hello
 " …


You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/55b9c3d5-e83e-4980-abb3-c376efe3bdca%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/55b9c3d5-e83e-4980-abb3-c376efe3bdca%40googlegroups.com?utm_medium=email&utm_source=footer
.

Using Postiat 0.1.8, investigating the JSON data for basics_dyn.sats, for
the declaration at line 46:

 sortdef t0p = t@ype and vt0p = vt@ype

I find a d2eclist/2/d2ecl_node/D2Cnone, which is empty. Is this on
purpose or is this a issue related to the one solved for Postiat 0.1.9?

A different case, at line 190, is this declaration:

 overload ~ with lazy_vt_free

For this one I get a d2eclist/39/d2ecl_node/D2Cignored, which is more
explicit, and looks to be as it is on purpose. Is there a way to not ignore
this and get a populated node instead?Le jeudi 12 février 2015 03:43:44 UTC+1, gmhwxi a écrit :

I took a look at the issue.

It seems that the cause is due to List0 being expanded.

Whether a type definition should or should not be expanded depends on what
the the application wants to do. So my fix is to simply output syntax for
unexpanded
types. Changes have been uploaded.

On Wednesday, February 11, 2015 at 2:34:09 PM UTC-5, William Blair wrote:

I was working with the --jsonize-2 format when I ran into some unexpected
behaviour. I wanted to export the following datatype to JSON with the goal
of automatically generating a parser for it.

abst@ype prop

datatype constraint =
    | ConstraintProp of (prop)
    | ConstraintConj of (List0(constraint))
    | ConstraintDisj of (List0(constraint))

But when I run patsopt with “–jsonize-2”, some of the information is
missing. For instance, there are several s2vars referenced in the
“d2eclist” in the constructors, but there are no entries in s2varmap. It
looks like a couple of s2csts are missing in s2cstmap as well. For
instance, the s2cst_stamp “45” is referenced two times in s2cstmap, but 45
does not have an entry in the map.

You can see the formatted JSON output here:

{ "s2cstmap": [ { "s2cst_sym": "prop", "s2cst_srt": { - Pastebin.com

Is this the expected output for level-2 syntax?

Thanks,
Will

Am Mittwoch, 11. Februar 2015 12:42:41 UTC-5 schrieb gmhwxi:

Yes, the command-line should be:

patsopt --jsonize-2 -d ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid.

I have fixed this one. Changes are in ATS2-0.1.9 pre-release.

On Wed, Feb 11, 2015 at 10:58 AM, ‘Yannick Duchêne’ via ats-lang-users < ats-l...@googlegroups.com> wrote:

Le samedi 13 décembre 2014 05:12:15 UTC+1, gmhwxi a écrit :

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text
can be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

For me, a -d option has to be added before the file name, otherwise I
get an error about an unrecognised option, ex:

 waring(ATS): unrecognized command line argument [test.dats] is 

ignored.

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid. Ex:

…  "Hello\n" …

is turned into this:

 … "Hello
 " …


You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/55b9c3d5-e83e-4980-abb3-c376efe3bdca%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/55b9c3d5-e83e-4980-abb3-c376efe3bdca%40googlegroups.com?utm_medium=email&utm_source=footer
.

Done. Should be available in the next release.
For now, please try the pre-release of ATS2-0.1.9:

http://www.ats-lang.org/Downloads.htmlOn Sunday, February 15, 2015 at 6:50:53 PM UTC-5, gmhwxi wrote:

On Saturday, February 14, 2015 at 11:20:10 PM UTC-5, Yannick Duchêne wrote:

Using Postiat 0.1.8, investigating the JSON data for basics_dyn.sats,
for the declaration at line 46:

 sortdef t0p = t@ype and vt0p = vt@ype

I find a d2eclist/2/d2ecl_node/D2Cnone, which is empty. Is this on
purpose or is this a issue related to the one solved for Postiat 0.1.9?

In level-2 syntax, all static definitions have been stored in a map. It
would be a bit involved to output this map in JSON format.

A different case, at line 190, is this declaration:

 overload ~ with lazy_vt_free

For this one I get a d2eclist/39/d2ecl_node/D2Cignored, which is more
explicit, and looks to be as it is on purpose. Is there a way to not ignore
this and get a populated node instead?

I will handle this shortly.

I took a look at the issue.

It seems that the cause is due to List0 being expanded.

Whether a type definition should or should not be expanded depends on
what
the the application wants to do. So my fix is to simply output syntax
for unexpanded
types. Changes have been uploaded.

On Wednesday, February 11, 2015 at 2:34:09 PM UTC-5, William Blair wrote:

I was working with the --jsonize-2 format when I ran into some
unexpected behaviour. I wanted to export the following datatype to JSON
with the goal of automatically generating a parser for it.

abst@ype prop

datatype constraint =
    | ConstraintProp of (prop)
    | ConstraintConj of (List0(constraint))
    | ConstraintDisj of (List0(constraint))

But when I run patsopt with “–jsonize-2”, some of the information is
missing. For instance, there are several s2vars referenced in the
“d2eclist” in the constructors, but there are no entries in s2varmap. It
looks like a couple of s2csts are missing in s2cstmap as well. For
instance, the s2cst_stamp “45” is referenced two times in s2cstmap, but 45
does not have an entry in the map.

You can see the formatted JSON output here:

{ "s2cstmap": [ { "s2cst_sym": "prop", "s2cst_srt": { - Pastebin.com

Is this the expected output for level-2 syntax?

Thanks,
Will

Am Mittwoch, 11. Februar 2015 12:42:41 UTC-5 schrieb gmhwxi:

Yes, the command-line should be:

patsopt --jsonize-2 -d ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid.

I have fixed this one. Changes are in ATS2-0.1.9 pre-release.

On Wed, Feb 11, 2015 at 10:58 AM, ‘Yannick Duchêne’ via ats-lang-users ats-l...@googlegroups.com wrote:

Le samedi 13 décembre 2014 05:12:15 UTC+1, gmhwxi a écrit :

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The
text can be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

For me, a -d option has to be added before the file name, otherwise
I get an error about an unrecognised option, ex:

 waring(ATS): unrecognized command line argument [test.dats] is 

ignored.

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid. Ex:

…  "Hello\n" …

is turned into this:

 … "Hello
 " …


You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/55b9c3d5-e83e-4980-abb3-c376efe3bdca%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/55b9c3d5-e83e-4980-abb3-c376efe3bdca%40googlegroups.com?utm_medium=email&utm_source=footer
.

You waited long enough :slight_smile:

There are clearly non-terminating tail calls.

It is a bug. It had been there but not triggered until ‘overload’ was
handled.

Now it is fixed. Please try pre-release of ATS2-0.1.9.On Tuesday, February 17, 2015 at 4:07:56 PM UTC-5, Yannick Duchêne wrote:

I have not waited so long for these ones, but their seems to hang patsopt --jsonize-2 too:

 lib/ats2-postiats-0.1.9/prelude/SATS/array.sats
 lib/ats2-postiats-0.1.9/prelude/SATS/matrix.sats
 lib/ats2-postiats-0.1.9/prelude/SATS/string.sats
 lib/ats2-postiats-0.1.9/prelude/DATS/filebas.dats
 lib/ats2-postiats-0.1.9/prelude/DATS/strptr.dats
 lib/ats2-postiats-0.1.9/prelude/DATS/string.dats

As said in the prior message, I don’t assert it’s an infinite recursion, I
just wonder if it is.

Le mardi 17 février 2015 21:41:53 UTC+1, Yannick Duchêne a écrit :

Le samedi 13 décembre 2014 05:12:15 UTC+1, gmhwxi a écrit :

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

I can’t tell if it’s a bug or not, so I’m reporting this in case it
really is one.

I can’t generate JSON data for
lib/ats2-postiats-0.1.9/prelude/SATS/array.sats. I wondered if it would
terminate or not: patsopt was running since an hour at full CPU speed,
1.83 GHz, when I stopped it. Memory usage was 21MB (stable, the same during
the whole hour), so that was not an issue with memory.

I stopped it because I had no way to know if it was trapped in an
infinite recursion.

Was it?

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

I can’t tell if it’s a bug or not, so I’m reporting this in case it really
is one.

I can’t generate JSON data for
lib/ats2-postiats-0.1.9/prelude/SATS/array.sats. I wondered if it would
terminate or not: patsopt was running since an hour at full CPU speed,
1.83 GHz, when I stopped it. Memory usage was 21MB (stable, the same during
the whole hour), so that was not an issue with memory.

I stopped it because I had no way to know if it was trapped in an infinite
recursion.

Was it?

I want mention another motivation for jsonizing level-2 syntax:

ATS2 is implemented in ATS1. Jsonization of level-2 syntax makes it possible
to write various program analysis tools for ATS2 in ATS2 (instead of ATS1).

Trust me on this: If you program for a while in ATS2, then you would not
want to go
back to ATS1 anymore :)On Friday, December 12, 2014 11:12:15 PM UTC-5, gmhwxi wrote:

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text can
be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/MEDIUM/UTFPL0

In ATS, level-2 syntax is used after fixities (infix, prefix and postfix)
and bindings are resolved.

If you ever want to design/implement a language, then you can use this
tool to get going quickly.
This is especially so if you want to play with fancy types as the concrete
syntax of ATS allows
the programmer to readily add type-annotations. I myself intend to use the
tool for teaching PL
and compilers.

Also, this tool can be used for analyzing and documenting ATS code.

{
“s2cstmap”:
[{“s2cst_sym”: “g0int_t0ype”, “s2cst_srt”: {“S2RTfun”: [[{“S2RTbas”: [
“tkind”]}], {“S2RTbas”: [“t@ype”]}]}, “s2cst_stamp”: 200, “s2cst_supcls”:
}, {“s2cst_sym”: “int_kind”, “s2cst_srt”: {“S2RTbas”: [“tkind”]},
“s2cst_stamp”: 226, “s2cst_supcls”: }, {“s2cst_sym”: “int”, “s2cst_srt”:
{“S2RTbas”: [“t@ype”]}, “s2cst_stamp”: 230, “s2cst_supcls”: }, {
“s2cst_sym”: “atsvoid_t0ype”, “s2cst_srt”: {“S2RTbas”: [“t@ype”]},
“s2cst_stamp”: 421, "s2cst_supcls
": }]
,
“s2varmap”:

,
“d2conmap”:

,
“d2cstmap”:
[{“d2cst_sym”: “main_void_0”, “d2cst_type”: {“s2exp_srt”: {“S2RTbas”: [
“type”]}, “s2exp_node”: {“S2Efun”: [-1, , {“s2exp_srt”: {“S2RTbas”: [
“t@ype”]}, “s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 421}]}}]}},
“d2cst_stamp”: 56}]
,
“d2varmap”:
[{“d2var_sym”: “acker”, “d2var_stamp”: 181}, {“d2var_sym”: “m”,
“d2var_stamp”: 182}, {“d2var_sym”: “n”, “d2var_stamp”: 183}]
,
“d2eclist”:
[{“d2ecl_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
108(line=8, offs=1) – 143(line=8, offs=36)”, “d2ecl_node”: {“D2Cstaload”:
[, “/home/hwxi/research/Postiats/git/prelude/DATS/integer.dats”]}}, {
“d2ecl_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
166(line=12, offs=1) – 370(line=27, offs=4)”, “d2ecl_node”: {“D2Cfundecs”
: [“FK_fun”, {}, [{“f2undec_loc”:
“/home/hwxi/research/Postiats/git/doc/EXA
MPLE/INTRO/acker1.dats: 170(line=12, offs=5) – 370(line=27, offs=4)”,
“f2undec_var”: {“d2var_stamp”: 181}, “f2undec_def”: {“d2exp_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
176(line=13, offs=1) – 370(line=27, offs=4)”, “d2exp_node”: {“D2Elam_dyn”
: [0, -1, [{“p2at_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
180(line=14, offs=3) – 186(line=14, offs=9)”, “p2at_node”: {“P2Tann”: [{
“p2at_loc”: “/h
ome/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats: 180(line=14,
offs=3) – 181(line=14, offs=4)”, “p2at_node”: {“P2Tvar”: [{“d2var_stamp”:
182}]}}, {“s2exp_srt”: {“S2RTbas”: [“t@ype”]}, “s2exp_node”: {“S2Eapp”: [{
“s2exp_srt”: {“S2RTfun”: [[{“S2RTbas”: [“tkind”]}], {“S2RTbas”: [“t@ype”
]}]}, “s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 200}]}}, [{“s2exp_srt”: {
“S2RTbas”: [“tkind”]}, “s2exp_node”: {“S2Eextkind”: [“atstype_int”
]}}]]}}]}}, {“p2at
_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
188(line=14, offs=11) – 194(line=14, offs=17)”, “p2at_node”: {“P2Tann”:
[{“p2at_loc”: “/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
188(line=14, offs=11) – 189(line=14, offs=12)”, “p2at_node”: {“P2Tvar”:
[{“d2var_stamp”: 183}]}}, {“s2exp_srt”: {“S2RTbas”: [“t@ype”]},
“s2exp_node”: {“S2Eapp”: [{“s2exp_srt”: {“S2RTfun”: [[{“S2RTbas”: [“tkind”
]}], {“S2RTbas”: [
“t@ype”]}]}, “s2exp_node”: {“S2Ecst”: [{“s2cst_stamp”: 200}]}}, [{
“s2exp_srt”: {“S2RTbas”: [“tkind”]}, “s2exp_node”: {“S2Eextkind”: [
“atstype_int”]}}]]}}]}}], {“d2exp_loc”: "/home/hwxi/research/Postiats/git/doc/EXAMPLE/INTRO/acker1.dats:
199(line=15, offs=5) – 370(li

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid.

I have fixed this one. Changes are in ATS2-0.1.9 pre-release.

A character escape issue remains: in doc/EXAMPLE/INTRO/hello.dats, there
are many Unicode characters. In the generated JSON, these are escaped as
\NNN, which is not valid JSON. The proper way to escape these characters
is \uNNNN: \u followed by four digits for character in the BMP (whose
code point are 16 bits) and characters beyond the BMP are to be encoded as
UTF‑16 16 bits word paires (yes, unfortunately less direct), according to
the JSON specification, on printed page 9 (displayed page 10):
http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf .

Ex. \344 should be \u0344.

Fixing the case of characters from the BMP is obvious: just use \u and
pad left with 0 up to four digits next to the \u. The case of
characters beyond de BMP is less obvious, and fortunately, these ones are
rare (however common in some use case). I will search the Unicode reference
for the exact encoding to be applied.

Thanks for pointing this out!

I fixed this. For now I only handle UTF-8.

If you mean output to JSON as‑is, the same byte sequence as in the source
file (except for control characters), assuming it’s UTF-8, then the JSON
standard does not specify it (it’s left at applications discretion),
however, this should be OK, and is indeed the most simple solution, and
there is no more escape needed, except for control characters (the ones in
the range 0 … 31).

I have never understood why people want UTF-16. They could use UTF-8 or
UTF-32.
But why UTF-16 :slight_smile:

Neither I am. It’s related to JavaScript: JavaScript uses UTF-16 strings
(either UCS-2 or UTF-16, and UTF-16 by default, and this is so, by
specification, not implementations details), and JSON came from the
JavaScript world.

Otherwise, one of UTF-32 or UTF-8 should be the only one Unicode encodings
for everything, except internal representations and only if there is a good
reason to.

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text can
be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

For me, a -d option has to be added before the file name, otherwise I get
an error about an unrecognised option, ex:

 waring(ATS): unrecognized command line argument [test.dats] is ignored.

Also there is a bug: end of line escaped characters (\n) in string
literals, are turned into real end of line in the output, which the JSON
output, invalid. Ex:

…  "Hello\n" …

is turned into this:

 … "Hello
 " …

Patsopt can be used to turn ATS source code into a serialized
representation in JSON.

Just out of curiosity, why JSON instead of simple XML 1.0?

I’d also been wanting to ask this question for a while, since JSON is sort
of the “untyped” version of XML, but I guess that may not matter very much
(not sure).

Apparently, XML is rather unpleasant to parse; it seems nobody wants to use
it these days except Java developers ;). /ducks

For instance, the command-line below:

patsopt --jsonize-2 ${PATSHOME}/doc/EXAMPLE/INTRO/acker1.dats

generates the JSON text included at the end of this message. The text can
be readily
parsed. An example of doing so can be found in the UTFPL0 directory:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/MEDIUM/UTFPL0

In ATS, level-2 syntax is used after fixities (infix, prefix and postfix)
and bindings are resolved.

What is “binding” in this context? Some kind of name resolution?

If you ever want to design/implement a language, then you can use this
tool to get going quickly.
This is especially so if you want to play with fancy types as the
concrete syntax of ATS allows
the programmer to readily add type-annotations. I myself intend to use
the tool for teaching PL
and compilers.

Does it mean one can generate ATS source from a constructed JSON
representation?


You received this message because you are subscribed to the Google Groups
“ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/f7b5e00a-b49f-4d28-a70c-2d040d7d458c%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/f7b5e00a-b49f-4d28-a70c-2d040d7d458c%40googlegroups.com?utm_medium=email&utm_source=footer
.

Brandon Barker
brandon...@gmail.com