AlloyTools / org.alloytools.alloy

Alloy is a language for describing structures and a tool for exploring them. It has been used in a wide range of applications from finding holes in security mechanisms to designing telephone switching networks. This repository contains the code for the tool.
Other
694 stars 123 forks source link

Evaluator not recognizing variable name. Error: The name cannot contain the '$' symbol. #235

Closed luomein closed 4 months ago

luomein commented 4 months ago

Alloy 6.1.0, Mac OS 13.6.3

In the Evaluator, sometimes the variable name will raise error, The name cannot contain the '$' symbol.

{Node$0} ---> work fine {Node$1} ---> work fine {Node$0} + {Node$1} ---> work fine {Node$0, Node$1} ---> error1 {(Node$0), (Node$1)} ---> error2 {List$0->Node$0, List$0->Node$1} ---> error2

error1: The name cannot contain the '$' symbol.

error2: Syntax error at line 1 column 10: There are 38 possible tokens that can appear here: ! # ( * @ Int NAME NUMBER STRING String ^ after all always before disj eventually fun historically iden int let lone no none once one pred seq set some steps sum this univ { } ~

image
pkriens commented 4 months ago

The '{' is not valid Alloy syntax. Message could be better but the curly braces are the problem. This works:

(Node$0+Node$1) & Node$1

For convenience, you can also use the Foo¹ that you can copy from the output.