conjure
conjure copied to clipboard
JSON for enumerated type
> conjure pretty --output-format=json essence/5x7-ps1-a13.param
Parsing as a parameter file
Error:
Cannot convert the following to simple JSON:
letting vertices be new type enum
{loc_2_2, loc_3_2, loc_4_2, loc_2_3, loc_3_3, loc_4_3, loc_3_4, loc_2_5, loc_3_5, loc_4_5, loc_2_6, loc_3_6,
loc_4_6}
Let us know if you need support for this please!
I don't really need support for the enum type at this point, but I would very much like the run of conjure not to result in an error like this. If enumerated types can't be supported in the simple JSON output, then I would like to see a warning issued, and the rest of the JSON emitted: this is just one of the definitions in the file and I would like to get at the rest (which do not result in errors).
Would help if you shared the file for testing purposes.
$ generated by ./prob2essence.py 5x7-ps1-a13.prob
$ #####
$ #R R#
$ #P B#
$ ## ##
$ # #
$ #B P#
$ #####
letting vertices be new type enum {
loc_2_2,loc_3_2,loc_4_2,loc_2_3,loc_3_3,loc_4_3,loc_3_4,loc_2_5,loc_3_5,loc_4_5,loc_2_6,loc_3_6,loc_4_6}
letting A be relation(
(loc_2_2,loc_3_2,right)
,(loc_2_2,loc_2_3,up)
,(loc_3_2,loc_2_2,left)
,(loc_3_2,loc_4_2,right)
,(loc_3_2,loc_3_3,up)
,(loc_4_2,loc_3_2,left)
,(loc_4_2,loc_4_3,up)
,(loc_2_3,loc_3_3,right)
,(loc_2_3,loc_2_2,down)
,(loc_3_3,loc_2_3,left)
,(loc_3_3,loc_4_3,right)
,(loc_3_3,loc_3_4,up)
,(loc_3_3,loc_3_2,down)
,(loc_4_3,loc_3_3,left)
,(loc_4_3,loc_4_2,down)
,(loc_3_4,loc_3_5,up)
,(loc_3_4,loc_3_3,down)
,(loc_2_5,loc_3_5,right)
,(loc_2_5,loc_2_6,up)
,(loc_3_5,loc_2_5,left)
,(loc_3_5,loc_4_5,right)
,(loc_3_5,loc_3_6,up)
,(loc_3_5,loc_3_4,down)
,(loc_4_5,loc_3_5,left)
,(loc_4_5,loc_4_6,up)
,(loc_2_6,loc_3_6,right)
,(loc_2_6,loc_2_5,down)
,(loc_3_6,loc_2_6,left)
,(loc_3_6,loc_4_6,right)
,(loc_3_6,loc_3_5,down)
,(loc_4_6,loc_3_6,left)
,(loc_4_6,loc_4_5,down))
letting initPat be function(
loc_2_2-->B
,loc_4_2-->P
,loc_2_5-->P
,loc_4_5-->B
,loc_2_6-->R
,loc_4_6-->R
)
letting maxMoves be 100
letting horizon be 100
The unnamed type is used in the other instance variables. Recent Conjure returns a perfectly fine JSON representation if the line defining vertices
is removed. (~2020 vintage conjure complains about the unnamed types, presumably due to the old parser.)