0

BLUF: Can I export a .als file corresponding to a model I have created with the Alloy API?

Example: I have a module that I read in using edu.mit.csail.sdg.alloy4compiler.parser.CompUtil. I then add signatures and facts to create a modified model in memory. Can I "de-parse" that and basically invert the lexer (edu.mit.csail.sdg.alloy4compiler.parser.CompLexer) to get a .als file somehow?

It seems like there ought to be a way to decompile the model in memory and save that as code to be later altered, but I'm having trouble identifying a path to that in the Alloy API Javadocs. I'm building a translator from select behavioral aspects of UML/SysML as part of some research, so I'm trying to figure out if there is something extant I can take advantage of or if I need to create it.

1 Answers1

0

It seems a similar question has been asked before: Generating .als files corresponding to model instances with Alloy API

From the attached post https://stackoverflow.com/users/2270610/lo%c3%afc-gammaitoni stated he has written a solution for this in his Lightning application. He said that he may include the source code for completing this task. I'm unsure if he has uploaded the solution yet.

anonymous
  • 1
  • 1
  • Thanks for your response. However, the post you linked to is about saving instances (or solutions, as Alloy calls them) as Alloy code. I'm interested in exporting actual models created in the API to Alloy code files. – JustAnotherSystemsEngineer Nov 17 '20 at 21:13