Search in sources :

Example 1 with AEmptySequenceExpression

use of de.be4.classicalb.core.parser.node.AEmptySequenceExpression 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);
}
Also used : AEmptySequenceExpression(de.be4.classicalb.core.parser.node.AEmptySequenceExpression) APowSubsetExpression(de.be4.classicalb.core.parser.node.APowSubsetExpression) ASeqExpression(de.be4.classicalb.core.parser.node.ASeqExpression) AExpressionDefinitionDefinition(de.be4.classicalb.core.parser.node.AExpressionDefinitionDefinition) TIdentifierLiteral(de.be4.classicalb.core.parser.node.TIdentifierLiteral) ATotalFunctionExpression(de.be4.classicalb.core.parser.node.ATotalFunctionExpression)

Aggregations

AEmptySequenceExpression (de.be4.classicalb.core.parser.node.AEmptySequenceExpression)1 AExpressionDefinitionDefinition (de.be4.classicalb.core.parser.node.AExpressionDefinitionDefinition)1 APowSubsetExpression (de.be4.classicalb.core.parser.node.APowSubsetExpression)1 ASeqExpression (de.be4.classicalb.core.parser.node.ASeqExpression)1 ATotalFunctionExpression (de.be4.classicalb.core.parser.node.ATotalFunctionExpression)1 TIdentifierLiteral (de.be4.classicalb.core.parser.node.TIdentifierLiteral)1