[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Extend Jimple keywords
Hello,
I am using jimple in my project (integration of our synchonous java
language to Bandera), but the input file is not 100% java syntax, it has
some new keywords, so I have to extend jimple in order to cover my
keywords.
An example of the my code:
class A{
...
public void main(){
*select*{
*case* *accept* my_method;
blockStmt0;
*case* caller.its_method(param);
blockStmt1;
}
}}
the idea to translate the above code to jimple is the following:
---------------------
class A extend java.lang.Object{
public static void main(java.lang.String[]){
LinkedList list;
...
*addCase* list my_method;
*addCase* list caller calling_method;
PC = *searchPair* list; // search the pair that is active from calling
and called objects
lookupswitch(PC){
case 0: goto label0;
case 1: goto label1;
}
label0:
//do something
blockStmt0;
goto label2:
label1:
staticinvoke [caller.its_method():void](param);
blockStmt1;
label2:
...
---------------------
The new keywords I wanted to add are: *addCase*, *searchPair*. As what I
understood, I will:
1) implement the classes such as the ones of monitor (JEnterMonitorStmt,
EnterMonitorStmt, SwitchStmt, etc). They are used to generate addCase,
searchPair statements together with other keywords of jimple.
2) implement a class that contains the method addCase (LinkedList,
callerObject, String), searchPair(LinkedList).
These methods are used when the jimple reader (a tool that scans jimple
statements and analyzes them) arrives at addCase, searchPair statements.
It takes time to understand how to implement classes for jimple library
and jimple reader and realize them. So it would be better to have some
ideas, suggestions, experiences ... from the jimple developer team about
my idea, plan and if it is useful to extend the jimple keywords or find
another solution.
I have play with jimple and some jimple reader code, so I really want to
extend it for my language (if you think it is useful and possible!)
Thank you very much in advance.
Duy.
PS: If there is something not clear in my explanation, please tell me to
explain in more detail, because this work is very important to me! Thank
you.