| Version 4 (modified by , 13 years ago) ( diff ) |
|---|
Multiple Changes to CIVL Code
Model Changes
- introduce LHSExpression, a subtype of Expression: DONE
- rename ArrayIndexExpression to SubscriptExpression: DONE
- modify ModelBuilder to get rid of arrow expressions, replacing them with dot of star: DONE
- modify ModelBuilder to get rid of C's pointer-array pun:
- in any subscript expression
a[i], make sureahas array type. If it doesn't, translate to*(a+i): DONE - in any place where a pointer is called for, but instead an array
ais used, replaceawith&a[0]. Examples include pointer arithmetic (a+i,a-b), argument to dereference operator*, actual arguments in function calls where the corresponding parameter has pointer type. : DONE - make sure the parameter type of a function call is never an array type. ABC should already be doing this.
- in any subscript expression
- use an enumerated type like ExpressionKind for the different kinds of expressions, so
switchstatements can be used: DONE - 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
Semantics Changes
- use interfaces for !Executor, !Evaluator, etc.
- finish javadocs for all methods
- don't use !Vector. Use LinkedList if you only need to iterate; use ArrayList if you need constant time access
- !processType, etc: for these and other fields, make them canonic using !universe.canonic(…)!. This can improve efficiency. DONE
- never return !null if a case is not handled. Instead throw an appropriate exception: DONE
- use !switch instead of big if...else if… sequence "mostly DONE"
- evaluation of dot expression should be simply
return universe.tupleRead(evaluate(expr.struct()…), expr.index())or something like that: DONE - evaluation of SubscriptExpression should be simply
return universe.arrayRead(evaluate(expr.array()…), evaluate(expr.index()…))or something like that: DONE - evaluate of
NOT_EQUAL: useuniverse.neq(): DONE - implement pointer addition and subtraction. [addition DONE, subtraction coming]
- implement string literals using
universe.stringExpression()(it returns an array of char). DONE? - references: re-do to use new (upcoming) methods in symbolic universe to create a reference to a point within a symbolic expression. this will eliminate the need to deal with navigation sequences. You still need to figure out the variable, scope and model IDs. DONE
- use a tuple with one integer field for scope IDs instead of symbolic constants. DONE
- don't do any string manipulation or parsing dynamically, if possible: DONE
evaluate(…VariableExpression): the error reporting code for incorporating the state into the log entry seems general enough that you could factor it out into a separate method somewhere to re-use every time there is an error to report (maybe in Log?) : DONE (state exceptions)- 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.
