1 /* spec-compiler.jj Grammer definition for the specification */
6 Each construct should be embraced by /DOUBLE_STAR ... STAR/ annotation.
7 Within there, any line beginning with a "#" is a comment of the annotation.
8 Each constrcut should begin with @Begin and end with @End. Otherwise, the
9 annotation would be considered as normal comments of the source.
14 # If LANG is not define, it's C++ by default. C does not support class
15 # and template, so if it's defined as C, we should also have a explicit
29 @Commutativity: // This is to define the admissibility condition
30 // Enq <-> Enq (_M1.q != _M2.q)
31 // Enq <-> Deq (_M1.q != _M2.q)
32 // Deq <-> Deq (_M1.q != _M2.q)
33 // Enq <-> Deq (_M1.q == _M2.q && _M2.__RET__ == NULL)
36 b) Interface construct
40 IDENTIFIER | IDENTIFIER ...
41 @Condition: ... (Optional)
43 IDENTIFIER :: <C_CPP_Condition>
45 @ID: ... (Optional, use default ID)
50 @Post_action: (Optional)
51 @Post_check: (Optional)
54 c) Potential commit construct
56 @Potential_commit_point_define: ...
63 @Potential_additional_ordering_point_define: ...
67 d) Commit point define construct
69 @Commit_point_define_check: ...
75 # Addition ordering point is used to order operations when there are "equal"
76 # commit point operations on the same location and that we cannot decide
77 # which operation goes first, we will use additional ordering point to order
78 # them (it's just similar to commit points). In implementation, we can just
79 # treat them as commit points with a special flag.
82 @Additional_ordering_point_define: ...
83 @Potential_additional_ordering_point_label: ...
90 @Additional_ordering_point_define: ...
97 @Additional_ordering_point_define_check: ...
101 // Commit point clear (just as a normal commit point, but it is used to
102 // clear all commit points)
104 @Commit_point_clear: ...
108 e) Entry point construct
113 f) Interface define construct
115 @Interface_define: <Interface_Name>
118 g) Interface declare & define construct
120 @Interface_decl_define: <Interface_Name>
122 IDENTIFIER | IDENTIFIER ...
123 @Condition: ... (Optional)
125 IDENTIFIER :: <C_CPP_Condition>
127 @ID: ... (Optional, use default ID)
132 @Post_action: (Optional)
133 @Post_check: (Optional)
142 JAVA_UNICODE_ESCAPE = true;
145 PARSER_BEGIN(SpecParser)
146 package edu.uci.eecs.specCompiler.grammerParser;
148 import java.io.FileInputStream;
149 import java.io.FileNotFoundException;
150 import java.io.InputStream;
151 import java.io.ByteArrayInputStream;
153 import java.util.ArrayList;
154 import java.util.HashMap;
155 import java.util.HashSet;
156 import java.util.Arrays;
158 import edu.uci.eecs.specCompiler.specExtraction.Construct;
159 import edu.uci.eecs.specCompiler.specExtraction.GlobalConstruct;
160 import edu.uci.eecs.specCompiler.specExtraction.InterfaceConstruct;
161 import edu.uci.eecs.specCompiler.specExtraction.PotentialCPDefineConstruct;
162 import edu.uci.eecs.specCompiler.specExtraction.CommutativityRule;
163 import edu.uci.eecs.specCompiler.specExtraction.CPDefineConstruct;
164 import edu.uci.eecs.specCompiler.specExtraction.CPDefineCheckConstruct;
165 import edu.uci.eecs.specCompiler.specExtraction.CPClearConstruct;
166 import edu.uci.eecs.specCompiler.specExtraction.ConditionalInterface;
167 import edu.uci.eecs.specCompiler.specExtraction.SequentialDefineSubConstruct;
168 import edu.uci.eecs.specCompiler.specExtraction.InterfaceDefineConstruct;
169 import edu.uci.eecs.specCompiler.specExtraction.EntryPointConstruct;
170 import edu.uci.eecs.specCompiler.specExtraction.ClassBeginConstruct;
171 import edu.uci.eecs.specCompiler.specExtraction.ClassEndConstruct;
172 import edu.uci.eecs.specCompiler.specExtraction.FunctionHeader;
173 import edu.uci.eecs.specCompiler.specExtraction.QualifiedName;
174 import edu.uci.eecs.specCompiler.specExtraction.SourceFileInfo;
175 import edu.uci.eecs.specCompiler.specExtraction.VariableDeclaration;
177 public class SpecParser {
178 private static ArrayList<String> _content;
179 private static File _file;
180 private static ArrayList<Construct> _constructs;
183 public static void main(String[] argvs)
184 throws ParseException, TokenMgrError {
186 File f = new File("./grammer/spec1.txt");
187 FileInputStream fis = new FileInputStream(f);
188 SpecParser parser = new SpecParser(fis);
190 ArrayList<String> content = new ArrayList<String>();
191 ArrayList<Construct> constructs = new ArrayList<Construct>();
192 ArrayList<String> headers = new ArrayList<String>();
193 parser.Parse(f, content, constructs, headers);
194 for (int i = 0; i < content.size(); i++) {
195 System.out.println(content.get(i));
198 for (int i = 0; i < constructs.size(); i++) {
199 System.out.println(constructs.get(i));
204 System.out.println("Parsing finished!");
205 } catch (FileNotFoundException e) {
210 public static SourceFileInfo ParseFile(File f)
211 throws ParseException, TokenMgrError {
213 InputStream input = new FileInputStream(f);
214 SpecParser parser = new SpecParser(input);
215 ArrayList<String> content = new ArrayList<String>(),
216 headers = new ArrayList<String>();
217 ArrayList<Construct> constructs = new ArrayList<Construct>();
218 parser.Parse(f, content, constructs, headers);
219 return new SourceFileInfo(f, content, headers, constructs);
220 } catch (FileNotFoundException e) {
227 private static ArrayList<String> breakLines(String all) {
228 String lines[] = all.split("[\\r\\n]+");
229 return new ArrayList<String>(Arrays.asList(lines));
233 public static ArrayList<VariableDeclaration> getTemplateArg(String line)
234 throws ParseException {
235 InputStream input = new ByteArrayInputStream(line.getBytes());
236 SpecParser parser = new SpecParser(input);
237 return parser.TemplateParamList();
240 public static FunctionHeader parseFuncHeader(String line)
241 throws ParseException {
242 InputStream input = new ByteArrayInputStream(line.getBytes());
243 SpecParser parser = new SpecParser(input);
244 return parser.FuncDecl();
248 public static String stringArray2String(ArrayList<String> content) {
249 StringBuilder sb = new StringBuilder();
250 if (content.size() == 1)
251 return content.get(0);
252 for (int i = 0; i < content.size(); i++) {
253 sb.append(content.get(i) + "\n");
255 return sb.toString();
259 boolean spaceSeparator(Token t) {
308 PARSER_END(SpecParser)
312 <IN_POTENTIAL_SPEC, IN_SPEC> SKIP :
326 "/**" : IN_POTENTIAL_SPEC
329 <IN_POTENTIAL_SPEC> TOKEN : {
330 <BEGIN: "@Begin"> : IN_SPEC
346 // "//" comment for the specification
347 <"//" (~["\n", "\r"])* (["\n", "\r"])>
350 <IN_COMMENT, IN_POTENTIAL_SPEC> SKIP : {
354 <IN_COMMENT, IN_POTENTIAL_SPEC> SKIP : { < ~[] > }
358 // "#" comment for the specification
359 <"#" (~["\n", "\r"])* (["\n", "\r"])>
366 <OPTIONS: "@Options:">
368 <GLOBAL_DEFINE: "@Global_define:">
370 <DECLARE_STRUCT: "@DeclareStruct:">
372 <DECLARE_VAR: "@DeclareVar:">
374 <INIT_VAR: "@InitVar:">
376 <CLEANUP: "@Cleanup:">
378 <DEFINE_FUNC: "@DefineFunc:">
380 <INTERFACE_CLUSTER: "@Interface_cluster:">
382 <HAPPENS_BEFORE: "@Happens_before:">
384 <COMMUTATIVITY: "@Commutativity:">
386 <INTERFACE: "@Interface:">
388 <COMMIT_POINT_SET: "@Commit_point_set:">
390 <ENTRY_POINT: "@Entry_point">
392 <CLASS_BEGIN: "@Class_begin">
394 <CLASS_END: "@Class_end">
396 <INTERFACE_DEFINE: "@Interface_define:">
398 <CONDITION: "@Condition:">
400 <HB_CONDITION: "@HB_condition:">
410 <POST_ACTION: "@Post_action:">
412 <POST_CHECK: "@Post_check:">
414 <POTENTIAL_COMMIT_POINT_DEFINE: "@Potential_commit_point_define:">
416 <POTENTIAL_ADDITIONAL_ORDERING_POINT_DEFINE: "@Potential_additional_ordering_point_define:">
420 <COMMIT_POINT_DEFINE_CHECK: "@Commit_point_define_check:">
422 <ADDITIONAL_ORDERING_POINT_DEFINE_CHECK: "@Additional_ordering_point_define_check:">
424 <COMMIT_POINT_DEFINE: "@Commit_point_define:">
426 <ADDITIONAL_ORDERING_POINT_DEFINE: "@Additional_ordering_point_define:">
428 <COMMIT_POINT_CLEAR: "@Commit_point_clear:">
430 <POTENTIAL_COMMIT_POINT_LABEL: "@Potential_commit_point_label:">
432 <POTENTIAL_ADDITIONAL_ORDERING_POINT_LABEL: "@Potential_additional_ordering_point_label:">
438 /* Specification & C/C++ shared tokens */
446 <UNSIGNED: "unsigned">
448 <TEMPLATE: "template">
458 <#LETTER: ["a"-"z", "A"-"Z"]>
460 <IDENTIFIER: (<LETTER> | "_") (<LETTER> | <DIGIT> | "_")*>
480 <COMMUTATIVITY_SYMBOL: "<->">
484 /* C/C++ only token*/
517 <GREATER_EQUALS: ">=">
521 <LOGICAL_EQUALS: "==">
537 <DOUBLELESSTHAN: "<<">
539 <DOUBLEGREATERTHAN: ">>">
541 <TRIPLEGREATERTHAN: ">>>">
549 <DIVIDE_EQUALS: "/=">
563 ((~["\"","\\","\n","\r"])
565 ( ["n","t","b","r","f","\\","'","\""]
566 | ["0"-"7"] ( ["0"-"7"] )?
567 | ["0"-"3"] ["0"-"7"]
576 ((~["'","\\","\n","\r"])
578 (["n","t","b","r","f","\\","'","\""]
579 | ["0"-"7"] ( ["0"-"7"] )?
580 | ["0"-"3"] ["0"-"7"]
588 <DECIMAL_LITERAL> (["l","L"])?
589 | <HEX_LITERAL> (["l","L"])?
590 | <OCTAL_LITERAL> (["l","L"])?>
592 < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
594 < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
596 < #OCTAL_LITERAL: "0" (["0"-"7"])* >
598 < FLOATING_POINT_LITERAL:
599 <DECIMAL_FLOATING_POINT_LITERAL>
600 | <HEXADECIMAL_FLOATING_POINT_LITERAL> >
602 < #DECIMAL_FLOATING_POINT_LITERAL:
603 (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
604 | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
605 | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])?
606 | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"]>
608 < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
610 < #HEXADECIMAL_FLOATING_POINT_LITERAL:
611 "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?
612 | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?>
614 < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ >
616 < #SPACE: (" " | "\t")+>
618 < #TO_END_OF_LINE: (~["\n"])+>
621 <INCLUDE: "#" (<SPACE>)? "include" <SPACE> (<STRING_LITERAL> | "<" (<LETTER> | <DOT>)+ ">")>
623 <DEFINE: "#" (<SPACE>)? <TO_END_OF_LINE>>
637 (((str = <STRUCT>.image | str = <CLASS>.image | str = <UNSIGNED>.image) { type = type + " " + str; })?
639 name = ParseQualifiedName() {
640 if (!type.equals(""))
641 type = type + " " + name.fullName;
643 type = name.fullName;
646 ((str = <CONST>.image {
647 if (!type.equals(""))
648 type = type + " " + str;
652 (str = <STAR>.image {
653 if (!type.equals(""))
654 type = type + " " + str;
659 if (!type.equals(""))
660 type = type + " " + str;
671 String ParameterizedName() :
677 (str = <IDENTIFIER>.image {res = str;})
678 (<OPEN_BRACKET> str = Type() { res = res + "<" + str; }
679 (<COMMA> str = Type() { res = res + ", " + str; })* <CLOSE_BRACKET>
687 FunctionHeader FuncDecl() :
690 QualifiedName funcName;
691 ArrayList<VariableDeclaration> args;
694 (<STATIC> | <INLINE>)*
696 funcName = ParseQualifiedName()
697 args = FormalParamList()
699 FunctionHeader res = new FunctionHeader(ret, funcName, args);
700 //System.out.println(res);
705 QualifiedName ParseQualifiedName() :
707 String qualifiedName, str;
710 { qualifiedName = ""; }
711 (str = ParameterizedName() { qualifiedName = qualifiedName + str; } )
712 ( <DOUBLECOLON> (str = ParameterizedName() { qualifiedName = qualifiedName +
715 QualifiedName res = new QualifiedName(qualifiedName);
716 //System.out.println(res);
721 ArrayList<VariableDeclaration> TemplateParamList() :
723 ArrayList<VariableDeclaration> params;
729 params = new ArrayList<VariableDeclaration>();
733 (type = <IDENTIFIER>.image
734 name = <IDENTIFIER>.image
736 params.add(new VariableDeclaration(type, name));
740 (<COMMA> type = <IDENTIFIER>.image
741 name = <IDENTIFIER>.image
743 params.add(new VariableDeclaration(type, name));
748 //System.out.println(params);
753 ArrayList<VariableDeclaration > FormalParamList() :
755 ArrayList<VariableDeclaration > typeParams;
756 VariableDeclaration varDecl;
760 typeParams = new ArrayList<VariableDeclaration >();
763 ((varDecl = TypeParam() {typeParams.add(varDecl);})
764 ((<COMMA> varDecl = TypeParam() {typeParams.add(varDecl);}))*)?
771 VariableDeclaration TypeParam() :
776 (type = Type()) (param = <IDENTIFIER>.image)
778 return new VariableDeclaration(type, param);
784 ArrayList<String> C_CPP_CODE(ArrayList<String> headers) :
788 boolean newLine = false;
789 boolean newSpace = true;
790 boolean inTemplate = false;
791 boolean inForLoop = false;
792 ArrayList<String> content;
799 content = new ArrayList<String>();
804 t = <CONST> | t = <STRUCT> | t = <CLASS> | t = <UNSIGNED> |
805 (t = <TEMPLATE> { inTemplate = true; })|
806 t = <STATIC> | t = <INLINE> |
807 (t = <FOR> { inForLoop = true; })|
812 if (headers != null) {
813 headers.add(header.substring(header.lastIndexOf(' ') + 1));
816 | t = <IDENTIFIER> | t = <POUND> |
817 (t = <OPEN_BRACE> { newLine = true; } ) |
818 (t = <CLOSE_BRACE> { newLine = true; inForLoop = false;} ) |
819 t = <EQUALS> | t = <OPEN_PAREN> | t = <CLOSE_PAREN> |
820 t = <OPEN_BRACKET> | t = <CLOSE_BRACKET>
821 | t = <HB_SYMBOL> | t = <COMMA> |
822 t = <DOT> | t = <STAR> | t = <DOLLAR> | t = <NEGATE> | t = <EXCLAMATION> | t = <AND> | t = <OR> | t = <MOD> | t = <PLUS> |
823 t = <PLUSPLUS> | t = <MINUS> | t = <MINUSMINUS> | t = <DIVIDE> | t = <BACKSLASH> |
825 (t = <GREATER_THAN> { if (inTemplate) newLine = true; }) |
826 t = <GREATER_EQUALS> | t = <LESS_EQUALS> |
827 t = <LOGICAL_EQUALS> | t = <NOT_EQUALS> | t = <LOGICAL_AND> | t = <LOGICAL_OR> | t = <XOR> |
828 t = <QUESTION_MARK> | t = <COLON> | t = <DOUBLECOLON> |
829 t = <DOUBLELESSTHAN> |
830 t = <DOUBLEGREATERTHAN> |
831 t = <TRIPLEGREATERTHAN> |
836 t = <DIVIDE_EQUALS> |
842 (t = <SEMI_COLON> { if (!inForLoop) newLine = true; } )
843 | t = <STRING_LITERAL> | t = <CHARACTER_LITERAL> |
844 t = <INTEGER_LITERAL> | t = <FLOATING_POINT_LITERAL> |
845 (t = <DEFINE> { newLine = true; } )
848 if (text.equals("")) {
852 text = text + " " + t.image;
854 if (newSpace && spaceSeparator(t)) {
855 text = text + " " + t.image;
857 text = text + t.image;
858 if (spaceSeparator(t))
872 if (content.size() == 0) {
880 void Parse(File f, ArrayList<String> content, ArrayList<Construct> constructs, ArrayList<String> headers) :
890 _constructs = constructs;
891 sb = new StringBuilder();
896 _constructs.add(inst);
899 //((code = C_CPP_CODE(headers)) { _content.addAll(code); })
901 flushSB = OriginalCode(sb)
904 sb = new StringBuilder();
909 // For the last piece of code
911 _content.add(sb.toString());
916 // If true, there's a new line and sb should be flushed
917 boolean OriginalCode(StringBuilder sb) :
924 if (!str.equals("\n")) {
928 _content.add(sb.toString());
934 Construct ParseSpec() :
940 LOOKAHEAD(2) res = Global_construct() |
941 LOOKAHEAD(2) res = Interface() |
942 LOOKAHEAD(2) res = Potential_commit_point_define() |
943 LOOKAHEAD(2) res = Commit_point_define() |
944 LOOKAHEAD(2) res = Commit_point_define_check() |
945 LOOKAHEAD(2) res = Potential_additional_ordering_point_define() |
946 LOOKAHEAD(2) res = Additional_ordering_point_define() |
947 LOOKAHEAD(2) res = Additional_ordering_point_define_check() |
948 LOOKAHEAD(2) res = Commit_point_clear() |
949 LOOKAHEAD(2) res = Entry_point() |
950 LOOKAHEAD(2) res = Class_begin() |
951 LOOKAHEAD(2) res = Class_end() |
952 LOOKAHEAD(2) res = Interface_define()
955 //System.out.println(res);
960 GlobalConstruct Global_construct() :
963 SequentialDefineSubConstruct code;
964 HashMap<String, String> options;
970 options = new HashMap<String, String>();
974 ((key = <IDENTIFIER>.image)
976 (value = <IDENTIFIER>.image)
978 if (options.containsKey(key)) {
979 throw new ParseException("Duplicate options!");
981 options.put(key, value);
986 (code = Global_define())
987 { res = new GlobalConstruct(_file, _content.size(), code, options); }
988 (Interface_clusters(res))?
989 (Happens_before(res))?
990 (Commutativity(res))?
993 res.unfoldInterfaceCluster();
998 SequentialDefineSubConstruct Global_define() :
1000 ArrayList<String> initVar, cleanup, defineFunc, code, declareStruct;
1001 ArrayList<ArrayList<String>> defineFuncs;
1002 ArrayList<VariableDeclaration> declareVars;
1003 ArrayList<ArrayList<String>> declareStructs;
1004 VariableDeclaration declareVar;
1009 declareVars = new ArrayList<VariableDeclaration>();
1010 initVar = new ArrayList<String>();
1011 cleanup = new ArrayList<String>();
1012 defineFuncs = new ArrayList<ArrayList<String>>();
1013 declareStructs = new ArrayList<ArrayList<String>>();
1016 (<DECLARE_STRUCT> (declareStruct = C_CPP_CODE(null) {
1017 declareStructs.add(declareStruct); }))*
1018 (<DECLARE_VAR> ((declareVar = TypeParam() <SEMI_COLON> {
1019 declareVars.add(declareVar); } )*))?
1020 (<INIT_VAR> (code = C_CPP_CODE(null) { initVar = code; } ))?
1021 (<CLEANUP> (code = C_CPP_CODE(null) { cleanup = code; } ))?
1022 (<DEFINE_FUNC> (defineFunc = C_CPP_CODE(null) { defineFuncs.add(defineFunc); }))*
1024 SequentialDefineSubConstruct res = new
1025 SequentialDefineSubConstruct(declareStructs, declareVars, initVar, cleanup, defineFuncs);
1026 //System.out.println(res);
1031 ConditionalInterface Conditional_interface() :
1033 String interfaceName, hbConditionLabel;
1037 hbConditionLabel = "";
1039 interfaceName = <IDENTIFIER>.image (<OPEN_PAREN> hbConditionLabel =
1040 <IDENTIFIER>.image <CLOSE_PAREN>)?
1042 return new ConditionalInterface(interfaceName, hbConditionLabel);
1046 void Interface_cluster(GlobalConstruct inst) :
1049 ConditionalInterface condInterface;
1052 (clusterName= <IDENTIFIER>.image)
1053 <EQUALS> <OPEN_BRACE>
1054 (condInterface = Conditional_interface()
1055 { inst.addInterface2Cluster(clusterName, condInterface); }
1057 (<COMMA> condInterface = Conditional_interface()
1058 { inst.addInterface2Cluster(clusterName, condInterface); }
1063 void Interface_clusters(GlobalConstruct inst) :
1066 <INTERFACE_CLUSTER> (Interface_cluster(inst))+
1069 void Happens_before(GlobalConstruct inst) :
1071 ConditionalInterface left, right;
1076 left = Conditional_interface() <HB_SYMBOL> right = Conditional_interface()
1077 { inst.addHBCondition(left, right); }
1081 void Commutativity(GlobalConstruct inst) :
1083 String method1, method2, condition;
1084 ArrayList<String> content;
1088 content = new ArrayList<String>();
1093 method1 = <IDENTIFIER>.image <COMMUTATIVITY_SYMBOL>
1094 method2 = <IDENTIFIER>.image
1096 content = C_CPP_CODE(null)
1097 { condition = stringArray2String(content); }
1099 inst.addCommutativityRule(method1, method2, condition);
1104 InterfaceConstruct Interface() :
1106 InterfaceConstruct res;
1107 String interfaceName, condition, idCode, check,
1108 postCheck, commitPoint, hbLabel, hbCondition;
1109 ArrayList<String> commitPointSet;
1110 ArrayList<String> action, postAction;
1111 HashMap<String, String> hbConditions;
1112 ArrayList<String> content;
1117 action = new ArrayList<String>();
1122 commitPointSet = new ArrayList<String>();
1123 hbConditions = new HashMap<String, String>();
1124 postAction = new ArrayList<String>();
1127 <INTERFACE> (interfaceName = <IDENTIFIER>.image)
1129 (commitPoint = <IDENTIFIER>.image
1130 { commitPointSet.add(commitPoint); }
1133 (commitPoint = <IDENTIFIER>.image)
1135 if (commitPointSet.contains(commitPoint)) {
1136 throw new ParseException(interfaceName + " has" +
1137 "duplicate commit point labels");
1139 commitPointSet.add(commitPoint);
1143 (<CONDITION> (content = C_CPP_CODE(null) { condition = stringArray2String(content); }))?
1146 (hbLabel = <IDENTIFIER>.image) <DOUBLECOLON>
1147 (content = C_CPP_CODE(null) { hbCondition = stringArray2String(content); })
1149 if (hbConditions.containsKey(hbLabel)) {
1150 throw new ParseException(interfaceName + " has" +
1151 "duplicate happens-before condtion labels");
1153 hbConditions.put(hbLabel, hbCondition);
1156 (<ID> (content = C_CPP_CODE(null) { idCode = stringArray2String(content); }))?
1157 (<CHECK> (content = C_CPP_CODE(null) { check = stringArray2String(content); }))?
1158 (<ACTION> action = C_CPP_CODE(null))?
1159 (<POST_ACTION> (postAction = C_CPP_CODE(null) ))?
1160 (<POST_CHECK> (content = C_CPP_CODE(null) { postCheck = stringArray2String(content); }))?
1163 res = new InterfaceConstruct(_file, _content.size(), interfaceName, commitPointSet, condition,
1164 hbConditions, idCode, check, action, postAction, postCheck);
1170 PotentialCPDefineConstruct Potential_commit_point_define() :
1172 PotentialCPDefineConstruct res;
1173 String label, condition;
1174 ArrayList<String> content;
1180 <POTENTIAL_COMMIT_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1181 <LABEL> (label = <IDENTIFIER>.image)
1184 res = new PotentialCPDefineConstruct(_file, _content.size(), label, condition);
1189 PotentialCPDefineConstruct Potential_additional_ordering_point_define() :
1191 PotentialCPDefineConstruct res;
1192 String label, condition;
1193 ArrayList<String> content;
1199 <POTENTIAL_ADDITIONAL_ORDERING_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1200 <LABEL> (label = <IDENTIFIER>.image)
1203 // Set the boolean flag isAdditionalOrderingPoint to be true
1204 res = new PotentialCPDefineConstruct(_file, _content.size(), true, label, condition);
1210 CPDefineConstruct Commit_point_define() :
1212 CPDefineConstruct res;
1213 String label, potentialCPLabel, condition;
1214 ArrayList<String> content;
1220 <COMMIT_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1221 <POTENTIAL_COMMIT_POINT_LABEL> (potentialCPLabel = <IDENTIFIER>.image)
1222 <LABEL> (label = <IDENTIFIER>.image)
1225 res = new CPDefineConstruct(_file, _content.size(), false, label, potentialCPLabel, condition);
1230 CPDefineConstruct Additional_ordering_point_define() :
1232 CPDefineConstruct res;
1233 String label, potentialCPLabel, condition;
1234 ArrayList<String> content;
1240 <ADDITIONAL_ORDERING_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1241 <POTENTIAL_ADDITIONAL_ORDERING_POINT_LABEL> (potentialCPLabel = <IDENTIFIER>.image)
1242 <LABEL> (label = <IDENTIFIER>.image)
1245 // Set the boolean flag isAdditionalOrderingPoint to be true
1246 res = new CPDefineConstruct(_file, _content.size(), true, label, potentialCPLabel, condition);
1251 CPClearConstruct Commit_point_clear() :
1253 CPClearConstruct res;
1254 String label, condition;
1255 ArrayList<String> content;
1261 <COMMIT_POINT_CLEAR> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1262 <LABEL> (label = <IDENTIFIER>.image)
1265 res = new CPClearConstruct(_file, _content.size(), label, condition);
1271 CPDefineCheckConstruct Commit_point_define_check() :
1273 CPDefineCheckConstruct res;
1274 String label, condition;
1275 ArrayList<String> content;
1281 <COMMIT_POINT_DEFINE_CHECK> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1282 <LABEL> (label = <IDENTIFIER>.image)
1285 res = new CPDefineCheckConstruct(_file, _content.size(), false, label, condition);
1290 CPDefineCheckConstruct Additional_ordering_point_define_check() :
1292 CPDefineCheckConstruct res;
1293 String label, condition;
1294 ArrayList<String> content;
1300 <ADDITIONAL_ORDERING_POINT_DEFINE_CHECK> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1301 <LABEL> (label = <IDENTIFIER>.image)
1304 // Set the boolean flag isAdditionalOrderingPoint to be true
1305 res = new CPDefineCheckConstruct(_file, _content.size(), true, label, condition);
1310 EntryPointConstruct Entry_point() :
1318 return new EntryPointConstruct(_file, _content.size());
1322 ClassBeginConstruct Class_begin() :
1330 return new ClassBeginConstruct(_file, _content.size());
1334 ClassEndConstruct Class_end() :
1342 return new ClassEndConstruct(_file, _content.size());
1346 InterfaceDefineConstruct Interface_define() :
1352 <INTERFACE_DEFINE> (name = <IDENTIFIER>.image)
1355 return new InterfaceDefineConstruct(_file, _content.size(), name);