-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from ftsrg/xstsenums
Xsts type system rework, custom type serialization bugfix
- Loading branch information
Showing
19 changed files
with
353 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
subprojects/xsts/xsts/src/main/java/hu/bme/mit/theta/xsts/dsl/XstsCustomLiteralSymbol.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package hu.bme.mit.theta.xsts.dsl; | ||
|
||
import hu.bme.mit.theta.common.dsl.Symbol; | ||
import hu.bme.mit.theta.core.type.Expr; | ||
import hu.bme.mit.theta.xsts.type.XstsCustomType; | ||
|
||
import java.math.BigInteger; | ||
|
||
import static hu.bme.mit.theta.core.type.inttype.IntExprs.Int; | ||
|
||
public class XstsCustomLiteralSymbol implements Symbol { | ||
|
||
private final XstsCustomType.XstsCustomLiteral literal; | ||
|
||
private static int counter = 0; | ||
|
||
public XstsCustomLiteralSymbol(String name) { | ||
this.literal = XstsCustomType.XstsCustomLiteral.of(name, BigInteger.valueOf(counter++)); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return literal.getName(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return literal.toString(); | ||
} | ||
|
||
public Expr instantiate(){ | ||
return Int(literal.getIntValue()); | ||
} | ||
|
||
public XstsCustomType.XstsCustomLiteral getLiteral() { | ||
return literal; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
subprojects/xsts/xsts/src/main/java/hu/bme/mit/theta/xsts/dsl/XstsCustomTypeSymbol.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package hu.bme.mit.theta.xsts.dsl; | ||
|
||
import hu.bme.mit.theta.common.dsl.Symbol; | ||
import hu.bme.mit.theta.core.type.Type; | ||
import hu.bme.mit.theta.xsts.type.XstsCustomType; | ||
|
||
import java.util.Objects; | ||
|
||
public final class XstsCustomTypeSymbol implements Symbol { | ||
|
||
private XstsCustomType xstsType; | ||
|
||
private XstsCustomTypeSymbol(final XstsCustomType xstsType) { | ||
this.xstsType =xstsType; | ||
} | ||
|
||
public static XstsCustomTypeSymbol of(final XstsCustomType xstsType) { | ||
return new XstsCustomTypeSymbol(xstsType); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(xstsType); | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object obj) { | ||
if (this == obj) { | ||
return true; | ||
} else if (obj instanceof XstsCustomTypeSymbol) { | ||
final XstsCustomTypeSymbol that = (XstsCustomTypeSymbol) obj; | ||
return this.xstsType.equals(that.xstsType); | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return xstsType.toString(); | ||
} | ||
|
||
public XstsCustomType getXstsType(){ | ||
return xstsType; | ||
} | ||
|
||
@Override | ||
public String getName() { return xstsType.getName(); } | ||
|
||
public Type instantiate() { | ||
return xstsType.getType(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.