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.
21 b) Interface construct
26 @Condition: ... (Optional)
27 @ID: ... (Optional, use default ID)
32 @Post_action: (Optional)
33 @Post_check: (Optional)
36 c) Potential commit construct
38 @Potential_commit_point_define: ...
42 d) Commit point define construct
44 @Commit_point_define_check: ...
51 @Commit_point_define: ...
52 @Potential_commit_point_label: ...
61 JAVA_UNICODE_ESCAPE = true;
64 PARSER_BEGIN(SpecParser)
65 package edu.uci.eecs.specCompiler.grammerParser;
68 public static void main(String[] argvs)
69 throws ParseException, TokenMgrError {
70 SpecParser parser = new SpecParser(System.in);
72 System.out.println("Parsing finished!");
75 PARSER_END(SpecParser)
87 // Comment for the specification
88 <"#" (~["\n", "\r"])* (["\n", "\r"])>
101 <GLOBAL_DEFINE: "@Global_define:">
103 <INTERFACE_CLUSTER: "@Interface_cluster:">
105 <HAPPENS_BEFORE: "@Happens_before:">
107 <INTERFACE: "@Interface:">
109 <COMMIT_POINT_SET: "@Commit_point_set:">
111 <CONDITION: "@Condition:">
113 <NUM_OR_EMPTY: ["1"-"9"](["0"-"9"])+ | "">
115 <ONE_HB_CONDITION: "@HB_condition:" <NUM_OR_EMPTY> (~["@", "#", "$"])+>
117 <ALL_HB_CONDITIONS: (<ONE_HB_CONDITION>)*>
124 <POST_ACTION: "@Post_action:">
126 <POST_CHECK: "@Post_check:">
128 <POTENTIAL_COMMIT_POINT_DEFINE: "@Potential_commit_point_define:">
132 <COMMIT_POINT_DEFINE_CHECK: "@Commit_point_define_check:">
135 <COMMIT_POINT_DEFINE: "@Commit_point_define:">
137 <POTENTIAL_COMMIT_POINT_LABEL: "@Potential_commit_point_label:">
139 <IDENTIFIER: (["a"-"z", "A"-"Z", "_"]) (["0"-"9", "a"-"z", "A"-"Z", "_"])*>
148 void Global_construct() :
153 <HAPPENS_BEFORE> <IDENTIFIER> "(" <IDENTIFIER> ")" "->" <IDENTIFIER>
161 <(~["@", "#", "$"])+>
164 void Global_define() :
167 <GLOBAL_DEFINE> C_CPP_CODE()
170 void Conditional_interface() :
173 <IDENTIFIER> (<"(" <IDENTIFIER> ")"> | "")
176 void Interface_cluster() :
179 <IDENTIFIER> "=" "{" Conditional_interface() (",," Conditional_interface())* "}"
182 void Interface_clusters() :
185 <INTERFACE_CLUSTER> (Interface_cluster())+
188 void Happens_before() :
193 <HAPPENS_BEFORE> <IDENTIFIER> "(" <IDENTIFIER> ")" "->" <IDENTIFIER>
203 <HAPPENS_BEFORE> <IDENTIFIER> "(" <IDENTIFIER> ")" "->" <IDENTIFIER>
208 void Potential_commit_point_define() :
213 <HAPPENS_BEFORE> <IDENTIFIER> "(" <IDENTIFIER> ")" "->" <IDENTIFIER>
219 void Commit_point_define() :
224 <HAPPENS_BEFORE> <IDENTIFIER> "(" <IDENTIFIER> ")" "->" <IDENTIFIER>
230 void Commit_point_define_check() :
235 <HAPPENS_BEFORE> <IDENTIFIER> "(" <IDENTIFIER> ")" "->" <IDENTIFIER>