next
is a binary relation.
This string:
A\\\,B
is modeled by this next
table:
Consider the first column of the first row of the table. It's value is A. From A we can get to Backslash0, then Backslash1, then Backslash2, then Backslash3, then Comma0, and then B. So, the number of Backslashes between A and the first reachable non-backslash value (which in this case is Comma0) is an odd number (3). Yea! That is what I want. If the first reachable non-backslash value was a non-comma, then the number of intervening Backslashes must be even (0, 2, 4, ...).
How do I express this constraint in Alloy:
For each non-backslash value c in the first column of the next table: If the first non-backslash value c' reachable from c is a comma, then the number of backslashes between c and c' must be odd (1, 3, 5, ...). If the first non-backslash value c' reachable from c is a non-comma, then the number of backslashes between c and c' must be even (0, 2, 4, ...).
答案 0 :(得分:0)
我想知道你是否在适当的抽象层面对其进行建模。是否有必要考虑反斜杠序列的结构?如果你有两个令牌,双反斜杠和反斜杠 - 逗号,并且只是说必须使用反斜杠 - 逗号,之后是双反斜杠,然后是非反斜杠,该怎么办?