use of de.be4.classicalb.core.parser.node.ASeqExpression in project probparsers by bendisposto.
the class ASTBuilder method addFormatToStringDefinition.
public static void addFormatToStringDefinition(IDefinitions iDefinitions) {
if (iDefinitions.containsDefinition(FORMAT_TO_STRING)) {
return;
}
/*-
* FORMAT_TO_STRING(MyFormatString,ListOfValues) == "0";
* EXTERNAL_FUNCTION_FORMAT_TO_STRING(TO_STRING_TYPE) == STRING*seq(TO_STRING_TYPE) --> STRING;
*/
AExpressionDefinitionDefinition formatDef = new AExpressionDefinitionDefinition();
formatDef.setName(new TIdentifierLiteral(FORMAT_TO_STRING));
formatDef.setParameters(createExpressionList("S", "T"));
formatDef.setRhs(new AStringExpression(new TStringLiteral("abc")));
iDefinitions.addDefinition(formatDef, IDefinitions.Type.Expression);
AExpressionDefinitionDefinition formatType = new AExpressionDefinitionDefinition();
formatType.setName(new TIdentifierLiteral("EXTERNAL_FUNCTION_FORMAT_TO_STRING"));
formatType.setParameters(createExpressionList("T"));
formatType.setRhs(new ATotalFunctionExpression(new AMultOrCartExpression(new AStringSetExpression(), new ASeqExpression(createIdentifier("T"))), new AStringSetExpression()));
iDefinitions.addDefinition(formatType, IDefinitions.Type.Expression);
}
use of de.be4.classicalb.core.parser.node.ASeqExpression in project probparsers by bendisposto.
the class ASTBuilder method addSortDefinition.
public static void addSortDefinition(IDefinitions iDefinitions) {
if (iDefinitions.containsDefinition(SORT)) {
return;
}
/*- SORT
* SORT(X) == [];
* EXTERNAL_FUNCTION_SORT(T) == POW(T)-->seq(T);
*/
AExpressionDefinitionDefinition sortDef = new AExpressionDefinitionDefinition();
sortDef.setName(new TIdentifierLiteral(SORT));
sortDef.setParameters(createExpressionList("X"));
sortDef.setRhs(new AEmptySequenceExpression());
iDefinitions.addDefinition(sortDef, IDefinitions.Type.Expression);
AExpressionDefinitionDefinition sortType = new AExpressionDefinitionDefinition();
sortType.setName(new TIdentifierLiteral("EXTERNAL_FUNCTION_SORT"));
sortType.setParameters(createExpressionList("T"));
sortType.setRhs(new ATotalFunctionExpression(new APowSubsetExpression(createIdentifier("T")), new ASeqExpression(createIdentifier("T"))));
iDefinitions.addDefinition(sortType, IDefinitions.Type.Expression);
}
Aggregations