The factory used to construct the nodes of Abstract Syntax Trees.
The user constructs the nodes of an AST using the methods in this class.
These nodes have the structure of a tree, the root node being the node
representing the translation unit or program; the children of the root node
correspond to the "external definitions" of the unit. Once these have been
constructed, the ASTFactory.newAST(dev.civl.abc.ast.node.IF.SequenceNode<dev.civl.abc.ast.node.IF.statement.BlockItemNode>, java.util.Collection<dev.civl.abc.token.IF.SourceFile>, boolean) method is invoked on the root node
to actually construct the AST object. This performs a number of analyses and
stores additional information about the AST. A number of errors can be
detected and reported at this stage. Among other things, this also computes
the abstract "type" of every variable, function, and expression. It also
computes the scope and linkage of all identifiers.
After the AST is created, the AST (and all of its nodes) become immutable.
Every node has an "owner" (originally null), which is set to the
new AST object at this time. If you want to modify the tree, you must first
invoke the AST.release() method, which frees the nodes from ownership
by the AST object, setting the "owner" fields again to null.
They can then be modified, and then ASTFactory.newAST(dev.civl.abc.ast.node.IF.SequenceNode<dev.civl.abc.ast.node.IF.statement.BlockItemNode>, java.util.Collection<dev.civl.abc.token.IF.SourceFile>, boolean) called again to
re-analylze and re-build an AST. Alternatively, you can also clone the tree,
if you want to keep the old AST around for some reason.
Finally, one or more ASTs can be combined to form a complete "program" using the newProgram method. This corresponds to "linking" in the usual compiler sense. (Not yet implemented.)
-
Method Summary
Modifier and TypeMethodDescriptiongets the configuration associated with this translation task.getCivlOmpDependKey(Boolean isSource) getConstantValue(ExpressionNode expression) If the expression can be evaluated statically to yield a constant value, this method returns that value, else it returns null.Returns the value factory associated to this node factory.newAbstractFunctionDefinitionNode(Source source, IdentifierNode name, TypeNode type, SequenceNode<ContractNode> contract, int continuity, SequenceNode<PairNode<ExpressionNode, ExpressionNode>> intervals, StringLiteralNode attr) Creates a new CIVL abstract function definition.newAlignOfNode(Source source, TypeNode type) Constructs a new "align-of" node.newAllocationNode(Source source, boolean isAllocates, SequenceNode<ExpressionNode> memoryList) Creates a new allocation node, which represents either anallocatesorfreesclause.newAnyactNode(Source source) Creates a new\anyactevent nodenewArrayDesignatorNode(Source source, ExpressionNode index) Constructs a new array designator node.newArrayLambdaNode(Source source, TypeNode type, SequenceNode<PairNode<SequenceNode<VariableDeclarationNode>, ExpressionNode>> boundVariableDeclarationList, ExpressionNode restriction, ExpressionNode expression) Constructs a new array lambda expression.newArrayLambdaNode(Source source, TypeNode type, List<VariableDeclarationNode> boundVariableDeclarationList, ExpressionNode restriction, ExpressionNode expression) Constructs a new array lambda expression.newArrayTypeNode(Source source, TypeNode elementType, ExpressionNode extent) Constructs and returns a new array type node.newArrayTypeNode(Source source, TypeNode elementType, ExpressionNode extent, ExpressionNode startIndex) Constructs and returns a new array type node.newArrowNode(Source source, ExpressionNode structurePointer, IdentifierNode fieldName) Constructs a new node for an "arrow" expression, used in C for structure or union field navigation starting from a pointer, as inmyStructPtr->field.newAssignsNode(Source source, SequenceNode<ExpressionNode> expressionList) Constructs a new node representing an ACSLassignscontract clause.newAssumesNode(Source source, ExpressionNode predicate) Creates a newassumesclause nodenewAtomicStatementNode(Source statementSource, StatementNode body) Creates a new CIVL-C$atomicstatement node.newAtomicTypeNode(Source source, TypeNode baseType) Constructs and returns a new atomic type node.newAttribute(String attributeName, Class<? extends Object> attributeClass) Creates an attribute slot for all AST nodes.newBasicTypeNode(Source source, StandardBasicType.BasicTypeKind kind) Returns a new type node for a basic type.newBehaviorNode(Source source, IdentifierNode name, SequenceNode<ContractNode> body) creates a behavior node.newBooleanConstantNode(Source source, boolean value) Constructs a new node representing a CIVL-C boolean constant, "$true" or "$false".newBreakNode(Source source) Creates a new node representing the Cbreakstatement, used in a loop orswitchbody to direct control to the location just after the loop orswitchconstruct.newCallEventNode(Source source, IdentifierExpressionNode function, SequenceNode<ExpressionNode> args) Creates a new\callevent nodenewCaseLabelDeclarationNode(Source source, ExpressionNode constantExpression, StatementNode statement) Constructs a new case-labeled declaration node.newCastNode(Source source, TypeNode type, ExpressionNode argument) Constructs a new cast node.newCharacterConstantNode(Source source, String representation, ExecutionCharacter character) Returns a new character constant node.newChooseStatementNode(Source source, List<StatementNode> statements) Constructs a new node representing a CIVL-C$choosestatement.newCivlForNode(Source source, boolean isParallel, DeclarationListNode variables, ExpressionNode domain, StatementNode body, SequenceNode<ContractNode> loopContract) Creates a new instance of the CIVL$foror$parfornode.newCompletenessNode(Source source, boolean isComplete, SequenceNode<IdentifierNode> idList) creates a completeness clause node, which could becompleteordisjointnewCompoundInitializerNode(Source source, List<PairNode<DesignationNode, InitializerNode>> initList) Constructs new compound initializer node.newCompoundLiteralNode(Source source, TypeNode typeNode, CompoundInitializerNode initializerList) Returns a new compound literal node.newCompoundStatementNode(Source source, List<BlockItemNode> items) Constructs a new compound statement node.newContinueNode(Source source) Creates a new node representing the Ccontinuestatement, used in a loop body to direct control to the next loop iteration.newDefaultLabelDeclarationNode(Source source, StatementNode statement) Constructs a new node representing the occurence of adefault :label inside of aswitchstatement body.newDependsNode(Source source, ExpressionNode condition, SequenceNode<DependsEventNode> eventList) Constructs a new node representing a CIVL-C$dependscontract clause.newDerivativeExpressionNode(Source source, ExpressionNode function, SequenceNode<PairNode<IdentifierExpressionNode, IntegerConstantNode>> partials, SequenceNode<ExpressionNode> arguments) Constructs a new CIVL-C derivative expression, used to represent the (partial) derivative of a function with respect to any number of variables, evaluated at a point.newDesignationNode(Source source, List<DesignatorNode> designators) Creates a new designation node, which can be used as part of a compound initializer.newDoLoopNode(Source source, ExpressionNode condition, StatementNode body, SequenceNode<ContractNode> contracts) Constructs a new node representing ado...whileloop.newDomainTypeNode(Source source) Returns a new instance of domain type node, with no dimension specified; this is the CIVL-C type$domain.newDomainTypeNode(Source source, ExpressionNode dimension) Returns a new instance of the domain type node with given integer dimension; this is the CIVL-C type$domain(n), wherenis the domain dimension.newDotNode(Source source, ExpressionNode structure, IdentifierNode fieldName) Constructs a new node for a "dot" expression, used in C for structure or union field navigation, as inmyStruct.field.newEnsuresNode(Source source, ExpressionNode expression) Constructs a new node representing a CIVL-C$ensurescontract clause.Constructs a new enumeration constant node.newEnumerationTypeNode(Source source, IdentifierNode tag, SequenceNode<EnumeratorDeclarationNode> enumerators) Constructs and returns a new enumeration type node.newEnumeratorDeclarationNode(Source source, IdentifierNode name, ExpressionNode value) Creates new declaration of an enumerator, which is an element inside of a Cenumdefinition.newExpressionStatementNode(ExpressionNode expression) Constructs a new expression statement node.newExtendedQuantifiedExpressionNode(Source source, ExtendedQuantifiedExpressionNode.ExtendedQuantifier quant, ExpressionNode lo, ExpressionNode hi, ExpressionNode function) Creates a new extended quantified expression node.newFieldDeclarationNode(Source source, IdentifierNode name, TypeNode type) Consructs a new field declaration node.newFieldDeclarationNode(Source source, IdentifierNode name, TypeNode type, ExpressionNode bitFieldWidth) Consructs a new field declaration node which also includes a "bit width" argument.newFieldDesignatorNode(Source source, IdentifierNode name) Constructs a new field designator node.newFloatingConstantNode(Source source, String representation) Constructs a new floating constant node.newFloatingConstantNode(Source source, String representation, String wholePart, String fractionPart, String exponent, FloatingValue value) Constructs a new floating constant node.newFocusAssertNode(Source source, TokenFactory tokenFactory, List<String> focusTags) newFocusLoopNode(Source source, TokenFactory tokenFactory, String focusTag, SequenceNode<ExpressionNode> tagWindow, SequenceNode<ExpressionNode> memoryList) newFocusOrderedNode(Source source, TokenFactory tokenFactory, String focusTag, OperatorNode operator, RegularRangeNode range, ExpressionNode expr) newForLoopInitializerNode(Source source, List<VariableDeclarationNode> declarations) Construcs a new declaration list node, which is comprised of a sequence of variable declarations.newForLoopNode(Source source, ForLoopInitializerNode initializer, ExpressionNode condition, ExpressionNode incrementer, StatementNode body, SequenceNode<ContractNode> contracts) Constructs a newforloop node.newFunctionCallNode(Source source, ExpressionNode function, List<ExpressionNode> arguments, SequenceNode<ExpressionNode> scopeList) Constructs a new function call node.newFunctionCallNode(Source source, ExpressionNode function, List<ExpressionNode> contextArguments, List<ExpressionNode> arguments, SequenceNode<ExpressionNode> scopeList) Constructs a new kernel function call node.newFunctionDeclarationNode(Source source, IdentifierNode name, TypeNode type, SequenceNode<ContractNode> contract) Creates a new function declaration with no body (so it is not a function "definition").newFunctionDefinitionNode(Source source, IdentifierNode name, FunctionTypeNode type, SequenceNode<ContractNode> contract, CompoundStatementNode body) Constructs a new node representing a function definition, i.e., a function declaration with body.newFunctionTypeNode(Source source, TypeNode returnType, SequenceNode<VariableDeclarationNode> formals, boolean hasIdentifierList) Constructs and returns a new function type node.newGenericAssociationNode(Source source, TypeNode typeLabel, ExpressionNode associatedExpression) Constructs a new generic association node which acts as a binding between a type node and an expression for the purposes of a generic selection nodenewGenericSelectionNode(Source source, ExpressionNode controllingExpression, ExpressionNode defaultExpression, SequenceNode<GenericAssociationNode> genericAssociationList) Constructs a new generic selection node, used to select an expression to evaluate at compile time based on the type of the controlling expression.newGotoNode(Source source, IdentifierNode label) Constructs a new node representing agotostatement.newGuardNode(Source source, ExpressionNode expression) Constructs a new node representing a CIVL-C$guardcontract clause.newHereNode(Source source) Creates a new constant expression node representing$here.newIdentifierExpressionNode(Source source, IdentifierNode identifier) Constructs a new identifier expression node.newIdentifierNode(Source source, String name) Constructs and returns a new identifier node with given source object and name.newIfNode(Source source, ExpressionNode condition, StatementNode trueBranch) Creates newifstatement node when there is no false ("else") branch.newIfNode(Source source, ExpressionNode condition, StatementNode trueBranch, StatementNode falseBranch) Creates a newifstatement node.newInsertTransformNode(Source source, List<BlockItemNode> nodesToInsert, boolean insertAfter) newIntConstantNode(Source source, int value) A special case ofnewIntegerConstantNode(Source, String)where the 2nd arg is an integer, and the type of thisIntegerConstantNodeis int.newIntegerConstantNode(Source source, String representation) Constructs a new integer constant node.newInvariantNode(Source source, boolean isLoopInvariant, ExpressionNode expression) Creates a newinvariantclause nodenewLabeledStatementNode(Source source, LabelNode label, StatementNode statement) Constructs new node representing a labeled statement.newLambdaNode(Source source, VariableDeclarationNode boundVariableDeclaration, ExpressionNode expression) Constructs a new lambda expression with a free (no restriction on the bound variable) variable.newLambdaNode(Source source, VariableDeclarationNode boundVariableDeclaration, ExpressionNode restriction, ExpressionNode expression) Constructs a new lambda expression with restriction on the bound variable.newLambdaTypeNode(Source source, TypeNode freeVariableType, TypeNode lambdaFunctionType) newMemoryEventNode(Source source, MemoryEventNode.MemoryEventNodeKind kind, SequenceNode<ExpressionNode> memoryList) creates a new memory event node, which could be either\read,writeorreach.newMemTypeNode(Source source) Returns a new mem type node ("$mem").newNoactNode(Source source) Creates a new\noactevent nodenewNothingNode(Source source) creates a\nothingnode which represents an empty set of memory units.newNullStatementNode(Source source) Constructs a new node representing a C "null" statement, also known as a "no-op" statement, and written as just a semicolon.newObjectofNode(Source source, ExpressionNode operand) Creates a new$object_ofnodenewOmpAtomicNode(Source source, StatementNode statement, OmpAtomicNode.OmpAtomicClause clause, boolean seqConsistent) Creates a new OpenMP atomic node, representing#pragma omp atomic....newOmpBarrierNode(Source source) Creates a new OpenMP barrier node, representing#pragma omp barrier....newOmpCriticalNode(Source source, IdentifierNode name, StatementNode statement) Creates a new OpenMP critical node, representing#pragma omp critical....newOmpFlushNode(Source source) Creates a new OpenMP flush node with no variable listnewOmpFlushNode(Source source, SequenceNode<IdentifierExpressionNode> variables) Creates a new OpenMP flush node, representing#pragma omp flush....newOmpForNode(Source source, StatementNode statement) Creates a new OpenMP for node, representing#pragma omp for....newOmpFortranEndNode(Source source, OmpEndNode.OmpEndType endType) FORTRAN ONLY
Creates a new OpenMP END node with its type, which indicates what previous OpenMP executable struct should end.newOmpFunctionReductionNode(Source source, IdentifierExpressionNode function, SequenceNode<IdentifierExpressionNode> variables) Creates a new OpenMP reduction node with an identifier operator (i.e., function names).newOmpMasterNode(Source source, StatementNode statement) Creates a new OpenMP master node, representing#pragma omp master....newOmpOrederedNode(Source source, StatementNode statement) Creates a new OpenMP ordered node, representing#pragma omp ordered....newOmpParallelNode(Source source, StatementNode statement) Creates a new OpenMP parallel node, representing#pragma omp parallel....newOmpSectionNode(Source source, StatementNode statement) Creates a new OpenMP section node, representing#pragma omp section....newOmpSectionsNode(Source source, StatementNode statement) Creates a new OpenMP sections node, representing#pragma omp sections....newOmpSimdNode(Source source, StatementNode statement) Creates a new OpenMP simd node, representing#pragma omp simd....newOmpSingleNode(Source source, StatementNode statement) Creates a new OpenMP single node, representing#pragma omp single....newOmpSymbolReductionNode(Source source, OmpReductionNode.OmpReductionOperator operator, SequenceNode<IdentifierExpressionNode> variables) Creates a new OpenMP reduction node with a standard operator.newOmpThreadprivateNode(Source source, SequenceNode<IdentifierExpressionNode> variables) Creates a new OpenMP threadprivate node.newOperatorEventNode(Source source, CompositeEventNode.EventOperator op, DependsEventNode left, DependsEventNode right) creates a new composite event node, which is composed by two events node and an operator.newOperatorNode(Source source, OperatorNode.Operator operator, ExpressionNode argument) Convenience method for constructing new unary operator node; equivalent to invokingnewOperatorNode(Source, Operator, ExpressionNode)on the singleton list containingargument.newOperatorNode(Source source, OperatorNode.Operator operator, ExpressionNode arg0, ExpressionNode arg1) Convenience method for constructing new binary operator node; equivalent to invokingnewOperatorNode(Source, Operator, ExpressionNode)on the list consisting ofarg0andarg1.newOperatorNode(Source source, OperatorNode.Operator operator, ExpressionNode arg0, ExpressionNode arg1, ExpressionNode arg2) Convenience method for constructing new ternary operator node; equivalent to invokingnewOperatorNode(Source, Operator, ExpressionNode)on the list consisting ofarg0,arg1, andarg2.newOperatorNode(Source source, OperatorNode.Operator operator, List<ExpressionNode> arguments) Constructs a new operator expression node using one of the standard operators provided in the enumerated typeOperatorNode.Operator.newPairNode(Source source, S node1, T node2) Creates a new ordered pair node, i.e., a node with exactly two children belonging to two specific classes.newPointerTypeNode(Source source, TypeNode referencedType) Constructs and returns a new pointer type node.newPragmaNode(Source source, IdentifierNode identifier, CivlcTokenSequence producer, CivlcToken newlineToken) Constructs a new pragma node, representing a C#pragmadirective.newPredicateNode(Source source, IdentifierNode identifier, SequenceNode<VariableDeclarationNode> parameters, ExpressionNode body) Creates a newPredicateNodefor ACSL predicatesnewProcnullNode(Source source) Constructs a new node representing an occurrence of the CIVL-C "null process" constant, written$proc_null.newProgramNode(Source source, List<BlockItemNode> definitions) Creates a new node representing an entire program.newQuantifiedExpressionNode(Source source, QuantifiedExpressionNode.Quantifier quantifier, SequenceNode<PairNode<SequenceNode<VariableDeclarationNode>, ExpressionNode>> boundVariableDeclarationList, ExpressionNode restriction, ExpressionNode expression, SequenceNode<PairNode<ExpressionNode, ExpressionNode>> intervalSequence) Constructs a new quantified expression.newRangeTypeNode(Source source) Returns a new instance of range type node; this is the CIVL-C type$range.newReadsNode(Source source, SequenceNode<ExpressionNode> expressionList) Constructs a new node representing an ACSLreadscontract clause.newRegionofNode(Source source, ExpressionNode operand) Creates a new$region_ofnodenewRegularRangeNode(Source source, ExpressionNode low, ExpressionNode high) Constructs a new CIVL-C regular range expression, which has the formlo ..newRegularRangeNode(Source source, ExpressionNode low, ExpressionNode high, ExpressionNode step) Constructs a new CIVL-C regular range expression, which has the formlo ..newRemoteOnExpressionNode(Source source, ExpressionNode left, ExpressionNode right) Constructs a remote expression node, representing an expression of the formproc_expr@x.newRequiresNode(Source source, ExpressionNode expression) Constructs a new node representing a CIVL-C$requirescontract clause.newResultNode(Source source) Constructs a new node representing an occurrence of the CIVL-C expression "$result", used in function constracts to represent the result returned by the function.newReturnNode(Source source, ExpressionNode argument) Creates a newreturnstatement node.newRootNode(Source source) Creates a new constant expression node representing$root.newRunNode(Source source, StatementNode statement) Create a newRunNodenewScopeOfNode(Source source, ExpressionNode argument) Creates a new expression node representing$scopeof(expr).newScopeOfNode(Source source, IdentifierExpressionNode variableExpression) Constructs a new CIVL-C$scopeofexpression node.newScopeTypeNode(Source source) Returns a new scope type node ("$scope").newSelfNode(Source source) Constructs a new node representing an occurrence of the CIVL-C "self" process constant, written "$self".<T extends ASTNode>
SequenceNode<T> newSequenceNode(Source source, String name, List<T> nodes) Creates a new sequence node, i.e., a node which has some finite ordered sequence of children belonging to a particular class.newSizeofNode(Source source, SizeableNode argument) Constrcts a newsizeofexpression.newSpawnNode(Source source, FunctionCallNode callNode) Constructs a new CIVL-C spawn expression.newStandardLabelDeclarationNode(Source source, IdentifierNode name, StatementNode statement) Creates a new node representing a standard C label.newStatementExpressionNode(Source source, CompoundStatementNode statement) creates a new statement expression node (GNU C extension).newStaticAssertionNode(Source source, ExpressionNode expression, StringLiteralNode message) Creates a new C11 static assertion node.newStringLiteralNode(Source source, String representation, StringLiteral literal) Constructs a new string literal node.newStructOrUnionTypeNode(Source source, boolean isStruct, IdentifierNode tag, SequenceNode<FieldDeclarationNode> structDeclList) Constructs and returns a new structure or union type node.newSwitchNode(Source source, ExpressionNode condition, StatementNode body) Constructs a new node representing a Cswitchstatement.newTranslationUnitNode(Source source, List<BlockItemNode> definitions) Creates a new node representing an entire translation unit.newTypedefDeclarationNode(Source source, IdentifierNode name, TypeNode type) Constructs a newtypedefdeclaration node.newTypedefNameNode(IdentifierNode name, SequenceNode<ExpressionNode> scopeList) Returns a new instance of a typedef name node.newTypeofNode(Source source, ExpressionNode expression) creates a new typeof node (GNU C extension)newUpdateNode(Source source, ExpressionNode collator, FunctionCallNode call) Create a newUpdateNodenewVariableDeclarationNode(Source source, IdentifierNode name, TypeNode type) Creates a new declaration of an "object" variable with no initializer.newVariableDeclarationNode(Source source, IdentifierNode name, TypeNode type, InitializerNode initializer) Creates a new declaration for an "object" variable with an initializer.newVoidTypeNode(Source source) Returns a new void type node.newWhenNode(Source source, ExpressionNode guard, StatementNode body) Creates a new node representing a CIVL-C$whennode, used to represent a guarded command.newWhileLoopNode(Source source, ExpressionNode condition, StatementNode body, SequenceNode<ContractNode> contracts) Constructs a new node representing awhileloop.newWildcardNode(Source source) creates a new wildcard (...) node.Creates a new OpenMP worksharing node with a specific kind.voidsetConstantValue(ExpressionNode expression, Value value) If for some reason you know what the constant value of a node is supposed to be, tell it by invoking this method.Returns a reference to aTypeFactory
-
Method Details
-
getCivlOmpDependKey
- Parameters:
isSource- iftruethen returns theAttributeKeyof CIVL OpenMP depend source; otherwise depend target- Returns:
- the AttributeKey which stores CIVL OpenMP dependency relationship
-
getTempCountKey
AttributeKey getTempCountKey()- Returns:
- the AttributeKey which stores the number of temporary variables in an AST.
-
newAttribute
Creates an attribute slot for all AST nodes. This is a mechanism for extending the functionality of nodes. This may be used to hang any kind of data onto nodes. Initially, the attribute value associated to the new key will be null in every node.- Parameters:
attributeName- a name for the new attribute, unique among all attribute namesattributeClass- the class to which attribute values of the new kind will belong- Returns:
- a new attribute key which can be used to assign attribute values to nodes
-
newSequenceNode
Creates a new sequence node, i.e., a node which has some finite ordered sequence of children belonging to a particular class.- Parameters:
source- source information for the whole sequencename- a name to use when printing this sequence nodenodes- a list of nodes that will form the children of the new sequence node- Returns:
- the new sequence node with the children set
-
newPairNode
Creates a new ordered pair node, i.e., a node with exactly two children belonging to two specific classes.- Parameters:
node1- the first child nodenode2- the second child node- Returns:
- the new pair node with the children set
-
newIdentifierNode
Constructs and returns a new identifier node with given source object and name.- Parameters:
source- source information for the identifier usename- the name of this identifier- Returns:
- a new identifier node
-
newBasicTypeNode
Returns a new type node for a basic type.- Parameters:
source- source information for the occurrence of the basic typekind- the kind of the basic type- Returns:
- the new basic type node
-
newVoidTypeNode
Returns a new void type node.- Parameters:
source- source information for the occurrence of "void"- Returns:
- the new void type node
-
newEnumerationTypeNode
EnumerationTypeNode newEnumerationTypeNode(Source source, IdentifierNode tag, SequenceNode<EnumeratorDeclarationNode> enumerators) Constructs and returns a new enumeration type node.- Parameters:
source- source information for the occurrence of the enumeration typetag- the enumeration tag, i.e., the name of the enumeration, the string that followsenumenumerators-- Returns:
- the new enumeration type node
-
newArrayTypeNode
Constructs and returns a new array type node.- Parameters:
source- source information for the occurrence of the array typeelementType- the node representing the element typeextent- the node representing the expression in square brackets, i.e., the array length or "extent"- Returns:
- the new array type node
-
newArrayTypeNode
ArrayTypeNode newArrayTypeNode(Source source, TypeNode elementType, ExpressionNode extent, ExpressionNode startIndex) Constructs and returns a new array type node.- Parameters:
source- source information for the occurrence of the array typeelementType- the node representing the element typeextent- the node representing the expression in square brackets, i.e., the array length or "extent"startIndex- the node representing the expression in square brackets, i.e, the array starting index- Returns:
- the new array type node
-
newAtomicTypeNode
Constructs and returns a new atomic type node.- Parameters:
source- the source information for the occurrence of the atomic typebaseType- the base type, i.e., the type modified by the "atomic"- Returns:
- the new atomic type node
-
newPointerTypeNode
Constructs and returns a new pointer type node.- Parameters:
source- source information for the occurrence of the pointer typereferencedType- the type pointed to- Returns:
- the new pointer type node
-
newStructOrUnionTypeNode
StructureOrUnionTypeNode newStructOrUnionTypeNode(Source source, boolean isStruct, IdentifierNode tag, SequenceNode<FieldDeclarationNode> structDeclList) Constructs and returns a new structure or union type node.- Parameters:
source- source information for the occurrence of the structure or union type nodeisStruct-truefor a structure type,falsefor a union typetag- the tag of the structure or union, i.e., the string that followsstructorunion. Maybenull.structDeclList- the sequence of field declarations; may benull- Returns:
- the new structure or union type node
-
newFunctionTypeNode
FunctionTypeNode newFunctionTypeNode(Source source, TypeNode returnType, SequenceNode<VariableDeclarationNode> formals, boolean hasIdentifierList) Constructs and returns a new function type node.- Parameters:
source- source information for the occurrence of the function typereturnType- the node representing the return type of the function typeformals- the sequence of formal parameter declaration nodes for the function type. This parameter cannot be null. If there are no formals then it must be a sequence node with an empty list.hasIdentifierList-trueif the function is declared using an identifier list (i.e., without types associated to the parameters);falseif the function is declared with a parameter declaration list- Returns:
- the function type node
-
newScopeTypeNode
Returns a new scope type node ("$scope"). This is a CIVL-C type.- Parameters:
source- source information for the occurrence of$scope- Returns:
- the new instance of scope type
-
newMemTypeNode
Returns a new mem type node ("$mem"). This is a CIVL-C type.- Parameters:
source- source information for the occurrence of$mem- Returns:
- the new instance of mem type node
-
newTypedefNameNode
Returns a new instance of a typedef name node. This is a use of a typedef name. The source is the same as that of the identifier name.- Parameters:
name- the identifier node representing the use of the typedef namescopeList- optional CIVL-C construct: list of scope parameters used to instantiate a scope-parameterized typedef- Returns:
- the new typedef name node wrapping the given identifier node
-
newRangeTypeNode
Returns a new instance of range type node; this is the CIVL-C type$range.- Parameters:
source- source information for the occurrence of$domain- Returns:
- the new range type node
-
newDomainTypeNode
Returns a new instance of domain type node, with no dimension specified; this is the CIVL-C type$domain.- Parameters:
source- source information for the occurrence of$domain- Returns:
- the new domain type node instance
-
newLambdaTypeNode
LambdaTypeNode newLambdaTypeNode(Source source, TypeNode freeVariableType, TypeNode lambdaFunctionType) -
newDomainTypeNode
Returns a new instance of the domain type node with given integer dimension; this is the CIVL-C type$domain(n), wherenis the domain dimension. This is a subtype of$domain.- Parameters:
source- source information for the occurrence of$domaindimension- the dimension of the domain, i.e., the arity of the tuples which comprise the domain- Returns:
- the new domain type node instance
-
getConstantValue
If the expression can be evaluated statically to yield a constant value, this method returns that value, else it returns null. Every "constant expression" will yield a (non-null) value, but other expressions not strictly considered "constant expressions" may also yield non-null constant values. Hence if method isConstantExpression() returns true, this method should return a non-null value; if isConstantExpression() returns false, this method may or may not return a non-null value.- Parameters:
expression- an expression node- Returns:
- the constant value obtained by evaluating this expression, or null if the expression cannot be evaluated
- Throws:
SyntaxException
-
setConstantValue
If for some reason you know what the constant value of a node is supposed to be, tell it by invoking this method.- Parameters:
expression- the expression node that has been determined to have a constant valuevalue- the constant vale to associate to that expression node
-
newCharacterConstantNode
CharacterConstantNode newCharacterConstantNode(Source source, String representation, ExecutionCharacter character) Returns a new character constant node. A character constant is a literal charcter in a program, something like'a'. C distinguishes between characters in the source code, and "execution characters" which are encoded in various ways by source code elements. Unicode characters can all be encoded using appropriate escape sequences.- Parameters:
source- the source information for the occurrence of the character constantrepresentation- the way the character literal actually appears in the program source codecharacter- the execution character represented by the character constant- Returns:
- the new character constant node
-
newStringLiteralNode
Constructs a new string literal node. A string literal occurs in the program source code as"...".- Parameters:
source- the source information for the occurrence of the string literal. The string literal is usually a single token.representation- the way the string literal actually appears in the program source code, with escape sequences intactliteral- the string literal object obtained by interpreting the representation- Returns:
- the new string literal node
-
newIntegerConstantNode
IntegerConstantNode newIntegerConstantNode(Source source, String representation) throws SyntaxException Constructs a new integer constant node. An integer constant is an occurrence of a literal integer in the source, which encodes a concrete integer value. The C11 Standard specifies the format for integer constants, which includes various letter suffixes that can occur at the end of the constant, in Sec. 6.4.4.1. The integer constant value is constructed by interpreting the representation.- Parameters:
source- the source information for the integer constantrepresentation- the way the integer actually appears in the program source code- Returns:
- the new integer constant node
- Throws:
SyntaxException- if the representation does not conform to the format specified in the C11 Standard
-
newIntConstantNode
A special case ofnewIntegerConstantNode(Source, String)where the 2nd arg is an integer, and the type of thisIntegerConstantNodeis int.- Parameters:
source- The source information for the integer constantvalue- The value of the integer constant.- Returns:
- The new integer constant node
-
newFloatingConstantNode
FloatingConstantNode newFloatingConstantNode(Source source, String representation, String wholePart, String fractionPart, String exponent, FloatingValue value) Constructs a new floating constant node. A floating constant is an occurrence of a literal floating point number in the source, which encodes a concrete floating point value. The C Standard specifies the format for floating constants, which includes various letter suffixes that can occur at the end of the constant, in Sec. 6.4.4.2. -
newFloatingConstantNode
FloatingConstantNode newFloatingConstantNode(Source source, String representation) throws SyntaxException Constructs a new floating constant node. A floating constant is an occurrence of a literal floating point number in the source, which encodes a concrete floating point value. The C11 Standard specifies the format for floating constants, which includes various letter suffixes that can occur at the end of the constant, in Sec. 6.4.4.2. The floating constant value is constructed by interpreting the representation.- Parameters:
source- the source information for the floating constantrepresentation- the way the floating constant actually appears in the program source code- Returns:
- the new floating constant node
- Throws:
SyntaxException- if the representation does not conform to the format specified in the C11 Standard
-
newEnumerationConstantNode
Constructs a new enumeration constant node. This represents an occurrence of an enumeration constant, i.e., a use of a previously declared enumerator, in the program. This node just wraps an identifier node. The source is same as that of identifier.- Parameters:
name- the identifier node which is the occurrence of the enumeration constant- Returns:
- the new enumeration constant node
-
newCompoundLiteralNode
CompoundLiteralNode newCompoundLiteralNode(Source source, TypeNode typeNode, CompoundInitializerNode initializerList) Returns a new compound literal node. A compound literal is a C construct used to represent a literal array, structure, or union value. Compound literals are described in the C11 Standard in Secs. 6.5.2.5 and 6.7.9. From Sec. 6.5.2, the syntax is:( type-name ) { initializer-list } ( type-name ) { initializer-list , }and from Sec. 6.7.9:initializer: assignment-expression { initializer-list } { initializer-list , } initializer-list: designationopt initializer initializer-list , designationopt initializer designation: designator-list = designator-list: designator designator-list designator designator: [ constant-expression ] . identifier- Parameters:
source- source information for the entire compound literal constructtypeNode- node representing the type name portion of the compound literalinitializerList- node representing the initializer list portion of the compound literal- Returns:
- the new compound literal node
-
newBooleanConstantNode
Constructs a new node representing a CIVL-C boolean constant, "$true" or "$false".- Parameters:
source- source information for the occurrence of the boolean constantvalue-truefor$true,falsefor$false- Returns:
- the new boolean constant node
-
newSelfNode
Constructs a new node representing an occurrence of the CIVL-C "self" process constant, written "$self".- Parameters:
source- source information for the occurrence of the constant$self- Returns:
- the new expression node representing the constant
-
newProcnullNode
Constructs a new node representing an occurrence of the CIVL-C "null process" constant, written$proc_null.- Parameters:
source- source information for the occurrence of the constant$proc_null- Returns:
- the new expression node representing the constant
-
newResultNode
Constructs a new node representing an occurrence of the CIVL-C expression "$result", used in function constracts to represent the result returned by the function.- Parameters:
source- source information for the occurrence of the expression$result- Returns:
- the new expression node
-
newIdentifierExpressionNode
Constructs a new identifier expression node. This is an expression node which just wraps an identifier. Identifiers can be used as expressions in various ways in C: a variable or the name of a function, for example. The source is not necessarily the same as the identifier because you might want to include surrounding parentheses in the expression.- Parameters:
identifier- the identifier node being wrapped- Returns:
- the new identifier expression node
-
newAlignOfNode
Constructs a new "align-of" node. This represents an occurrence of the C11 construct_Alignof(typename). See C11 Sec. 6.5.3.4. The value is considered an integer constant, i.e., it is known at compile-time.- Parameters:
source- source information for the occurrence of the expressiontype- the type name portion of the expression- Returns:
- the new align-of node
-
newCastNode
Constructs a new cast node. This represents an occurrence of a cast expression(typename)argument.- Parameters:
source- source information for the occurrence of the complete cast expressiontype- node representing the type nameargument- the argument part of the expression- Returns:
- the new cast node
-
newFunctionCallNode
FunctionCallNode newFunctionCallNode(Source source, ExpressionNode function, List<ExpressionNode> arguments, SequenceNode<ExpressionNode> scopeList) Constructs a new function call node. A function call in C is an expression (with side effects) that has the formf(arg0, arg1, ...).- Parameters:
source- source information for the occurrence of the entire function call expressionfunction- the expression of function type which evaluates to the function being called. Typically this is just an identifier expression (naming the function), but it can be a function pointer or any expression evaluating to a function type or pointer to function typearguments- the list of actual arguments to be evaluated and passed to the function in this function callscopeList- the optional scope list (to be deprecated)- Returns:
- the new function call node
-
newFunctionCallNode
FunctionCallNode newFunctionCallNode(Source source, ExpressionNode function, List<ExpressionNode> contextArguments, List<ExpressionNode> arguments, SequenceNode<ExpressionNode> scopeList) Constructs a new kernel function call node. A kernel function call in Cuda-C is an expression (with side effects) that has the formkernelFinvalid input: '<'invalid input: '<'invalid input: '<'cArg0, cArg1[, cArg2]>>>(arg0, arg1, ...). It represents the enqueueing of a kernel to execute on the Cuda device.- Parameters:
source- source information for the occurrence of the entire function call expressionfunction- the expression of function type which evaluates to the function being called. Typically this is just an identifier expression (naming the function), but it can be a function pointer or any expression evaluating to a function type or pointer to function typecontextArguments- the list of arguments passed as the execution context (appearing between invalid input: '<'invalid input: '<'invalid input: '<' and >>>) [It is only for CUDA programs]arguments- the list of actual arguments to be evaluated and passed to the function in this function callscopeList- the optional scope list (to be deprecated)- Returns:
- the new function call node
-
newGenericSelectionNode
GenericSelectionNode newGenericSelectionNode(Source source, ExpressionNode controllingExpression, ExpressionNode defaultExpression, SequenceNode<GenericAssociationNode> genericAssociationList) Constructs a new generic selection node, used to select an expression to evaluate at compile time based on the type of the controlling expression.- Parameters:
source- source information for the occurrence of the entire generic selection expressioncontrollingExpression- the (unevaluated) expression whose type determines which expression in the association list this generic selection expression evaluates todefaultExpression- the expression that this generic selection evaluates to if the type of the controlling expression is not compatible with any of the types in the association list. This may be null.genericAssociationList- the list of (non-default) associations between a typenode and an expression node- Returns:
- the new generic selection node
-
newGenericAssociationNode
GenericAssociationNode newGenericAssociationNode(Source source, TypeNode typeLabel, ExpressionNode associatedExpression) Constructs a new generic association node which acts as a binding between a type node and an expression for the purposes of a generic selection node- Parameters:
source- source information for the occurrence of this generic association nodetypeLabel- the type node which acts as a "key" for which a generic selection to determine whether to pick this association or notassociatedExpression- the expression associated with the type label that, if selected, will be evaluated- Returns:
- the new generic association node
-
newDotNode
Constructs a new node for a "dot" expression, used in C for structure or union field navigation, as inmyStruct.field.- Parameters:
source- source information for the occurrence of the entire dot expressionstructure- the expression of either structure or union typefieldName- an identifier which is the name of a field in the structure or union- Returns:
- the new dot expression node
-
newArrowNode
Constructs a new node for an "arrow" expression, used in C for structure or union field navigation starting from a pointer, as inmyStructPtr->field.- Parameters:
source- source information for the occurrence of the entire arrow expressionstructurePointer- the expression which has type of the form pointer-to-structure or pointer-to-unionfieldName- an identifier which is the name of a field in the structure or union- Returns:
- the new arrow expression node
-
newOperatorNode
OperatorNode newOperatorNode(Source source, OperatorNode.Operator operator, List<ExpressionNode> arguments) Constructs a new operator expression node using one of the standard operators provided in the enumerated type
OperatorNode.Operator.Some operators are not included in the enumerated type, and instead have their own special class, because they either need to implement an interface that not all operator expressions should implement (e.g., because they are left-hand-side expressions) or because they need to implement some methods that do not apply to all operator expressions. Hence the operator enumerated type includes only those operators that can be treated in a single, generic way.
- Parameters:
source- source information for the occurrence of the entire operator expression, including the operator itself and its argumentsoperator- the operatorarguments- the ordered list of arguments to the operator. For binary operators, the left operand comes first, followed by the right operator- Returns:
- the new operator expression node
-
newOperatorNode
OperatorNode newOperatorNode(Source source, OperatorNode.Operator operator, ExpressionNode argument) Convenience method for constructing new unary operator node; equivalent to invokingnewOperatorNode(Source, Operator, ExpressionNode)on the singleton list containingargument.- Parameters:
source- source information for the occurrence of the entire operator expression, including the operator itself and its argumentsoperator- the unary operatorargument- the sole argument to the operator- Returns:
- the new operator expression node
-
newOperatorNode
OperatorNode newOperatorNode(Source source, OperatorNode.Operator operator, ExpressionNode arg0, ExpressionNode arg1) Convenience method for constructing new binary operator node; equivalent to invokingnewOperatorNode(Source, Operator, ExpressionNode)on the list consisting ofarg0andarg1.- Parameters:
source- source information for the occurrence of the entire operator expression, including the operator itself and its argumentsoperator- the binary operatorarg0- the first argument to the binary operatorarg1- the second argument to the binary operator- Returns:
- the new operator expression node
-
newOperatorNode
OperatorNode newOperatorNode(Source source, OperatorNode.Operator operator, ExpressionNode arg0, ExpressionNode arg1, ExpressionNode arg2) Convenience method for constructing new ternary operator node; equivalent to invokingnewOperatorNode(Source, Operator, ExpressionNode)on the list consisting ofarg0,arg1, andarg2.- Parameters:
source- source information for the occurrence of the entire operator expression, including the operator itself and its argumentsoperator- the ternary operatorarg0- the first argument to the ternary operatorarg1- the second argument to the ternary operatorarg2- the third argument to the ternary operator- Returns:
- the new operator expression node
-
newSizeofNode
Constrcts a newsizeofexpression. This takes one argument, which can be either a type name or an expression.- Parameters:
source- source information for the occurrence of the entiresizeofexpression, including the argumentargument- the argument to thesizeofoperator- Returns:
- the new expression node
-
newSpawnNode
Constructs a new CIVL-C spawn expression. A spawn expression has the form$spawnfollowed by a function call expression. Hence a spawn node has one argument, which is a function call node.- Parameters:
source- source information for the occurrence of the entire$spawnexpression, including the entire function callcallNode- the function call node- Returns:
- the new spawn expression node
-
newRemoteOnExpressionNode
RemoteOnExpressionNode newRemoteOnExpressionNode(Source source, ExpressionNode left, ExpressionNode right) Constructs a remote expression node, representing an expression of the formproc_expr@x. This refers to a variable in the processpreferenced by the expressionproc_expr. The static variablexcan be determined statically now. Later it will be evaluated in a dynamic state inp's context.- Parameters:
source- source information for the entire remove expression, including both argumentsleft- the left argument, which is an expression of integer type.right- the right argument, which is a foreign expression that will evaluates on the process represented by the left expression.
-
newScopeOfNode
Constructs a new CIVL-C$scopeofexpression node. This is an expression which takes one argument, which is a variable expression. It returns a reference to the dynamic scope (a value of type$scope) containing the memory unit identified by that variable.- Parameters:
source- source information for the entire$scopeofexpressionvariableExpression- the variable argument- Returns:
- the new
$scopeofexpression
-
newQuantifiedExpressionNode
QuantifiedExpressionNode newQuantifiedExpressionNode(Source source, QuantifiedExpressionNode.Quantifier quantifier, SequenceNode<PairNode<SequenceNode<VariableDeclarationNode>, ExpressionNode>> boundVariableDeclarationList, ExpressionNode restriction, ExpressionNode expression, SequenceNode<PairNode<ExpressionNode, ExpressionNode>> intervalSequence) Constructs a new quantified expression.- Parameters:
source- The source code information for the entire expressionquantifier- The quantifier, one of (1)QuantifiedExpressionNode.Quantifier.EXISTS, the standard existential quantifier, (2)QuantifiedExpressionNode.Quantifier.FORALL, the standard universal quantifier, or (3)QuantifiedExpressionNode.Quantifier.UNIFORM, the CIVL-C quantifier representing a uniform universal conditionboundVariableDeclarationList- The list of bound variable declarations.restriction- A boolean-valued expression that holds true when the quantified variables is in the domainexpression- The quantified expression.intervalSequence- field for the$uniformoperator---a sequence of real closed intervals that specify the domain of uniform convergence of a big-O expression; may benull- Returns:
- The new quantified expression with the given children.
-
newArrayLambdaNode
ArrayLambdaNode newArrayLambdaNode(Source source, TypeNode type, SequenceNode<PairNode<SequenceNode<VariableDeclarationNode>, ExpressionNode>> boundVariableDeclarationList, ExpressionNode restriction, ExpressionNode expression) Constructs a new array lambda expression.- Parameters:
source- The source code information for the entire expressiontype- the type of this array lambdaboundVariableDeclarationList- The list of bound variable declarations.restriction- A boolean-valued expression that holds true when the quantified variables is in the domainexpression- The body-expression- Returns:
- The new array lambda expression with the given children.
-
newArrayLambdaNode
ArrayLambdaNode newArrayLambdaNode(Source source, TypeNode type, List<VariableDeclarationNode> boundVariableDeclarationList, ExpressionNode restriction, ExpressionNode expression) Constructs a new array lambda expression.- Parameters:
source- The source code information for the entire expressiontype- the type of this array lambdaboundVariableDeclarationList- The list of bound variable declarations.restriction- A boolean-valued expression that holds true when the quantified variables is in the domainexpression- The body-expression- Returns:
- The new array lambda expression with the given children.
-
newLambdaNode
LambdaNode newLambdaNode(Source source, VariableDeclarationNode boundVariableDeclaration, ExpressionNode expression) Constructs a new lambda expression with a free (no restriction on the bound variable) variable.- Parameters:
source- The source code information for the entire expressionboundVariableDeclaration- The bound variable declaration.expression- The body-expression- Returns:
- The new array lambda expression with the given children.
-
newLambdaNode
LambdaNode newLambdaNode(Source source, VariableDeclarationNode boundVariableDeclaration, ExpressionNode restriction, ExpressionNode expression) Constructs a new lambda expression with restriction on the bound variable.- Parameters:
source- The source code information for the entire expressionboundVariableDeclaration- The bound variable declaration.restriction- A boolean restriction on the bound variableexpression- The body-expression- Returns:
- The new array lambda expression with the given children.
-
newDerivativeExpressionNode
DerivativeExpressionNode newDerivativeExpressionNode(Source source, ExpressionNode function, SequenceNode<PairNode<IdentifierExpressionNode, IntegerConstantNode>> partials, SequenceNode<ExpressionNode> arguments) Constructs a new CIVL-C derivative expression, used to represent the (partial) derivative of a function with respect to any number of variables, evaluated at a point.- Parameters:
source- The source code elements.function- The abstract function whose derivative is being taken.partials- The list of partial derivatives.arguments- The arguments to the uninterpreted function evaluation.- Returns:
- The new derivative expression with the given children.
-
newRegularRangeNode
Constructs a new CIVL-C regular range expression, which has the form
lo .. hi, whereloandhiare integer expressions. A range expression represents an (ordered) set of integers. This expression represents the set of integers that are greater than or equal toloand less than or equal tohi. The order is from lowest to highest.See
newRegularRangeNode(Source, ExpressionNode, ExpressionNode, ExpressionNode)for the more general expression which permits a "step" to be specified. The expression returned by this method is equivalent to using a step of 1.- Parameters:
source- source information for the entire expressionlow- the lower bound of the range (inclusive)high- the upper bound of the range (inclusive)- Returns:
- the new range expression
-
newRegularRangeNode
RegularRangeNode newRegularRangeNode(Source source, ExpressionNode low, ExpressionNode high, ExpressionNode step) Constructs a new CIVL-C regular range expression, which has the form
lo .. hi # step, wherelo,hi, andstepare all integer expressions.A range expression represents an (ordered) set of integers. If
stepis positive, this expression represents the set of integerslo,lo+step,lo+2*step, and so on, up to and possibly includinghi. That is also the order.If
stepis negative, this represents the ordered set of integershi,hi+step,hi+2*step, and so on, down to and possibly includinglo. That is also the order.- Parameters:
source- source information for the entire expressionlow- the lower bound of the range (inclusive)high- the upper bound of the range (inclusive)step- the step, i.e., the (positive or negative) distance between two consecutive elements in the range- Returns:
- the new range expression
-
newVariableDeclarationNode
VariableDeclarationNode newVariableDeclarationNode(Source source, IdentifierNode name, TypeNode type) Creates a new declaration of an "object" variable with no initializer.- Parameters:
source- the source information for the variable declarationname- the identifier node corresponding to the name of the variable in its declarationtype- the node corresponding to the type in the declaration- Returns:
- the new variable declaration node with the given chidren
-
newVariableDeclarationNode
VariableDeclarationNode newVariableDeclarationNode(Source source, IdentifierNode name, TypeNode type, InitializerNode initializer) Creates a new declaration for an "object" variable with an initializer.- Parameters:
name- identifier being declaredtype- the typeinitializer- optional initializer (for variables only) or null- Returns:
- a new declaration for an "ordinary identifier"
-
newFunctionDeclarationNode
FunctionDeclarationNode newFunctionDeclarationNode(Source source, IdentifierNode name, TypeNode type, SequenceNode<ContractNode> contract) Creates a new function declaration with no body (so it is not a function "definition").- Parameters:
source- source information for this declarationname- the identifier node for the name of this functiontype- node representing the type of the functioncontract- sequence of contract elements ornull- Returns:
- the new function declaration node formed from given children
-
newEnumeratorDeclarationNode
EnumeratorDeclarationNode newEnumeratorDeclarationNode(Source source, IdentifierNode name, ExpressionNode value) Creates new declaration of an enumerator, which is an element inside of a Cenumdefinition. An enumerator declaration always contains an identifier, and may or may not contain an optional integer value.- Parameters:
source- source information for the entire enumerator declaration, including the value node if presentname- the identifier which is the name of the enumeratorvalue- the (optional) value to be assigned to this enumerator; if absent, usenull- Returns:
- the new enumerator declaration
-
newFieldDeclarationNode
Consructs a new field declaration node. A field declaration occurs inside astructoruniondefinition in C. This declaration is similar to an ordinary variable declaration.- Parameters:
source- source information for the entire field declarationname- the identifier which is the name of the field being declaredtype- the type of the field- Returns:
- the new field declaration node
-
newFieldDeclarationNode
FieldDeclarationNode newFieldDeclarationNode(Source source, IdentifierNode name, TypeNode type, ExpressionNode bitFieldWidth) Consructs a new field declaration node which also includes a "bit width" argument. A field declaration occurs inside astructoruniondefinition in C. This declaration is similar to an ordinary variable declaration, but may include a bit width parameter.- Parameters:
source- source information for the entire field declarationname- the identifier which is the name of the field being declaredtype- the type of the fieldbitFieldWidth- the constant expression of integer type which specifies the number of bits in the field- Returns:
- the new field declaration node
-
newStandardLabelDeclarationNode
OrdinaryLabelNode newStandardLabelDeclarationNode(Source source, IdentifierNode name, StatementNode statement) Creates a new node representing a standard C label. An ordinary label is an identifier preceding a colon then a statement. It can be used as the target of a
gotostatement.A label declaration node has one child: an identifier node which is the name of the label. Note in particular that the statement (following the colon) is not a child of the label declaration node. The declaration node does contain a reference to that statement, but it is not a child, since both the label declaration and the statement will be children of a
LabeledStatementNode. If the statement were a child of the label declaration node, the AST would not be a tree.The standard protocol for constructing a labled statement is as follows: first, construct the ordinary statement
S. Then construct the label declaration nodeLusing this method, usingSas thestatementargument. Finally, create a newLabeledStatementNodeusing methodnewLabeledStatementNode(Source, LabelNode, StatementNode)with argumentsLandS.- Parameters:
source- source information for the label only (not the statement that follows)name- the name of the labelstatement- the statement that follows the label and colon- Returns:
- the new label declaration node
-
newCaseLabelDeclarationNode
SwitchLabelNode newCaseLabelDeclarationNode(Source source, ExpressionNode constantExpression, StatementNode statement) Constructs a new case-labeled declaration node. This node represents a C construct of the formcase expr :which precedes a statement inside aswitchstatement body.- Parameters:
source- source information spanning thecaseandexprtokensconstantExpression- the expressionexprfollowingcase; must be a constant expression whose type is consistent with that of the argument toswitchstatement- the statement following the colon; that statement is not made a child of this node- Returns:
- the new case-labeled declaration node
-
newDefaultLabelDeclarationNode
Constructs a new node representing the occurence of adefault :label inside of aswitchstatement body.- Parameters:
source- the source information spanning thedefaulttokenstatement- the statement following the colon; this is not made a child of the new switch label node- Returns:
- the new switch label node
-
newTypedefDeclarationNode
Constructs a newtypedefdeclaration node. If the typedef was scope parameterized, the type argument will be a ScopeParameterizedTypeNode.- Parameters:
source- source code referencename- the name of the typedef as an IdentifierNodetype- the type node being bound to the identifier (this may be scope parameterized)- Returns:
- a new typedef declaration node
-
newCompoundInitializerNode
CompoundInitializerNode newCompoundInitializerNode(Source source, List<PairNode<DesignationNode, InitializerNode>> initList) Constructs new compound initializer node. A compound initializer in C is used to initialize an array or structure. It occurs inside curly braces. It consists of a list of designation-initializer pairs; each designation represents a "point" inside the structure or array; the initializer specifies a value to assign to that point. The definition is recursive, since the initializer in a pair may be a compound initializer.
A designation in pair may be
null. In this case the "point" is obtained by rules specified in the C Standard, essentially by increment one past the last point.- Parameters:
source- source information spanning the entire compound initializer, from the opening curly brace to the closing curly braceinitList- the list of designation-initializer pairs.- Returns:
- the new compound initializer nodes
-
newDesignationNode
Creates a new designation node, which can be used as part of a compound initializer. A designation consists of a sequence of designators. The designator sequence describes how to navigate to a particular point inside a complex structure or array.- Parameters:
source- source information spanning the entire designationdesignators- the sequence of designators- Returns:
- the new designation node
-
newFieldDesignatorNode
Constructs a new field designator node. A field designator is a designator (used as part of a designation, which is part of a compound initializer) which represents navigation to a particular field in a structure or union. It essentially wraps a field name.- Parameters:
source- source information spanning this field designatorname- the identifier which is the name of the field- Returns:
- the new field designator node
-
newArrayDesignatorNode
Constructs a new array designator node. An array designator is a designator (used as part of a designation, which is part of a compound initializer) which represents navigation to a particular element of an array. It essentially wraps an integer expression, which specifies an index.- Parameters:
source- source information spanning the array designatorindex- the integer expression specifying an index into the array- Returns:
- the new array designator node
-
newCompoundStatementNode
Constructs a new compound statement node. This is designated in C as{ s1; s2; ...}, where eachsi is a block item (e.g., a statement, a declaration, or any other instance of.invalid reference
BlockItermNode- Parameters:
source- source information encompassing the entire compound statement, from the opening curly brace to the closing curly braceitems- the list of block items comprising the compound statement- Returns:
- the new compound statement node
-
newExpressionStatementNode
Constructs a new expression statement node. This is a statement which wraps an expression. The source is the same as that of the expression.- Parameters:
expression- the expression node- Returns:
- the new expression statement node wrapping that expression
-
newNullStatementNode
Constructs a new node representing a C "null" statement, also known as a "no-op" statement, and written as just a semicolon.- Parameters:
source- source specification encompassing the single semicolon character- Returns:
- the new null statement node
-
newForLoopNode
ForLoopNode newForLoopNode(Source source, ForLoopInitializerNode initializer, ExpressionNode condition, ExpressionNode incrementer, StatementNode body, SequenceNode<ContractNode> contracts) Constructs a newforloop node.- Parameters:
source- source information for the entire loop construct (including body)initializer- the initializer part of theforloop, anor another instance ofinvalid reference
ExpressionForLoopInitializerNode, such as one produced from a list of delcarations; may benullcondition- the condition part of theforloopincrementer- the incrementer part of theforloopbody- the body of theforloopinvariant- loop invariant: may benull- Returns:
- the new
forloop node
-
newForLoopInitializerNode
DeclarationListNode newForLoopInitializerNode(Source source, List<VariableDeclarationNode> declarations) Construcs a new declaration list node, which is comprised of a sequence of variable declarations. Such a node can be used as the initializer part of aforloop, or as the variable list part of a CIVL-C$foror$parforstatement.- Parameters:
source- source specification encompassing the entire list of declarationsdeclarations- list of variable declarations- Returns:
- the new declaration list node
-
newWhileLoopNode
LoopNode newWhileLoopNode(Source source, ExpressionNode condition, StatementNode body, SequenceNode<ContractNode> contracts) Constructs a new node representing awhileloop. This is representedwhile (cond) bodyin C, but may also have an optional CIVL-C loop invariant.- Parameters:
source- source specification spanning the entire loop and all its components, including the invariant (if present) and the bodycondition- the boolean expression which determines whether control stays in the loopbody- the loop body, a statementinvariant- a boolean expression which is a loop invariant; may benull- Returns:
- the new
whileloop node
-
newDoLoopNode
LoopNode newDoLoopNode(Source source, ExpressionNode condition, StatementNode body, SequenceNode<ContractNode> contracts) Constructs a new node representing ado...whileloop. This is represented in C asdo body while (cond). This kind of loop guarantees that the body will be executed at least once, as the condition is checked after each execution of the body, rather than before. Otherwise it is the same as awhileloop.- Parameters:
source- source specification spanning the entire loop, including the body, the invariant, and the conditioncondition- the boolean condition which determines whether control should return to the top of the loop bodybody- the loop bodyinvariant- an optional boolean expression loop invariant which may be associated to this node; may benull- Returns:
- the new
doloop node - See Also:
-
newGotoNode
Constructs a new node representing agotostatement.- Parameters:
source- source specification spanning the wholegotostatement, including the labellabel- identifier which is the name of the label to which control should "go"- Returns:
- the new
gotonode
-
newIfNode
Creates newifstatement node when there is no false ("else") branch.- Parameters:
source- source specification spanning the entire statement, including the entire "true" branchcondition- the condition expressiontrueBranch- the body of theifstatement- Returns:
- the new
ifstatement node formed from given children
-
newIfNode
IfNode newIfNode(Source source, ExpressionNode condition, StatementNode trueBranch, StatementNode falseBranch) Creates a newifstatement node. False branch may be null if there is no "else" clause.- Parameters:
source- source specification spanning the entire statement, including both branches in their entiretycondition- the branch conditiontrueBranch- the statement for the "true" branchfalseBranch- the statement for the "false" branch- Returns:
- the new
ifstatement node
-
newContinueNode
Creates a new node representing the Ccontinuestatement, used in a loop body to direct control to the next loop iteration.- Parameters:
source- source specification for thecontinuetoken- Returns:
- the new new
continuenode
-
newBreakNode
Creates a new node representing the Cbreakstatement, used in a loop orswitchbody to direct control to the location just after the loop orswitchconstruct.- Parameters:
source- source specification for thebreaktoken- Returns:
- the new new
breaknode
-
newReturnNode
Creates a newreturnstatement node. Argument may benull.- Parameters:
argument- the expression being returned ornullif there is none- Returns:
- the new
returnstatement node
-
newLabeledStatementNode
LabeledStatementNode newLabeledStatementNode(Source source, LabelNode label, StatementNode statement) Constructs new node representing a labeled statement. The label and the statement being labeled must be constructed first, then used as arguments to this method.- Parameters:
source- source specification spanning the entire labeled statement, including the label and the statement being labeledlabel- the node representing the labelstatement- the statement to be labeled- Returns:
- the new labeled statement node
- See Also:
-
newSwitchNode
Constructs a new node representing a Cswitchstatement. Theswitchbody must be created first, and this body includes all the case-labeled statements (andbreakstatements) required. Theconditionmust have a type appropriate for aswichstatement, such as an integer type.- Parameters:
source- source specification spanning the entireswitchstatement, including the entire bodycondition- the expression that is evaluated to determine which case to switch tobody- the body of theswitchstatement- Returns:
- the new
switchstatement node
-
newCivlForNode
CivlForNode newCivlForNode(Source source, boolean isParallel, DeclarationListNode variables, ExpressionNode domain, StatementNode body, SequenceNode<ContractNode> loopContract) Creates a new instance of the CIVL$foror$parfornode.- Parameters:
source- source information for the entire loop construct (including body)isParallel- iftruecreate a$parforstatement, else create a$forstatementvariables- the list of loop variables or variable declsdomain- the expression of domain type defining the iteration domain; the dimension of the domain must equal the number of loop variablesbody- the body of the loop statementloopContract- optional loop contracts node- Returns:
- the new node
-
newWhenNode
Creates a new node representing a CIVL-C$whennode, used to represent a guarded command. Such a statement blocks until the guard istrue. Note that only the first atomic sub-statement of the statement body is guaranteed to execute atomically with the evaluation totrueof the guard.- Parameters:
source- source specification spanning the entire$whenstatement, including the guard and the entire bodyguard- a boolean expression which determines when the statement is enabledbody- a statement that may be executed once the guard holds- Returns:
- the new
$whenstatement node
-
newChooseStatementNode
Constructs a new node representing a CIVL-C$choosestatement. This statement has the form$choose { $when (g1) s1 $when (g2) s2 ... }The statement is used to specify a nondeterministic choice. Whenever control is at the$chooselocation, the guardsg1,g2, etc., are evaluated. Each that evaluates to true specifies one enabled transition. If none are enabled, the entire statement blocks. The order of these clauses is irrelevant.- Parameters:
source- source specification spanning the entire$choosestatement, including the entire bodystatements- the guarded commands which form the clauses of the$choosestatement- Returns:
- the new
$choosestatement node
-
newStaticAssertionNode
StaticAssertionNode newStaticAssertionNode(Source source, ExpressionNode expression, StringLiteralNode message) Creates a new C11 static assertion node. A static assertion is an assertion which is checked at compile time. The syntax is_Static_assert(expr, message)
- Parameters:
source- source specification spanning the entire static assertion statementexpression- the integer constant expression which, if it evaluates to 0, yields an assertion violation. Note that the boolean type_Boolis an integer type in C, so a value of this type may be used.message- the message to be printed if the assertion is violated- Returns:
- the new static assertion node
-
newPragmaNode
PragmaNode newPragmaNode(Source source, IdentifierNode identifier, CivlcTokenSequence producer, CivlcToken newlineToken) Constructs a new pragma node, representing a C#pragmadirective. The pragma is left uninterpreted in this representation. The first token following the#pragmamust be an identifier, this identifier has a special role as it specifies a pragma domain, such asomp(for OpenMP). The remainder of the pragma is represented as a sequence of raw tokens. These can be parsed interpreted at a later stage of processing. Finally, every pragma must be terminated by the first newline character encountered, and the token for that newline is also specified.- Parameters:
source- source specification spanning the entire pragma line, from the#pragmaup to and including thenewline.identifier- the first token after the#pragmatoken specifying the pragma domain (e.g.,omp)producer- a producer for producing newCivlcTokenSourceobjects which are essentially iterators over the tokens comprising the body, i.e., the sequence of tokens comprising the rest of the pragma body after the identifier, and not including the newlinenewlineToken- the newlinen token at the end of the pragma- Returns:
- the new pragma node
-
newRequiresNode
Constructs a new node representing a CIVL-C$requirescontract clause. This is used to specify a pre-condition for a function. It is currently not used.- Parameters:
source- source specification spanning the entire$requiresclause, including the entire expressionexpression- the boolean expression which specifies a pre-condition- Returns:
- the new
$requiresclause node
-
newEnsuresNode
Constructs a new node representing a CIVL-C$ensurescontract clause. This is used to specify a post-condition for a function. It is currently not used.- Parameters:
source- source specification spanning the entire$ensuresclause, including the entire expressionexpression- the boolean expression which specifies a post-condition- Returns:
- the new
$ensuresclause node
-
newDependsNode
DependsNode newDependsNode(Source source, ExpressionNode condition, SequenceNode<DependsEventNode> eventList) Constructs a new node representing a CIVL-C$dependscontract clause. This is used to specify the dependency relationship between processes for a function.- Parameters:
source- source specification spanning the entire$dependsclause, including the entire expressionexpression- the boolean expression which specifies a condition of dependency- Returns:
- the new
$dependsclause node
-
newGuardNode
Constructs a new node representing a CIVL-C$guardcontract clause. This is used to specify the guard of a function.- Parameters:
source- source specification spanning the entire$guardclause, including the entire expressionexpression- the boolean expression which specifies the the guard- Returns:
- the new
$guardclause node
-
newAssignsNode
Constructs a new node representing an ACSLassignscontract clause.- Parameters:
source- source specification spanning the entire$assignsclause, including the entire expressionexpressionList- the expression list which specifies the memory units associated with theassignsclause- Returns:
- the new
assignsclause node
-
newReadsNode
Constructs a new node representing an ACSLreadscontract clause.- Parameters:
source- source specification spanning the entirereadsclause, including the entire expressionexpressionList- the expression list which specifies the memory units associated with thereadsclause- Returns:
- the new
readsclause node
-
newFunctionDefinitionNode
FunctionDefinitionNode newFunctionDefinitionNode(Source source, IdentifierNode name, FunctionTypeNode type, SequenceNode<ContractNode> contract, CompoundStatementNode body) Constructs a new node representing a function definition, i.e., a function declaration with body.- Parameters:
source- source specification spanning the entire function definition, including the entire function bodyname- the identifier which is the name of the function being definedtype- the type of the function; note that a function type comprises a return type and some sequence of input typescontract- the (optional) function contract; may benullbody- the function body- Returns:
- the new function definition node
-
newAbstractFunctionDefinitionNode
AbstractFunctionDefinitionNode newAbstractFunctionDefinitionNode(Source source, IdentifierNode name, TypeNode type, SequenceNode<ContractNode> contract, int continuity, SequenceNode<PairNode<ExpressionNode, ExpressionNode>> intervals, StringLiteralNode attr) Creates a new CIVL abstract function definition. An abstract function is an unspecified mathematical function. In particular, if x1=y1 and ... and xn=yn then f(x1,...,xn)=f(y1,...,yn). In other words, the value "returned" by f is a deterministic function of its inputs. In cannot depend on any other variables values in the program, or other parts of the state. As a special case, note that if n=0, then f() is essentially a constant. In fact, the case n=0 is not allowed: if you want a constant, create instead an input variable ($input).- Parameters:
source- The source information for the abstract function definition.name- The name of the abstract function.type- The function type with the appropriate parameters and return type.contract- Any code contract associated with the function.continuity- The number of derivatives that may be taken; this applies to real valued functions of real variables onlyintervals- sequence of intervals whose Cartesian product specifies the domain on which this function is differentiable to the specified degreeattr- nullable. The optional string literal representing the attribute attached to this abstract function.- Returns:
- An abstract function definition with the specified properties.
-
newTranslationUnitNode
Creates a new node representing an entire translation unit. The children of this node will be external definitions.- Parameters:
source- source specification spanning the entire translation unit, which is typically the entire token sequence emanating from the preprocessordefinitions- the list of external definitions which form the children of the translation unit- Returns:
- the new translation unit node
-
newProgramNode
Creates a new node representing an entire program. The children of this node will be external definitions.- Parameters:
source- source specification for the whole program; typically a "fake" sourcedefinitions- the list of external definitions which form the children of the new node; typically obtained by concatenating those from the translation units, perhaps after some modifications- Returns:
- the new program node
-
getValueFactory
ValueFactory getValueFactory()Returns the value factory associated to this node factory. The value factory is used to reason about constants and constant expressions in a program.- Returns:
- the value factory
-
newAtomicStatementNode
Creates a new CIVL-C$atomicstatement node.- Parameters:
statementSource- source specification spanning the entire statement, including the bodybody- The body statement node of the atomic node- Returns:
- The new atomic statement node
-
newHereNode
Creates a new constant expression node representing$here.- Parameters:
source- The source code element of the new node- Returns:
- a new constant expression node representing
$here
-
newRootNode
Creates a new constant expression node representing$root.- Parameters:
source- The source code element of the new node- Returns:
- a new constant expression node representing
$root
-
newScopeOfNode
Creates a new expression node representing$scopeof(expr).- Parameters:
source- The source code element of the new node.argument- The argument of the$scopeof(expr)expression.- Returns:
- a new constant expression node representing
$here
-
newOmpParallelNode
Creates a new OpenMP parallel node, representing#pragma omp parallel.... The clauses of the node can be updated by calling the corresponding setters, e.g, setStatementNode(), setPrivateList(), etc.- Parameters:
source- The source code element of the new node.statement- The statement node of the parallel construct.- Returns:
- The new OpenMP parallel statement node created.
-
newOmpForNode
Creates a new OpenMP for node, representing#pragma omp for.... The clauses of the node can be updated by calling the corresponding setters, e.g, setStatementNode(), setPrivateList(), etc.- Parameters:
source- The source code element of the new node.statement- The statement node of the parallel construct.- Returns:
- The new OpenMP for node created.
-
newOmpMasterNode
Creates a new OpenMP master node, representing#pragma omp master.... A master node has exactly one child node, i.e., the statement node corresponding to the block affected by the master construct. The syntax of the master construct is:
#pragma omp master new-line
structured-block- Parameters:
source- The source code element of the new node.statement- The statement node of the master construct.- Returns:
- The new OpenMP master node created.
-
newOmpAtomicNode
OmpSyncNode newOmpAtomicNode(Source source, StatementNode statement, OmpAtomicNode.OmpAtomicClause clause, boolean seqConsistent) Creates a new OpenMP atomic node, representing#pragma omp atomic.... An atomic node has exactly one child node, i.e., the statement node corresponding to the block affected by the atomic construct. The syntax of the atomic construct is:
#pragma omp atomic new-line
structured-block- Parameters:
source- The source code element of the new node.statement- The statement node of the master construct.clause- the atomic clause associated with this atomic construct, either "read", "write", "update" or "capture". Absent of clause means "update"seqConsistent- true if this atomic construct is sequentially consistent- Returns:
- The new OpenMP atomic node created.
-
newOmpCriticalNode
Creates a new OpenMP critical node, representing#pragma omp critical.... A critical node has at most two children the name of the critical section and the statement node corresponding to the block affected by the critical construct. The syntax of the critical construct is:
#pragma omp critical [(name)] new-line
structured-block- Parameters:
source- The source code element of the new node.name- The name of the critical section.statement- The statement node of the critical construct.- Returns:
- The new OpenMP critical node created.
-
newOmpBarrierNode
Creates a new OpenMP barrier node, representing#pragma omp barrier.... A barrier node has NO child node. The syntax of the barrier construct is:
#pragma omp barrier new-line- Parameters:
source- The source code element of the new node.- Returns:
- The new OpenMP barrier node created.
-
newOmpFlushNode
Creates a new OpenMP flush node, representing#pragma omp flush.... A flush node has at most one child node: the list of variables of the flush operation. The syntax of the flush construct is:
#pragma omp flush [(list)] new-line- Parameters:
source- The source code element of the new node.variables- The list of variables of the flush operation.- Returns:
- The new OpenMP flush node created.
-
newOmpFlushNode
Creates a new OpenMP flush node with no variable list- Parameters:
source- The source code element of the new node.- Returns:
- The new OpenMP flush node created.
-
newOmpOrederedNode
Creates a new OpenMP ordered node, representing#pragma omp ordered.... An ordered node has exactly one child node, i.e., the statement node corresponding to the block affected by the ordered construct. The syntax of the ordered construct is:
#pragma omp ordered new-line
structured-block- Parameters:
source- The source code element of the new node.statement- The statement node of the ordered construct.- Returns:
- The new OpenMP ordered node created.
-
newOmpSectionsNode
Creates a new OpenMP sections node, representing#pragma omp sections.... The clauses of the node can be updated by calling the corresponding setters, e.g, setStatementNode(), setPrivateList(), etc.- Parameters:
source- The source code element of the new node.statement- The statement node of the ordered construct.- Returns:
- The new OpenMP sections statement node created.
-
newOmpSectionNode
Creates a new OpenMP section node, representing#pragma omp section.... A section node has exactly one child node, i.e., the statement node corresponding to the block affected by the section construct. The syntax of the section construct is:
#pragma omp section new-line
structured-block- Parameters:
source- The source code element of the new node.statement- The statement node of the section construct.- Returns:
- The new OpenMP section node created.
-
newOmpSingleNode
Creates a new OpenMP single node, representing#pragma omp single.... The syntax of the single construct is as follows:
#pragma omp single [clause[[,] clause] ...] new-line
structured-block
where clause is one of the following:
private(list)
firstprivate(list)
copyprivate(list)
nowait- Parameters:
source- The source code element of the new node.statement- The statement node of the section construct.- Returns:
- The new OpenMP single node created.
-
newOmpSimdNode
Creates a new OpenMP simd node, representing#pragma omp simd.... The syntax of the simd directive is as follows:
#pragma omp simd [clause[[,] clause] ...] new-line
structured-block
where clause is one of the following:
safelen
simdlen
private(list)
firstprivate(list)
copyprivate(list)
nowait- Parameters:
source- The source code element of the new node.statement- The statement node of the simd construct.- Returns:
- The new OpenMP simd node created.
-
newOmpThreadprivateNode
OmpDeclarativeNode newOmpThreadprivateNode(Source source, SequenceNode<IdentifierExpressionNode> variables) Creates a new OpenMP threadprivate node.- Parameters:
source- The source code element of the new node.variables- The list of variables declared by the clause.- Returns:
- The new OpenMP threadprivate node created.
-
newOmpFortranEndNode
FORTRAN ONLY
Creates a new OpenMP END node with its type, which indicates what previous OpenMP executable struct should end.- Parameters:
source- The source code element of the new node.endType- The end type of the new END node.- Returns:
- The new OpenMP END node created.
-
newOmpSymbolReductionNode
OmpSymbolReductionNode newOmpSymbolReductionNode(Source source, OmpReductionNode.OmpReductionOperator operator, SequenceNode<IdentifierExpressionNode> variables) Creates a new OpenMP reduction node with a standard operator.- Parameters:
source- The source code element of the new node.operator- TheOmpReductionNode.OmpReductionOperatorof the reduction node.variables- The variables of the reduction clause.- Returns:
- The new OpenMP reduction node.
-
newOmpFunctionReductionNode
OmpFunctionReductionNode newOmpFunctionReductionNode(Source source, IdentifierExpressionNode function, SequenceNode<IdentifierExpressionNode> variables) Creates a new OpenMP reduction node with an identifier operator (i.e., function names).- Parameters:
source- The source code element of the new node.function- The name of the function of the reduction node.variables- The variables of the reduction clause.- Returns:
- The new OpenMP reduction node.
-
newWorksharingNode
OmpWorksharingNode newWorksharingNode(Source source, OmpWorksharingNode.OmpWorksharingNodeKind kind) Creates a new OpenMP worksharing node with a specific kind. The kind could be:- SECTIONS
- SINGLE
- SECTION
- FOR
- Parameters:
source- The source code element of the new node.kind- The kind of the worksharing node, either FOR, SECTIONS, SECTION or SINGLE.- Returns:
- The new OpenMP worksharing node.
-
configuration
Configuration configuration()gets the configuration associated with this translation task.- Returns:
- the configuration associated with this translation task.
-
newWildcardNode
creates a new wildcard (...) node.- Parameters:
source-- Returns:
-
newStatementExpressionNode
creates a new statement expression node (GNU C extension).- Parameters:
source- the source of the nodestatement- the statement enclosed by the expression excluding the expression at end- Returns:
- the new statement expression node (GNU C extension)
-
newTypeofNode
creates a new typeof node (GNU C extension)- Parameters:
source-expression-- Returns:
-
newMemoryEventNode
MemoryEventNode newMemoryEventNode(Source source, MemoryEventNode.MemoryEventNodeKind kind, SequenceNode<ExpressionNode> memoryList) creates a new memory event node, which could be either\read,writeorreach.- Parameters:
source-kind-memoryList-- Returns:
-
newOperatorEventNode
CompositeEventNode newOperatorEventNode(Source source, CompositeEventNode.EventOperator op, DependsEventNode left, DependsEventNode right) creates a new composite event node, which is composed by two events node and an operator.- Parameters:
source-op-left-right-- Returns:
-
newNothingNode
creates a\nothingnode which represents an empty set of memory units.- Parameters:
source-- Returns:
-
newBehaviorNode
creates a behavior node. (ACSL contract)- Parameters:
source-name-body-- Returns:
-
newCompletenessNode
CompletenessNode newCompletenessNode(Source source, boolean isComplete, SequenceNode<IdentifierNode> idList) creates a completeness clause node, which could becompleteordisjoint- Parameters:
source-isComplete- true if to create a complete clause node, otherwise, a disjoint clause nodeidList-- Returns:
-
newAssumesNode
Creates a newassumesclause node- Parameters:
source-predicate-- Returns:
-
newInvariantNode
Creates a newinvariantclause node- Parameters:
source-expression-- Returns:
-
newNoactNode
Creates a new\noactevent node- Parameters:
source-- Returns:
-
newAnyactNode
Creates a new\anyactevent node- Parameters:
source-- Returns:
-
newCallEventNode
CallEventNode newCallEventNode(Source source, IdentifierExpressionNode function, SequenceNode<ExpressionNode> args) Creates a new\callevent node- Parameters:
source-function-args-- Returns:
-
typeFactory
TypeFactory typeFactory()Returns a reference to aTypeFactory- Returns:
-
newUpdateNode
Create a newUpdateNode- Parameters:
source- TheSourceattached to the $update expressioncollator- The expression has the $collator typecall- TheFunctionCallNodeattached with this expression.- Returns:
- A new
UpdateNode
-
newRunNode
Create a newRunNode -
newObjectofNode
Creates a new$object_ofnode- Parameters:
source- the source of the$object_ofnodeoperand- the operand of the$object_ofnode, which shall have pointer type- Returns:
- the new
$object_ofnode
-
newRegionofNode
Creates a new$region_ofnode- Parameters:
source- the source of the$region_ofnodeoperand- the operand of the$region_ofnode, which shall have pointer type- Returns:
- the new
$region_ofnode
-
newAllocationNode
AllocationNode newAllocationNode(Source source, boolean isAllocates, SequenceNode<ExpressionNode> memoryList) Creates a new allocation node, which represents either anallocatesorfreesclause.- Parameters:
source- the source of the allocation clauseisAllocates- true if this is anallocatesclause, otherwise, afreesclausememoryList- the list of memory units of the allocation clause- Returns:
- the new allocation node
-
newExtendedQuantifiedExpressionNode
ExtendedQuantifiedExpressionNode newExtendedQuantifiedExpressionNode(Source source, ExtendedQuantifiedExpressionNode.ExtendedQuantifier quant, ExpressionNode lo, ExpressionNode hi, ExpressionNode function) Creates a new extended quantified expression node.- Parameters:
source- the source of the nodequant- the extended quantifier, which could be one of\sum, \max, \min, \numof, \product.lo- the lower bound argumenthi- the upper bound argumentfunction- the function argument- Returns:
- the new extended quantified expression node.
-
newPredicateNode
PredicateNode newPredicateNode(Source source, IdentifierNode identifier, SequenceNode<VariableDeclarationNode> parameters, ExpressionNode body) Creates a newPredicateNodefor ACSL predicates- Parameters:
source- the source of the new nodeidentifier- theIdentifierNodeof the predicate identifierparameters- parameters used in the predicate definitionbody- the predicate body expression- Returns:
-
newFocusLoopNode
FocusLoopTransformNode newFocusLoopNode(Source source, TokenFactory tokenFactory, String focusTag, SequenceNode<ExpressionNode> tagWindow, SequenceNode<ExpressionNode> memoryList) -
newFocusOrderedNode
FocusOrderedTransformNode newFocusOrderedNode(Source source, TokenFactory tokenFactory, String focusTag, OperatorNode operator, RegularRangeNode range, ExpressionNode expr) -
newFocusAssertNode
FocusAssertTransformNode newFocusAssertNode(Source source, TokenFactory tokenFactory, List<String> focusTags) -
newInsertTransformNode
InsertTransformNode newInsertTransformNode(Source source, List<BlockItemNode> nodesToInsert, boolean insertAfter)
-