Changeset 9842
- Timestamp:
- 08/02/13 18:11:26 (12 years ago)
- Location:
- branches/HeuristicLab.Problems.GPDL
- Files:
-
- 8 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GPDL
- Property svn:ignore
-
old new 1 1 _ReSharper.HeuristicLab.Problems.GPDL 2 2 *.suo 3 bin 4 *.user
-
- Property svn:ignore
-
branches/HeuristicLab.Problems.GPDL/GpdlCompiler/Program.cs
r9724 r9842 1 // GpdlCompiler.cs HDO, 2006-08-28 2 // ----- 3 // Main program for compiler generated from GpdlCompiler.atg with Coco-2. 4 //=====================================|======================================== 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 5 21 6 22 using System; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/CodeEditor.xaml.cs
r9724 r9842 1 using System.Collections.Generic; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System.Collections.Generic; 2 23 using System.IO; 3 24 using System.Windows.Controls; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/ColorizeErrors.cs
r9674 r9842 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 2 22 using System.Collections.Generic; 3 using System.Linq;4 using System.Text;5 23 using System.Windows; 6 24 using System.Windows.Media; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/CreateProblemMenuItem.cs
r9528 r9842 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlCompletionData.cs
r9674 r9842 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using ICSharpCode.AvalonEdit.CodeCompletion; 3 24 using ICSharpCode.AvalonEdit.Document; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlEditor.Designer.cs
r9674 r9842 1 using System.Windows.Forms; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System.Windows.Forms; 2 23 using HeuristicLab.MainForm.WindowsForms; 3 24 -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlEditor.cs
r9725 r9842 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.IO; 3 24 using System.Linq; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlExampleDataDescriptor.cs
r9519 r9842 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 5 22 using HeuristicLab.Problems.Instances; 6 23 -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlExampleProvider.cs
r9519 r9842 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using HeuristicLab.Problems.GPDL.Views.Properties; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlProblemInstanceConsumerView.cs
r9528 r9842 1 using HeuristicLab.Problems.Instances.Views; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using HeuristicLab.Problems.Instances.Views; 2 23 3 24 namespace HeuristicLab.Problems.GPDL.Views { -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Plugin.cs.frame
r9674 r9842 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.PluginInfrastructure; 26 23 -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.sln
r9696 r9842 29 29 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GpdlCompiler", "GpdlCompiler\GpdlCompiler.csproj", "{C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}" 30 30 EndProject 31 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{94073310-27AB-4C93-8FDD-3D35824AE3F7}" 32 EndProject 31 33 Global 32 34 GlobalSection(SolutionConfigurationPlatforms) = preSolution … … 51 53 {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Release|Any CPU.ActiveCfg = Release|Any CPU 52 54 {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Release|Any CPU.Build.0 = Release|Any CPU 55 {94073310-27AB-4C93-8FDD-3D35824AE3F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 56 {94073310-27AB-4C93-8FDD-3D35824AE3F7}.Debug|Any CPU.Build.0 = Debug|Any CPU 57 {94073310-27AB-4C93-8FDD-3D35824AE3F7}.Release|Any CPU.ActiveCfg = Release|Any CPU 58 {94073310-27AB-4C93-8FDD-3D35824AE3F7}.Release|Any CPU.Build.0 = Release|Any CPU 53 59 EndGlobalSection 54 60 GlobalSection(SolutionProperties) = preSolution -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/AST.cs
r9430 r9842 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 1 22 using System.Collections.Generic; 2 using System ;23 using System.Linq; 3 24 using System.Text; 4 25 … … 18 39 this.ClassCodeNode = new CodeNode(); 19 40 this.InitCodeNode = new CodeNode(); 41 } 42 43 public bool IsSymbolDefined(SymbolNode n) { 44 return NonTerminals.Any(s => s.Ident == n.Ident) || 45 Terminals.Any(s => s.Ident == n.Ident); 46 } 47 public bool IsNonTerminalDefined(string ntIdent) { 48 return NonTerminals.Any(s => s.Ident == ntIdent); 49 } 50 public bool IsRuleDefined(RuleNode n) { 51 return IsRuleDefined(n.NtSymbol); 52 } 53 public bool IsRuleDefined(string ntSymbol) { 54 return Rules.Any(r => r.NtSymbol == ntSymbol); 55 } 56 public string UndefinedNonTerminals() { 57 var sb = new StringBuilder(); 58 foreach (var nt in NonTerminals) { 59 if (!IsRuleDefined(nt.Ident)) { 60 sb.AppendFormat("{0} ", nt.Ident); 61 } 62 } 63 return sb.ToString(); 20 64 } 21 65 } -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/GPDef.atg
r9727 r9842 1 /* HeuristicLab 2 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 3 * 4 * This file is part of HeuristicLab. 5 * 6 * HeuristicLab is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * HeuristicLab is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 // Coco/R grammar for the GPDL compiler 21 1 22 $namespace=HeuristicLab.Problems.GPDL 2 23 3 24 using System.Text; 4 25 using System.Collections.Generic; 26 using System.Linq; 5 27 using IEnumerableConstraintNode = System.Collections.Generic.IEnumerable<ConstraintNode>; 6 28 … … 44 66 ] 45 67 46 "NONTERMINALS" { NonterminalDecl<out ntNode> (. gpDef.NonTerminals.Add(ntNode); .) 47 } 48 "TERMINALS" { TerminalDecl<out tNode> (. gpDef.Terminals.Add(tNode); .) 49 } 50 "RULES" { RuleDef<out ruleNode> (. gpDef.Rules.Add(ruleNode); .) 51 } 68 "NONTERMINALS" { NonterminalDecl<out ntNode> (. if(gpDef.IsSymbolDefined(ntNode)) { 69 SemErr("Duplicate non-terminal symbol: " + ntNode.Ident); 70 } else { 71 gpDef.NonTerminals.Add(ntNode); 72 } 73 .) 74 } (. if(!gpDef.NonTerminals.Any()) 75 SemErr("No non-terminal symbols defined."); 76 .) 77 "TERMINALS" { TerminalDecl<out tNode> (. if(gpDef.IsSymbolDefined(tNode)) { 78 SemErr("Duplicate terminal symbol: " + tNode.Ident); 79 } else { 80 gpDef.Terminals.Add(tNode); 81 } 82 .) 83 } (. if(!gpDef.Terminals.Any()) 84 SemErr("No terminal symbols defined."); 85 .) 86 "RULES" { RuleDef<out ruleNode> (. 87 if(!gpDef.IsNonTerminalDefined(ruleNode.NtSymbol)) { 88 SemErr("Non-terminal symbol " + ruleNode.NtSymbol + " is not defined in the NONTERMINALS section."); 89 } else if(gpDef.IsRuleDefined(ruleNode)) { 90 SemErr("Duplicate rule definition for non-terminal symbol " + ruleNode.NtSymbol); 91 } else { 92 gpDef.Rules.Add(ruleNode); 93 } 94 .) 95 } (. 96 var undefinedNT = gpDef.UndefinedNonTerminals(); 97 if(!string.IsNullOrEmpty(undefinedNT)) { 98 SemErr("Rules missing in the RULES section for: " + undefinedNT); 99 } 100 .) 52 101 (. fitnessFunNode = new FitnessFunctionNode(); 53 102 gpDef.FitnessFunctionNode = fitnessFunNode; 54 103 .) 55 104 ("MAXIMIZE" (. fitnessFunNode.Maximization = true; .) … … 57 106 ) 58 107 SourceCode<out src> (. fitnessFunNode.SrcCode = src; .) 108 (. if(errors.count > 0) throw new FatalError("Syntactic or semantic errors found."); .) 59 109 "END" ident (. 60 // SourceReader.Handle(GPDefSem.srcText.ToString()); // flush the source reader61 110 var gen = new ProblemGenerator(); 62 111 problem = gen.GenerateFromAst(gpDef); … … 125 174 .) 126 175 ident (. constraint = new ConstraintNode(t.val); .) 127 "IN" SetDefinition<constraint> // (. SourceReader.Handle(GPDefSem.srcText.ToString()); .) // flush the source reader176 "IN" SetDefinition<constraint> 128 177 . 129 178 … … 135 184 "RANGE" (. constraint.Type = ConstraintNodeType.Range; .) 136 185 SourceCode<out src> (. constraint.RangeMinExpression = src; .) 137 ".." SourceCode<out src> (. // SourceReader.Handle(GPDefSem.srcText.ToString()); // flush the source reader 138 constraint.RangeMaxExpression = src; .) 186 ".." SourceCode<out src> (. constraint.RangeMaxExpression = src; .) 139 187 ) 140 188 . … … 142 190 /******************************************************/ 143 191 RuleDef<out RuleNode rule> = (. 144 RuleExprNode expr = null;145 string identStr = null;146 RuleNode myRule = null;147 rule = null;148 string src = "";192 RuleExprNode expr = null; 193 string identStr = null; 194 RuleNode myRule = null; 195 rule = null; 196 string src = ""; 149 197 .) 150 198 ident (. identStr = t.val; .) 151 199 [ SourceCode<out src> ] '=' (. 152 153 154 200 myRule = new RuleNode(); 201 rule = myRule; 202 myRule.NtSymbol = identStr; 155 203 .) 156 204 ["LOCAL" SourceCode<out src> (. 157 myRule.LocalCode = src;205 myRule.LocalCode = src; 158 206 .) 159 207 ] … … 205 253 // not implemented | '[' SynExpr<ref rules, mBuilder> ']' 206 254 // not implemented | '{' SynExpr<ref rules, mBuilder> '}' 207 | SemAction<out action> 255 | SemAction<out action> (. expr = action; .) 208 256 ) 209 257 . -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/Grammar.cs
r9430 r9842 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 1 22 using System; 2 23 using System.Collections.Generic; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/InterpreterBuilder.cs
r9430 r9842 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 1 22 using System.Collections.Generic; 2 23 using System; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/MethodBuilder.cs
r9430 r9842 1 using System.Collections.Generic; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 2 22 using System; 3 23 using System.Text; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/Parser.cs
r9727 r9842 1 1 using System.Text; 2 2 using System.Collections.Generic; 3 using System.Linq; 3 4 using IEnumerableConstraintNode = System.Collections.Generic.IEnumerable<ConstraintNode>; 4 5 … … 125 126 while (la.kind == 1) { 126 127 NonterminalDecl(out ntNode); 127 gpDef.NonTerminals.Add(ntNode); 128 } 128 if(gpDef.IsSymbolDefined(ntNode)) { 129 SemErr("Duplicate non-terminal symbol: " + ntNode.Ident); 130 } else { 131 gpDef.NonTerminals.Add(ntNode); 132 } 133 134 } 135 if(!gpDef.NonTerminals.Any()) 136 SemErr("No non-terminal symbols defined."); 137 129 138 Expect(8); 130 139 while (la.kind == 1) { 131 140 TerminalDecl(out tNode); 132 gpDef.Terminals.Add(tNode); 133 } 141 if(gpDef.IsSymbolDefined(tNode)) { 142 SemErr("Duplicate terminal symbol: " + tNode.Ident); 143 } else { 144 gpDef.Terminals.Add(tNode); 145 } 146 147 } 148 if(!gpDef.Terminals.Any()) 149 SemErr("No terminal symbols defined."); 150 134 151 Expect(9); 135 152 while (la.kind == 1) { 136 153 RuleDef(out ruleNode); 137 gpDef.Rules.Add(ruleNode); 138 } 154 if(!gpDef.IsNonTerminalDefined(ruleNode.NtSymbol)) { 155 SemErr("Non-terminal symbol " + ruleNode.NtSymbol + " is not defined in the NONTERMINALS section."); 156 } else if(gpDef.IsRuleDefined(ruleNode)) { 157 SemErr("Duplicate rule definition for non-terminal symbol " + ruleNode.NtSymbol); 158 } else { 159 gpDef.Rules.Add(ruleNode); 160 } 161 162 } 163 var undefinedNT = gpDef.UndefinedNonTerminals(); 164 if(!string.IsNullOrEmpty(undefinedNT)) { 165 SemErr("Rules missing in the RULES section for: " + undefinedNT); 166 } 167 139 168 fitnessFunNode = new FitnessFunctionNode(); 140 169 gpDef.FitnessFunctionNode = fitnessFunNode; 141 170 142 171 if (la.kind == 10) { … … 149 178 SourceCode(out src); 150 179 fitnessFunNode.SrcCode = src; 180 if(errors.count > 0) throw new FatalError("Syntactic or semantic errors found."); 151 181 Expect(12); 152 182 Expect(1); -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/Plugin.cs.frame
r9430 r9842 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.PluginInfrastructure; 26 23 -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/ProblemGenerator.cs
r9528 r9842 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 1 22 using System; 2 23 using System.CodeDom.Compiler; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/SourceReader.cs
r9726 r9842 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 1 22 using System.Collections.Generic; 2 23 using System.Linq; … … 13 34 yield return new TerminalNode.FieldDefinition(m.Groups["refOrOut"].Value, m.Groups["type"].Value, m.Groups["id"].Value); 14 35 } 15 //var nParameters = match.Groups["id"].Captures.Count;16 //for (int i = 0; i < nParameters; i++) {17 // yield return new TerminalNode.FieldDefinition(match.Groups["refOrOut"].Captures[i].Value, match.Groups["type"].Captures[i].Value, match.Groups["id"].Captures[i].Value);18 //}19 36 } 20 37 } -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/SymbolBuilder.cs
r9430 r9842 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 1 22 using System.Collections.Generic; 2 23 using System; -
branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/GPDef.atg
r9727 r9842 1 /* HeuristicLab 2 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 3 * 4 * This file is part of HeuristicLab. 5 * 6 * HeuristicLab is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * HeuristicLab is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 1 20 $namespace=SyntaxAnalyzer 2 21 … … 15 34 IGNORE '\t' + '\r' + '\n' 16 35 36 // grammar production rules in EBNF syntax 17 37 PRODUCTIONS 18 38 GPDefSyntaxAnalyzer = -
branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/GPDefSyntaxAnalyzer.cs
r9725 r9842 1 // GPDefSyntaxAnalyzer.cs GKR, 2013 2 // ----- 3 // Main program for compiler generated from GPDef.atg with Coco/R. 4 //=====================================|======================================== 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 5 22 6 23 using System;
Note: See TracChangeset
for help on using the changeset viewer.