| Version 5 (modified by , 13 years ago) ( diff ) |
|---|
Multiple Changes to CIVL Code
Model Changes
- make sure the parameter type of a function call is never an array type. ABC should already be doing this.
- add a method to expressions like
SymbolicExpression getConstantValue()and a corresponding setter, to cache the value of any expression that has a constant value, such as a literal expression - add a new
CIVLType:CIVLDynamicType.- A CIVL Expression of that type, when evaluated, will yield a
SymbolicExpressionx. A method in theEvaluator,SymbolicType getSymbolicType(SymbolicExpression x);, will take such anxand return aSymbolicTypeand that is basically the only operation that can be performed onx. Hence this gives you a way to take a (dynamic, symbolic) type and wrap it up into a value that can be stored in a variable in your model.
- A CIVL Expression of that type, when evaluated, will yield a
- add a new kind of CIVL
Expression:DynamicTypeOf(t), wheretis a (static) CIVL type.- The type of this expression is
CIVLDynamicType. When evaluated, it returns the dynamic type determined by the current state and the given static type. (This assumes extent expressions are stored in array types.) For example, iftis the static typestruct foo { double a[n]; }from the source code above, thenDynamicTypeOf(t), evaluated in the state that arises at that point in the source code, will yield the symbolic type which is a record type with one field which is an array of doubles of length 2. Now you can store that dynamic type in a variable if you want to save it, e.g., insert a statement like this into the model:CIVLDynamicType __struct_foo__ = DynamicTypeOf(struct foo { double a[n]; });
- The type of this expression is
- add a new kind of CIVL expression:
InitialValue[variable, dynamicType]. Here,variableis a (static)Variable, anddynamicTypeis an expression of typeCIVLDynamicType. The type of this expression is the type of the variable. When evaluated, it returns a default initial value for a variable with the given dynamic type. This can be used to initialize arrays and structs. - add a new
CIVLType:CIVLScopeType - add new subtype of
Variable:CIVLScopeVariablewith methodScope getScope();
- add to the CIVL pointer type a method to get the scope variable, implement appropriate constructors and modifications to the factory, etc.
Semantics Changes
- use interfaces for
Executor,Evaluator, etc. - finish javadocs for all methods
- don't use
Vector. UseLinkedListif you only need to iterate; useArrayListif you need constant time access - use
switchinstead of bigif...else if…sequence (mostly DONE) - implement pointer subtraction
- construct and set the heap type in the constructor for
Evaluator, just like the other special types
Note:
See TracWiki
for help on using the wiki.
