a) Global construct
@Begin
@Global_define:
+ @DeclareVar:
+ @InitVar:
+ @DefineFunc:
...
@Interface_cluster:
...
import edu.uci.eecs.specCompiler.specExtraction.ConditionalInterface;
import edu.uci.eecs.specCompiler.specExtraction.ActionSubConstruct;
import edu.uci.eecs.specCompiler.specExtraction.ActionSubConstruct.DefineVar;
+import edu.uci.eecs.specCompiler.specExtraction.SequentialDefineSubConstruct;
public class SpecParser {
public static void main(String[] argvs)
<END: "@End">
|
<GLOBAL_DEFINE: "@Global_define:">
+|
+ <DECLARE_VAR: "@DeclareVar:">
+|
+ <INIT_VAR: "@InitVar:">
+|
+ <DEFINE_FUNC: "@DefineFunc:">
|
<INTERFACE_CLUSTER: "@Interface_cluster:">
|
GlobalConstruct Global_construct() :
{
GlobalConstruct res;
- String code;
+ SequentialDefineSubConstruct code;
}
{
{ res = null; }
}
}
-String Global_define() :
+SequentialDefineSubConstruct Global_define() :
{
- String code;
+ String declareVar, initVar, defineFunc;
}
{
- <GLOBAL_DEFINE> (code = C_CPP_CODE())
{
- return code;
+ declareVar = "";
+ initVar = "";
+ defineFunc = "";
+ }
+ <GLOBAL_DEFINE>
+ (<DECLARE_VAR> (declareVar = C_CPP_CODE()))?
+ (<INIT_VAR> (initVar = C_CPP_CODE()))?
+ (<DEFINE_FUNC> (defineFunc = C_CPP_CODE()))?
+ {
+ SequentialDefineSubConstruct res = new SequentialDefineSubConstruct(declareVar, initVar, defineFunc);
+ //System.out.println(res);
+ return res;
}
}