Changeset 9727
- Timestamp:
- 07/19/13 08:48:19 (11 years ago)
- Location:
- branches/HeuristicLab.Problems.GPDL
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/GPDef.atg
r9724 r9727 6 6 7 7 COMPILER GPDef 8 static StringBuilder srcText;9 8 public static HeuristicLab.Optimization.IProblem problem; 10 static string lastSrc;11 9 12 10 CHARACTERS … … 32 30 33 31 GPDef = (. 34 string identStr = "";35 32 RuleNode ruleNode = null; 36 33 GPDefNode gpDef = new GPDefNode(); … … 81 78 NonterminalDecl<out NonTerminalNode ntNode> = (. string identStr = ""; ntNode = null; string src = ""; .) 82 79 ident (. identStr = t.val; .) 83 SourceCode<out src>(.80 [ SourceCode<out src> ] (. 84 81 var myNtNode = new NonTerminalNode(); 85 82 ntNode = myNtNode; … … 99 96 .) 100 97 ident (. identStr = t.val; .) 101 SourceCode<out src>(.98 [ SourceCode<out src> ] (. 102 99 myTNode = new TerminalNode(); 103 100 tNode = myTNode; … … 125 122 /******************************************************/ 126 123 ConstraintRule<out ConstraintNode constraint> = (. 127 string identStr = null;128 124 constraint = null; 129 125 .) … … 153 149 .) 154 150 ident (. identStr = t.val; .) 155 SourceCode<out src> '='(.151 [ SourceCode<out src> ] '=' (. 156 152 myRule = new RuleNode(); 157 153 rule = myRule; … … 199 195 string src = ""; 200 196 .) 201 (ident 202 SourceCode<out src>(.197 (ident (. identStr = t.val; .) 198 [ SourceCode<out src> ] (. 203 199 var callNode = new CallSymbolNode{Ident = identStr}; 204 200 callNode.ActualParameter = src; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/Parser.cs
r9724 r9727 27 27 int errDist = minErrDist; 28 28 29 static StringBuilder srcText; 30 public static HeuristicLab.Optimization.IProblem problem; 31 static string lastSrc; 29 public static HeuristicLab.Optimization.IProblem problem; 32 30 33 31 … … 103 101 104 102 void GPDef() { 105 string identStr = "";106 103 RuleNode ruleNode = null; 107 104 GPDefNode gpDef = new GPDefNode(); … … 164 161 Expect(1); 165 162 identStr = t.val; 166 SourceCode(out src); 163 if (la.kind == 2) { 164 SourceCode(out src); 165 } 167 166 var myNtNode = new NonTerminalNode(); 168 167 ntNode = myNtNode; … … 182 181 Expect(1); 183 182 identStr = t.val; 184 SourceCode(out src); 183 if (la.kind == 2) { 184 SourceCode(out src); 185 } 185 186 myTNode = new TerminalNode(); 186 187 tNode = myTNode; … … 206 207 Expect(1); 207 208 identStr = t.val; 208 SourceCode(out src); 209 if (la.kind == 2) { 210 SourceCode(out src); 211 } 209 212 Expect(20); 210 213 myRule = new RuleNode(); … … 247 250 248 251 void ConstraintRule(out ConstraintNode constraint) { 249 string identStr = null;250 252 constraint = null; 251 253 … … 310 312 Get(); 311 313 identStr = t.val; 312 SourceCode(out src); 314 if (la.kind == 2) { 315 SourceCode(out src); 316 } 313 317 var callNode = new CallSymbolNode{Ident = identStr}; 314 318 callNode.ActualParameter = src; -
branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/GPDef.atg
r9724 r9727 33 33 . 34 34 35 NonterminalDecl = ident "<<" {ANY} ">>"'.'35 NonterminalDecl = ident [ "<<" {ANY} ">>" ] '.' 36 36 . 37 37 38 TerminalDecl = ident "<<" {ANY} ">>"38 TerminalDecl = ident [ "<<" {ANY} ">>" ] 39 39 [ "CONSTRAINTS" ConstraintDef ] 40 40 '.' … … 48 48 . 49 49 50 RuleDef = ident "<<" {ANY} ">>"'=' [SemDecl] SynExpr '.'50 RuleDef = ident [ "<<" {ANY} ">>" ] '=' [SemDecl] SynExpr '.' 51 51 . 52 52 … … 58 58 59 59 SynFact = 60 ident "<<" {ANY} ">>"60 ident [ "<<" {ANY} ">>" ] 61 61 | "EPS" 62 62 | '(' SynExpr ')' -
branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/Parser.cs
r9724 r9727 129 129 void NonterminalDecl() { 130 130 Expect(1); 131 Expect(4); 132 while (StartOf(1)) { 133 Get(); 134 } 135 Expect(5); 131 if (la.kind == 4) { 132 Get(); 133 while (StartOf(1)) { 134 Get(); 135 } 136 Expect(5); 137 } 136 138 Expect(13); 137 139 } … … 139 141 void TerminalDecl() { 140 142 Expect(1); 141 Expect(4); 142 while (StartOf(1)) { 143 Get(); 144 } 145 Expect(5); 143 if (la.kind == 4) { 144 Get(); 145 while (StartOf(1)) { 146 Get(); 147 } 148 Expect(5); 149 } 146 150 if (la.kind == 16) { 147 151 Get(); … … 153 157 void RuleDef() { 154 158 Expect(1); 155 Expect(4); 156 while (StartOf(1)) { 157 Get(); 158 } 159 Expect(5); 159 if (la.kind == 4) { 160 Get(); 161 while (StartOf(1)) { 162 Get(); 163 } 164 Expect(5); 165 } 160 166 Expect(21); 161 167 if (la.kind == 14) { … … 239 245 case 1: { 240 246 Get(); 241 Expect(4); 242 while (StartOf(1)) { 243 Get(); 244 } 245 Expect(5); 247 if (la.kind == 4) { 248 Get(); 249 while (StartOf(1)) { 250 Get(); 251 } 252 Expect(5); 253 } 246 254 break; 247 255 }
Note: See TracChangeset
for help on using the changeset viewer.