Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON for enumerated type #583

Open
ott2 opened this issue Sep 2, 2023 · 3 comments
Open

JSON for enumerated type #583

ott2 opened this issue Sep 2, 2023 · 3 comments

Comments

@ott2
Copy link
Collaborator

ott2 commented Sep 2, 2023

> 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).

@ozgurakgun
Copy link
Collaborator

Would help if you shared the file for testing purposes.

@ott2
Copy link
Collaborator Author

ott2 commented Sep 4, 2023

$ 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

@ott2
Copy link
Collaborator Author

ott2 commented Sep 4, 2023

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants