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.
12 @DeclareState: C/C++ variable declaration; // Declare the state structure
13 @InitState: C/C++ statements; // Specify how to initialize the state
14 @CopyState: // A function on how to copy an existing state (Not sure if we
15 // need this because we might be able to auto this
16 @Commutativity: Method1 <-> Method2 (Guard) // Admissibility condition.
17 // Allow specify 0-many rules
19 b) Interface construct
20 @Interface: InterfaceName // Required; a label to represent the interface
21 @LocalState: // Optional; to calculate the accumulative local state before this
22 // method call in a customized fashion. If not specified here, the
23 // local state would be default, which is the result of the
24 // execution on the subset of method calls in the sequential order
25 @PreCondition: // Optional; checking code
26 @LocalSideEffect: // Optional; to calculate the side effect this method call
27 // have on the local state in a customized fashion. If this
28 // field is not stated, it means we don't care about it.
29 @SideEffect: // Optional; to calculate the side effect on the global state. When
30 // the "@LocalSideEffect" specification is ommitted, we also impose the
31 // same side effect on the set of method calls that happen before this
32 // method call in the sequential order.
33 @PostCondition: // Optional; checking code
36 c) Ordering point construct
37 @OPDefine: condition // If the specified condition satisfied, the atomic
38 // operation right before is an ordering point
40 @PotentialOP(Label): condition // If the specified condition satisfied, the
41 // atomic operation right before is a potential
42 // ordering point, and we label it with a tag
44 @OPCheck(Label): condition // If the specified condition satisfied, the
45 // potential ordering point defined earlier with the
46 // same tag becomes an ordering point
48 @OPClear: condition // If the specified condition satisfied, all the
49 // ordering points and potential ordering points will be
52 @OPClearDefine: condition // If the specified condition satisfied, all the
53 // ordering points and potential ordering points will
54 // be cleared, and the atomic operation right before
55 // becomes an ordering point. This is a syntax sugar
56 // as the combination of an "OPClear" and "OPDefine"
65 JAVA_UNICODE_ESCAPE = true;
68 PARSER_BEGIN(SpecParser)
69 package edu.uci.eecs.specCompiler.grammerParser;
71 import java.io.FileInputStream;
72 import java.io.FileNotFoundException;
73 import java.io.InputStream;
74 import java.io.ByteArrayInputStream;
76 import java.util.ArrayList;
77 import java.util.HashMap;
78 import java.util.HashSet;
79 import java.util.Arrays;
81 import edu.uci.eecs.specCompiler.specExtraction.Construct;
82 import edu.uci.eecs.specCompiler.specExtraction.GlobalConstruct;
83 import edu.uci.eecs.specCompiler.specExtraction.InterfaceConstruct;
84 import edu.uci.eecs.specCompiler.specExtraction.PotentialCPDefineConstruct;
85 import edu.uci.eecs.specCompiler.specExtraction.CommutativityRule;
86 import edu.uci.eecs.specCompiler.specExtraction.CPDefineConstruct;
87 import edu.uci.eecs.specCompiler.specExtraction.CPDefineCheckConstruct;
88 import edu.uci.eecs.specCompiler.specExtraction.CPClearConstruct;
89 import edu.uci.eecs.specCompiler.specExtraction.ConditionalInterface;
90 import edu.uci.eecs.specCompiler.specExtraction.SequentialDefineSubConstruct;
91 import edu.uci.eecs.specCompiler.specExtraction.InterfaceDefineConstruct;
92 import edu.uci.eecs.specCompiler.specExtraction.EntryPointConstruct;
93 import edu.uci.eecs.specCompiler.specExtraction.ClassBeginConstruct;
94 import edu.uci.eecs.specCompiler.specExtraction.ClassEndConstruct;
95 import edu.uci.eecs.specCompiler.specExtraction.FunctionHeader;
96 import edu.uci.eecs.specCompiler.specExtraction.QualifiedName;
97 import edu.uci.eecs.specCompiler.specExtraction.SourceFileInfo;
98 import edu.uci.eecs.specCompiler.specExtraction.VariableDeclaration;
100 public class SpecParser {
101 private static ArrayList<String> _content;
102 private static File _file;
103 private static ArrayList<Construct> _constructs;
106 public static void main(String[] argvs)
107 throws ParseException, TokenMgrError {
109 File f = new File("./grammer/spec1.txt");
110 FileInputStream fis = new FileInputStream(f);
111 SpecParser parser = new SpecParser(fis);
113 ArrayList<String> content = new ArrayList<String>();
114 ArrayList<Construct> constructs = new ArrayList<Construct>();
115 ArrayList<String> headers = new ArrayList<String>();
116 parser.Parse(f, content, constructs, headers);
117 for (int i = 0; i < content.size(); i++) {
118 System.out.println(content.get(i));
121 for (int i = 0; i < constructs.size(); i++) {
122 System.out.println(constructs.get(i));
127 System.out.println("Parsing finished!");
128 } catch (FileNotFoundException e) {
133 public static SourceFileInfo ParseFile(File f)
134 throws ParseException, TokenMgrError {
136 InputStream input = new FileInputStream(f);
137 SpecParser parser = new SpecParser(input);
138 ArrayList<String> content = new ArrayList<String>(),
139 headers = new ArrayList<String>();
140 ArrayList<Construct> constructs = new ArrayList<Construct>();
141 parser.Parse(f, content, constructs, headers);
142 return new SourceFileInfo(f, content, headers, constructs);
143 } catch (FileNotFoundException e) {
150 private static ArrayList<String> breakLines(String all) {
151 String lines[] = all.split("[\\r\\n]+");
152 return new ArrayList<String>(Arrays.asList(lines));
156 public static ArrayList<VariableDeclaration> getTemplateArg(String line)
157 throws ParseException {
158 InputStream input = new ByteArrayInputStream(line.getBytes());
159 SpecParser parser = new SpecParser(input);
160 return parser.TemplateParamList();
163 public static FunctionHeader parseFuncHeader(String line)
164 throws ParseException {
165 InputStream input = new ByteArrayInputStream(line.getBytes());
166 SpecParser parser = new SpecParser(input);
167 return parser.FuncDecl();
171 public static String stringArray2String(ArrayList<String> content) {
172 StringBuilder sb = new StringBuilder();
173 if (content.size() == 1)
174 return content.get(0);
175 for (int i = 0; i < content.size(); i++) {
176 sb.append(content.get(i) + "\n");
178 return sb.toString();
182 boolean spaceSeparator(Token t) {
231 PARSER_END(SpecParser)
235 <IN_POTENTIAL_SPEC, IN_SPEC> SKIP :
249 "/**" : IN_POTENTIAL_SPEC
252 <IN_POTENTIAL_SPEC> TOKEN : {
253 <BEGIN: "@Begin"> : IN_SPEC
269 // "//" comment for the specification
270 <"//" (~["\n", "\r"])* (["\n", "\r"])>
273 <IN_COMMENT, IN_POTENTIAL_SPEC> SKIP : {
277 <IN_COMMENT, IN_POTENTIAL_SPEC> SKIP : { < ~[] > }
281 // "#" comment for the specification
282 <"#" (~["\n", "\r"])* (["\n", "\r"])>
289 <OPTIONS: "@Options:">
291 <GLOBAL_DEFINE: "@Global_define:">
293 <DECLARE_STRUCT: "@DeclareStruct:">
295 <DECLARE_VAR: "@DeclareVar:">
297 <INIT_VAR: "@InitVar:">
299 <CLEANUP: "@Finalize:">
301 <DEFINE_FUNC: "@DefineFunc:">
303 <INTERFACE_CLUSTER: "@Interface_cluster:">
305 <HAPPENS_BEFORE: "@Happens_before:">
307 <COMMUTATIVITY: "@Commutativity:">
309 <INTERFACE: "@Interface:">
311 <COMMIT_POINT_SET: "@Commit_point_set:">
313 <ENTRY_POINT: "@Entry_point">
315 <CLASS_BEGIN: "@Class_begin">
317 <CLASS_END: "@Class_end">
319 <INTERFACE_DEFINE: "@Interface_define:">
321 <CONDITION: "@Condition:">
323 <HB_CONDITION: "@HB_condition:">
333 <POST_ACTION: "@Post_action:">
335 <POST_CHECK: "@Post_check:">
337 <POTENTIAL_COMMIT_POINT_DEFINE: "@Potential_commit_point_define:">
339 <POTENTIAL_ADDITIONAL_ORDERING_POINT_DEFINE: "@Potential_additional_ordering_point_define:">
343 <COMMIT_POINT_DEFINE_CHECK: "@Commit_point_define_check:">
345 <ADDITIONAL_ORDERING_POINT_DEFINE_CHECK: "@Additional_ordering_point_define_check:">
347 <COMMIT_POINT_DEFINE: "@Commit_point_define:">
349 <ADDITIONAL_ORDERING_POINT_DEFINE: "@Additional_ordering_point_define:">
351 <COMMIT_POINT_CLEAR: "@Commit_point_clear:">
353 <POTENTIAL_COMMIT_POINT_LABEL: "@Potential_commit_point_label:">
355 <POTENTIAL_ADDITIONAL_ORDERING_POINT_LABEL: "@Potential_additional_ordering_point_label:">
361 /* Specification & C/C++ shared tokens */
369 <UNSIGNED: "unsigned">
371 <TEMPLATE: "template">
381 <#LETTER: ["a"-"z", "A"-"Z"]>
383 <IDENTIFIER: (<LETTER> | "_") (<LETTER> | <DIGIT> | "_")*>
403 <COMMUTATIVITY_SYMBOL: "<->">
407 /* C/C++ only token*/
440 <GREATER_EQUALS: ">=">
444 <LOGICAL_EQUALS: "==">
460 <DOUBLELESSTHAN: "<<">
462 <DOUBLEGREATERTHAN: ">>">
464 <TRIPLEGREATERTHAN: ">>>">
472 <DIVIDE_EQUALS: "/=">
486 ((~["\"","\\","\n","\r"])
488 ( ["n","t","b","r","f","\\","'","\""]
489 | ["0"-"7"] ( ["0"-"7"] )?
490 | ["0"-"3"] ["0"-"7"]
499 ((~["'","\\","\n","\r"])
501 (["n","t","b","r","f","\\","'","\""]
502 | ["0"-"7"] ( ["0"-"7"] )?
503 | ["0"-"3"] ["0"-"7"]
511 <DECIMAL_LITERAL> (["l","L"])?
512 | <HEX_LITERAL> (["l","L"])?
513 | <OCTAL_LITERAL> (["l","L"])?>
515 < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
517 < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
519 < #OCTAL_LITERAL: "0" (["0"-"7"])* >
521 < FLOATING_POINT_LITERAL:
522 <DECIMAL_FLOATING_POINT_LITERAL>
523 | <HEXADECIMAL_FLOATING_POINT_LITERAL> >
525 < #DECIMAL_FLOATING_POINT_LITERAL:
526 (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
527 | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
528 | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])?
529 | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"]>
531 < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
533 < #HEXADECIMAL_FLOATING_POINT_LITERAL:
534 "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?
535 | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?>
537 < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ >
539 < #SPACE: (" " | "\t")+>
541 < #TO_END_OF_LINE: (~["\n"])+>
544 <INCLUDE: "#" (<SPACE>)? "include" <SPACE> (<STRING_LITERAL> | "<" (<LETTER> | <DOT>)+ ">")>
546 <DEFINE: "#" (<SPACE>)? <TO_END_OF_LINE>>
560 (((str = <STRUCT>.image | str = <CLASS>.image | str = <UNSIGNED>.image) { type = type + " " + str; })?
562 name = ParseQualifiedName() {
563 if (!type.equals(""))
564 type = type + " " + name.fullName;
566 type = name.fullName;
569 ((str = <CONST>.image {
570 if (!type.equals(""))
571 type = type + " " + str;
575 (str = <STAR>.image {
576 if (!type.equals(""))
577 type = type + " " + str;
582 if (!type.equals(""))
583 type = type + " " + str;
594 String ParameterizedName() :
600 (str = <IDENTIFIER>.image {res = str;})
601 (<OPEN_BRACKET> str = Type() { res = res + "<" + str; }
602 (<COMMA> str = Type() { res = res + ", " + str; })* <CLOSE_BRACKET>
610 FunctionHeader FuncDecl() :
613 QualifiedName funcName;
614 ArrayList<VariableDeclaration> args;
617 (<STATIC> | <INLINE>)*
619 funcName = ParseQualifiedName()
620 args = FormalParamList()
622 FunctionHeader res = new FunctionHeader(ret, funcName, args);
623 //System.out.println(res);
628 QualifiedName ParseQualifiedName() :
630 String qualifiedName, str;
633 { qualifiedName = ""; }
634 (str = ParameterizedName() { qualifiedName = qualifiedName + str; } )
635 ( <DOUBLECOLON> (str = ParameterizedName() { qualifiedName = qualifiedName +
638 QualifiedName res = new QualifiedName(qualifiedName);
639 //System.out.println(res);
644 ArrayList<VariableDeclaration> TemplateParamList() :
646 ArrayList<VariableDeclaration> params;
652 params = new ArrayList<VariableDeclaration>();
656 (type = <IDENTIFIER>.image
657 name = <IDENTIFIER>.image
659 params.add(new VariableDeclaration(type, name));
663 (<COMMA> type = <IDENTIFIER>.image
664 name = <IDENTIFIER>.image
666 params.add(new VariableDeclaration(type, name));
671 //System.out.println(params);
676 ArrayList<VariableDeclaration > FormalParamList() :
678 ArrayList<VariableDeclaration > typeParams;
679 VariableDeclaration varDecl;
683 typeParams = new ArrayList<VariableDeclaration >();
686 ((varDecl = TypeParam() {typeParams.add(varDecl);})
687 ((<COMMA> varDecl = TypeParam() {typeParams.add(varDecl);}))*)?
694 VariableDeclaration TypeParam() :
699 (type = Type()) (param = <IDENTIFIER>.image)
701 return new VariableDeclaration(type, param);
707 ArrayList<String> C_CPP_CODE(ArrayList<String> headers) :
711 boolean newLine = false;
712 boolean newSpace = true;
713 boolean inTemplate = false;
714 boolean inForLoop = false;
715 ArrayList<String> content;
722 content = new ArrayList<String>();
727 t = <CONST> | t = <STRUCT> | t = <CLASS> | t = <UNSIGNED> |
728 (t = <TEMPLATE> { inTemplate = true; })|
729 t = <STATIC> | t = <INLINE> |
730 (t = <FOR> { inForLoop = true; })|
735 if (headers != null) {
736 headers.add(header.substring(header.lastIndexOf(' ') + 1));
739 | t = <IDENTIFIER> | t = <POUND> |
740 (t = <OPEN_BRACE> { newLine = true; } ) |
741 (t = <CLOSE_BRACE> { newLine = true; inForLoop = false;} ) |
742 t = <EQUALS> | t = <OPEN_PAREN> | t = <CLOSE_PAREN> |
743 t = <OPEN_BRACKET> | t = <CLOSE_BRACKET>
744 | t = <HB_SYMBOL> | t = <COMMA> |
745 t = <DOT> | t = <STAR> | t = <DOLLAR> | t = <NEGATE> | t = <EXCLAMATION> | t = <AND> | t = <OR> | t = <MOD> | t = <PLUS> |
746 t = <PLUSPLUS> | t = <MINUS> | t = <MINUSMINUS> | t = <DIVIDE> | t = <BACKSLASH> |
748 (t = <GREATER_THAN> { if (inTemplate) newLine = true; }) |
749 t = <GREATER_EQUALS> | t = <LESS_EQUALS> |
750 t = <LOGICAL_EQUALS> | t = <NOT_EQUALS> | t = <LOGICAL_AND> | t = <LOGICAL_OR> | t = <XOR> |
751 t = <QUESTION_MARK> | t = <COLON> | t = <DOUBLECOLON> |
752 t = <DOUBLELESSTHAN> |
753 t = <DOUBLEGREATERTHAN> |
754 t = <TRIPLEGREATERTHAN> |
759 t = <DIVIDE_EQUALS> |
765 (t = <SEMI_COLON> { if (!inForLoop) newLine = true; } )
766 | t = <STRING_LITERAL> | t = <CHARACTER_LITERAL> |
767 t = <INTEGER_LITERAL> | t = <FLOATING_POINT_LITERAL> |
768 (t = <DEFINE> { newLine = true; } )
771 if (text.equals("")) {
775 text = text + " " + t.image;
777 if (newSpace && spaceSeparator(t)) {
778 text = text + " " + t.image;
780 text = text + t.image;
781 if (spaceSeparator(t))
795 if (content.size() == 0) {
803 void Parse(File f, ArrayList<String> content, ArrayList<Construct> constructs, ArrayList<String> headers) :
813 _constructs = constructs;
814 sb = new StringBuilder();
819 _constructs.add(inst);
822 //((code = C_CPP_CODE(headers)) { _content.addAll(code); })
824 flushSB = OriginalCode(sb)
827 sb = new StringBuilder();
832 // For the last piece of code
834 _content.add(sb.toString());
839 // If true, there's a new line and sb should be flushed
840 boolean OriginalCode(StringBuilder sb) :
847 if (!str.equals("\n")) {
851 _content.add(sb.toString());
857 Construct ParseSpec() :
863 LOOKAHEAD(2) res = Global_construct() |
864 LOOKAHEAD(2) res = Interface() |
865 LOOKAHEAD(2) res = Potential_commit_point_define() |
866 LOOKAHEAD(2) res = Commit_point_define() |
867 LOOKAHEAD(2) res = Commit_point_define_check() |
868 LOOKAHEAD(2) res = Potential_additional_ordering_point_define() |
869 LOOKAHEAD(2) res = Additional_ordering_point_define() |
870 LOOKAHEAD(2) res = Additional_ordering_point_define_check() |
871 LOOKAHEAD(2) res = Commit_point_clear() |
872 LOOKAHEAD(2) res = Entry_point() |
873 LOOKAHEAD(2) res = Class_begin() |
874 LOOKAHEAD(2) res = Class_end() |
875 LOOKAHEAD(2) res = Interface_define()
878 //System.out.println(res);
883 GlobalConstruct Global_construct() :
886 SequentialDefineSubConstruct code;
887 HashMap<String, String> options;
893 options = new HashMap<String, String>();
897 ((key = <IDENTIFIER>.image)
899 (value = <IDENTIFIER>.image)
901 if (options.containsKey(key)) {
902 throw new ParseException("Duplicate options!");
904 options.put(key, value);
909 (code = Global_define())
910 { res = new GlobalConstruct(_file, _content.size(), code, options); }
911 (Interface_clusters(res))?
912 (Happens_before(res))?
913 (Commutativity(res))?
916 res.unfoldInterfaceCluster();
921 SequentialDefineSubConstruct Global_define() :
923 ArrayList<String> initVar, cleanup, defineFunc, code, declareStruct;
924 ArrayList<ArrayList<String>> defineFuncs;
925 ArrayList<VariableDeclaration> declareVars;
926 ArrayList<ArrayList<String>> declareStructs;
927 VariableDeclaration declareVar;
932 declareVars = new ArrayList<VariableDeclaration>();
933 initVar = new ArrayList<String>();
934 cleanup = new ArrayList<String>();
935 defineFuncs = new ArrayList<ArrayList<String>>();
936 declareStructs = new ArrayList<ArrayList<String>>();
939 (<DECLARE_STRUCT> (declareStruct = C_CPP_CODE(null) {
940 declareStructs.add(declareStruct); }))*
941 (<DECLARE_VAR> ((declareVar = TypeParam() <SEMI_COLON> {
942 declareVars.add(declareVar); } )*))?
943 (<INIT_VAR> (code = C_CPP_CODE(null) { initVar = code; } ))?
944 (<CLEANUP> (code = C_CPP_CODE(null) { cleanup = code; } ))?
945 (<DEFINE_FUNC> (defineFunc = C_CPP_CODE(null) { defineFuncs.add(defineFunc); }))*
947 SequentialDefineSubConstruct res = new
948 SequentialDefineSubConstruct(declareStructs, declareVars, initVar, cleanup, defineFuncs);
949 //System.out.println(res);
954 ConditionalInterface Conditional_interface() :
956 String interfaceName, hbConditionLabel;
960 hbConditionLabel = "";
962 interfaceName = <IDENTIFIER>.image (<OPEN_PAREN> hbConditionLabel =
963 <IDENTIFIER>.image <CLOSE_PAREN>)?
965 return new ConditionalInterface(interfaceName, hbConditionLabel);
969 void Interface_cluster(GlobalConstruct inst) :
972 ConditionalInterface condInterface;
975 (clusterName= <IDENTIFIER>.image)
976 <EQUALS> <OPEN_BRACE>
977 (condInterface = Conditional_interface()
978 { inst.addInterface2Cluster(clusterName, condInterface); }
980 (<COMMA> condInterface = Conditional_interface()
981 { inst.addInterface2Cluster(clusterName, condInterface); }
986 void Interface_clusters(GlobalConstruct inst) :
989 <INTERFACE_CLUSTER> (Interface_cluster(inst))+
992 void Happens_before(GlobalConstruct inst) :
994 ConditionalInterface left, right;
999 left = Conditional_interface() <HB_SYMBOL> right = Conditional_interface()
1000 { inst.addHBCondition(left, right); }
1004 void Commutativity(GlobalConstruct inst) :
1006 String method1, method2, condition;
1007 ArrayList<String> content;
1011 content = new ArrayList<String>();
1016 method1 = <IDENTIFIER>.image <COMMUTATIVITY_SYMBOL>
1017 method2 = <IDENTIFIER>.image
1019 content = C_CPP_CODE(null)
1020 { condition = stringArray2String(content); }
1022 inst.addCommutativityRule(method1, method2, condition);
1027 InterfaceConstruct Interface() :
1029 InterfaceConstruct res;
1030 String interfaceName, condition, idCode, check,
1031 postCheck, commitPoint, hbLabel, hbCondition;
1032 ArrayList<String> commitPointSet;
1033 ArrayList<String> action, postAction;
1034 HashMap<String, String> hbConditions;
1035 ArrayList<String> content;
1040 action = new ArrayList<String>();
1045 commitPointSet = new ArrayList<String>();
1046 hbConditions = new HashMap<String, String>();
1047 postAction = new ArrayList<String>();
1050 <INTERFACE> (interfaceName = <IDENTIFIER>.image)
1052 (commitPoint = <IDENTIFIER>.image
1053 { commitPointSet.add(commitPoint); }
1056 (commitPoint = <IDENTIFIER>.image)
1058 if (commitPointSet.contains(commitPoint)) {
1059 throw new ParseException(interfaceName + " has" +
1060 "duplicate commit point labels");
1062 commitPointSet.add(commitPoint);
1066 (<CONDITION> (content = C_CPP_CODE(null) { condition = stringArray2String(content); }))?
1069 (hbLabel = <IDENTIFIER>.image) <DOUBLECOLON>
1070 (content = C_CPP_CODE(null) { hbCondition = stringArray2String(content); })
1072 if (hbConditions.containsKey(hbLabel)) {
1073 throw new ParseException(interfaceName + " has" +
1074 "duplicate happens-before condtion labels");
1076 hbConditions.put(hbLabel, hbCondition);
1079 (<ID> (content = C_CPP_CODE(null) { idCode = stringArray2String(content); }))?
1080 (<CHECK> (content = C_CPP_CODE(null) { check = stringArray2String(content); }))?
1081 (<ACTION> action = C_CPP_CODE(null))?
1082 (<POST_ACTION> (postAction = C_CPP_CODE(null) ))?
1083 (<POST_CHECK> (content = C_CPP_CODE(null) { postCheck = stringArray2String(content); }))?
1086 res = new InterfaceConstruct(_file, _content.size(), interfaceName, commitPointSet, condition,
1087 hbConditions, idCode, check, action, postAction, postCheck);
1093 PotentialCPDefineConstruct Potential_commit_point_define() :
1095 PotentialCPDefineConstruct res;
1096 String label, condition;
1097 ArrayList<String> content;
1103 <POTENTIAL_COMMIT_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1104 <LABEL> (label = <IDENTIFIER>.image)
1107 res = new PotentialCPDefineConstruct(_file, _content.size(), label, condition);
1112 PotentialCPDefineConstruct Potential_additional_ordering_point_define() :
1114 PotentialCPDefineConstruct res;
1115 String label, condition;
1116 ArrayList<String> content;
1122 <POTENTIAL_ADDITIONAL_ORDERING_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1123 <LABEL> (label = <IDENTIFIER>.image)
1126 // Set the boolean flag isAdditionalOrderingPoint to be true
1127 res = new PotentialCPDefineConstruct(_file, _content.size(), true, label, condition);
1133 CPDefineConstruct Commit_point_define() :
1135 CPDefineConstruct res;
1136 String label, potentialCPLabel, condition;
1137 ArrayList<String> content;
1143 <COMMIT_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1144 <POTENTIAL_COMMIT_POINT_LABEL> (potentialCPLabel = <IDENTIFIER>.image)
1145 <LABEL> (label = <IDENTIFIER>.image)
1148 res = new CPDefineConstruct(_file, _content.size(), false, label, potentialCPLabel, condition);
1153 CPDefineConstruct Additional_ordering_point_define() :
1155 CPDefineConstruct res;
1156 String label, potentialCPLabel, condition;
1157 ArrayList<String> content;
1163 <ADDITIONAL_ORDERING_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1164 <POTENTIAL_ADDITIONAL_ORDERING_POINT_LABEL> (potentialCPLabel = <IDENTIFIER>.image)
1165 <LABEL> (label = <IDENTIFIER>.image)
1168 // Set the boolean flag isAdditionalOrderingPoint to be true
1169 res = new CPDefineConstruct(_file, _content.size(), true, label, potentialCPLabel, condition);
1174 CPClearConstruct Commit_point_clear() :
1176 CPClearConstruct res;
1177 String label, condition;
1178 ArrayList<String> content;
1184 <COMMIT_POINT_CLEAR> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1185 <LABEL> (label = <IDENTIFIER>.image)
1188 res = new CPClearConstruct(_file, _content.size(), label, condition);
1194 CPDefineCheckConstruct Commit_point_define_check() :
1196 CPDefineCheckConstruct res;
1197 String label, condition;
1198 ArrayList<String> content;
1204 <COMMIT_POINT_DEFINE_CHECK> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1205 <LABEL> (label = <IDENTIFIER>.image)
1208 res = new CPDefineCheckConstruct(_file, _content.size(), false, label, condition);
1213 CPDefineCheckConstruct Additional_ordering_point_define_check() :
1215 CPDefineCheckConstruct res;
1216 String label, condition;
1217 ArrayList<String> content;
1223 <ADDITIONAL_ORDERING_POINT_DEFINE_CHECK> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1224 <LABEL> (label = <IDENTIFIER>.image)
1227 // Set the boolean flag isAdditionalOrderingPoint to be true
1228 res = new CPDefineCheckConstruct(_file, _content.size(), true, label, condition);
1233 EntryPointConstruct Entry_point() :
1241 return new EntryPointConstruct(_file, _content.size());
1245 ClassBeginConstruct Class_begin() :
1253 return new ClassBeginConstruct(_file, _content.size());
1257 ClassEndConstruct Class_end() :
1265 return new ClassEndConstruct(_file, _content.size());
1269 InterfaceDefineConstruct Interface_define() :
1275 <INTERFACE_DEFINE> (name = <IDENTIFIER>.image)
1278 return new InterfaceDefineConstruct(_file, _content.size(), name);