Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/GPDefSyntaxAnalyzerSem.cs @ 9430

Last change on this file since 9430 was 9430, checked in by gkronber, 11 years ago

initial import of GPDL parser plugin

File size: 6.4 KB
Line 
1// GPDefSyntaxAnalyzerSem.cs                                              HDO, 2006-08-28
2// -------------
3// Semantic evaluator for table-driven top-down parsing.
4// Generated by Coco-2 (PGT).
5//=====================================|========================================
6
7using System;
8using System.Text;
9using System.Collections;
10using System.Collections.Generic;
11
12using Lex = GPDefSyntaxAnalyzerLex;
13using Syn = GPDefSyntaxAnalyzerSyn;
14
15public class GPDefSyntaxAnalyzerSem {
16
17
18  public const String MODULENAME = "GPDefSyntaxAnalyzerSem";
19
20  public static void GPDefSyntaxAnalyzerSemMethod(Utils.ModuleAction action, out String moduleName) {
21  //-----------------------------------|----------------------------------------
22    moduleName = MODULENAME;
23    switch (action) {
24      case Utils.ModuleAction.getModuleName:
25        return;
26      case Utils.ModuleAction.initModule:
27        break;
28      case Utils.ModuleAction.resetModule:
29        break;
30      case Utils.ModuleAction.cleanupModule:
31        return;
32    } // switch
33  } // GPDefSyntaxAnalyzerSemMethod
34
35
36  // *** start of global SYN and SEM declarations from ATG ***
37 
38
39  // *** end of global SYN and SEM declarations from ATG ***
40
41 
42  private static void P_source() {
43    Lex.GETsourceAttr();
44    for (; ; ) {
45      switch (GPDefSyntaxAnalyzerLex.curCh) {
46        case Utils.EF:
47          Errors.SemError(GPDefSyntaxAnalyzerLex.curLine, GPDefSyntaxAnalyzerLex.curCol, "end of file in source text");
48          return;
49        case '<':
50          GPDefSyntaxAnalyzerLex.NextCh();
51          if (GPDefSyntaxAnalyzerLex.curCh == '<') {
52            Errors.Warning(GPDefSyntaxAnalyzerLex.curLine, GPDefSyntaxAnalyzerLex.curCol, "non closed source text before?");
53            GPDefSyntaxAnalyzerLex.NextCh();
54          }
55          break;
56        case '>':
57          GPDefSyntaxAnalyzerLex.NextCh();
58          if (GPDefSyntaxAnalyzerLex.curCh == '>') {
59            GPDefSyntaxAnalyzerLex.curCh = ' ';          // force GPDefSyntaxAnalyzerLex to get next character
60            return;
61          }
62          break;
63        default:
64          GPDefSyntaxAnalyzerLex.NextCh();
65          break;
66      }
67    }
68  } // P_source
69
70
71  private static void NT_GPDefSyntaxAnalyzer() {
72    for (;;) {
73      switch (Syn.Interpret()) {
74        case 0:
75          return;
76        case 1:
77          Lex.GETidentAttr();
78          break;
79        case 2:
80          NT_NonterminalDecl();
81          break;
82        case 3:
83          NT_TerminalDecl();
84          break;
85        case 4:
86          NT_RuleDef();
87          break;
88        case 5:
89          Lex.GETidentAttr();
90          break;
91      } // switch
92    } // for
93  } // NT_GPDefSyntaxAnalyzer
94
95  private static void NT_SemDecl() {
96    for (;;) {
97      switch (Syn.Interpret()) {
98        case 0:
99          return;
100      } // switch
101    } // for
102  } // NT_SemDecl
103
104  private static void NT_SemAction() {
105    for (;;) {
106      switch (Syn.Interpret()) {
107        case 0:
108          return;
109      } // switch
110    } // for
111  } // NT_SemAction
112
113  private static void NT_NonterminalDecl() {
114    for (;;) {
115      switch (Syn.Interpret()) {
116        case 0:
117          return;
118        case 1:
119          Lex.GETidentAttr();
120          break;
121      } // switch
122    } // for
123  } // NT_NonterminalDecl
124
125  private static void NT_TerminalDecl() {
126    for (;;) {
127      switch (Syn.Interpret()) {
128        case 0:
129          return;
130        case 1:
131          Lex.GETidentAttr();
132          break;
133        case 2:
134          NT_ConstraintDef();
135          break;
136      } // switch
137    } // for
138  } // NT_TerminalDecl
139
140  private static void NT_ConstraintDef() {
141    for (;;) {
142      switch (Syn.Interpret()) {
143        case 0:
144          return;
145        case 1:
146          NT_ConstraintRule();
147          break;
148      } // switch
149    } // for
150  } // NT_ConstraintDef
151
152  private static void NT_ConstraintRule() {
153    for (;;) {
154      switch (Syn.Interpret()) {
155        case 0:
156          return;
157        case 1:
158          Lex.GETidentAttr();
159          break;
160        case 2:
161          NT_SetDefinition();
162          break;
163      } // switch
164    } // for
165  } // NT_ConstraintRule
166
167  private static void NT_SetDefinition() {
168    for (;;) {
169      switch (Syn.Interpret()) {
170        case 0:
171          return;
172      } // switch
173    } // for
174  } // NT_SetDefinition
175
176  private static void NT_RuleDef() {
177    for (;;) {
178      switch (Syn.Interpret()) {
179        case 0:
180          return;
181        case 1:
182          Lex.GETidentAttr();
183          break;
184        case 2:
185          NT_SemDecl();
186          break;
187        case 3:
188          NT_SynExpr();
189          break;
190      } // switch
191    } // for
192  } // NT_RuleDef
193
194  private static void NT_SynExpr() {
195    for (;;) {
196      switch (Syn.Interpret()) {
197        case 0:
198          return;
199        case 1:
200          NT_SynTerm();
201          break;
202        case 2:
203          NT_SynTerm();
204          break;
205      } // switch
206    } // for
207  } // NT_SynExpr
208
209  private static void NT_SynTerm() {
210    for (;;) {
211      switch (Syn.Interpret()) {
212        case 0:
213          return;
214        case 1:
215          NT_SynFact();
216          break;
217        case 2:
218          NT_SynFact();
219          break;
220      } // switch
221    } // for
222  } // NT_SynTerm
223
224  private static void NT_SynFact() {
225    for (;;) {
226      switch (Syn.Interpret()) {
227        case 0:
228          return;
229        case 1:
230          Lex.GETidentAttr();
231          break;
232        case 2:
233          NT_SynExpr();
234          break;
235        case 3:
236          NT_SynExpr();
237          break;
238        case 4:
239          NT_SynExpr();
240          break;
241        case 5:
242          NT_SemAction();
243          break;
244      } // switch
245    } // for
246  } // NT_SynFact
247
248
249  public delegate void PragmaMethod();
250  public static PragmaMethod[] pragmaMethods = {
251      new PragmaMethod(P_source)
252    };
253
254
255  public static void StartSem() {
256  //-----------------------------------|----------------------------------------
257    for (;;) {
258      switch (Syn.Interpret()) {
259        case 0:
260          return;
261        case 1:
262          NT_GPDefSyntaxAnalyzer();
263          break;
264      } // switch
265    } // for
266  } // StartSem
267
268   
269} // GPDefSyntaxAnalyzerSem
270
271// End of GPDefSyntaxAnalyzerSem.cs
272//=====================================|========================================
Note: See TracBrowser for help on using the repository browser.